From 1480b09fa486a8f5252e9cd601bee165e9d0cd22 Mon Sep 17 00:00:00 2001
From: natanielruiz <nruiz9@gatech.edu>
Date: 星期一, 30 十月 2017 07:08:04 +0800
Subject: [PATCH] next

---
 code/test_preangles.py |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/code/test_preangles.py b/code/test_preangles.py
index 05f621a..971e54b 100644
--- a/code/test_preangles.py
+++ b/code/test_preangles.py
@@ -56,7 +56,8 @@
     print 'Loading snapshot.'
     # Load snapshot
     saved_state_dict = torch.load(snapshot_path)
-    load_filtered_state_dict(model, saved_state_dict)
+    model.load_state_dict(saved_state_dict)
+    # load_filtered_state_dict(model, saved_state_dict)
 
     print 'Loading data.'
 
@@ -117,9 +118,13 @@
         _, roll_bpred = torch.max(roll.data, 1)
 
         # Continuous predictions
-        yaw_predicted = angles[:,0].data.cpu()
-        pitch_predicted = angles[:,1].data.cpu()
-        roll_predicted = angles[:,2].data.cpu()
+        yaw_predicted = utils.softmax_temperature(yaw.data, 1)
+        pitch_predicted = utils.softmax_temperature(pitch.data, 1)
+        roll_predicted = utils.softmax_temperature(roll.data, 1)
+
+        yaw_predicted = torch.sum(yaw_predicted * idx_tensor, 1).cpu() * 3 - 99
+        pitch_predicted = torch.sum(pitch_predicted * idx_tensor, 1).cpu() * 3 - 99
+        roll_predicted = torch.sum(roll_predicted * idx_tensor, 1).cpu() * 3 - 99
 
         # Mean absolute error
         yaw_error += torch.sum(torch.abs(yaw_predicted - label_yaw))

--
Gitblit v1.8.0