From 0b8e19c1cc8ad03805d4ca68f32df6e4806a36e8 Mon Sep 17 00:00:00 2001 From: natanielruiz <nataniel777@hotmail.com> Date: 星期五, 08 九月 2017 11:15:10 +0800 Subject: [PATCH] Finetune layer working --- code/utils.py | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/code/utils.py b/code/utils.py index 09a47a8..5a18d7c 100644 --- a/code/utils.py +++ b/code/utils.py @@ -7,9 +7,14 @@ import math from math import cos, sin +def softmax_temperature(tensor, temperature): + result = torch.exp(tensor / temperature) + result = torch.div(result, torch.sum(result, 1).unsqueeze(1).expand_as(result)) + return result + def get_pose_params_from_mat(mat_path): # This functions gets the pose parameters from the .mat - # Annotations that come with the 300W_LP dataset. + # Annotations that come with the Pose_300W_LP dataset. mat = sio.loadmat(mat_path) # [pitch yaw roll tdx tdy tdz scale_factor] pre_pose_params = mat['Pose_Para'][0] -- Gitblit v1.8.0