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

---
 code/test_on_video_noconf.py |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/code/test_on_video_noconf.py b/code/test_on_video_noconf.py
index b6a8d2c..a76a396 100644
--- a/code/test_on_video_noconf.py
+++ b/code/test_on_video_noconf.py
@@ -153,12 +153,16 @@
             img_shape = img.size()
             img = img.view(1, img_shape[0], img_shape[1], img_shape[2])
             img = Variable(img).cuda(gpu)
-            
-            yaw, pitch, roll, angles = model(img)
 
-            yaw_predicted = angles[:,0].data[0].cpu()
-            pitch_predicted = angles[:,1].data[0].cpu()
-            roll_predicted = angles[:,2].data[0].cpu()
+            yaw, pitch, roll = model(img)
+
+            yaw_predicted = F.softmax(yaw)
+            pitch_predicted = F.softmax(pitch)
+            roll_predicted = F.softmax(roll)
+            # Get continuous predictions in degrees.
+            yaw_predicted = torch.sum(yaw_predicted.data[0] * idx_tensor) * 3 - 99
+            pitch_predicted = torch.sum(pitch_predicted.data[0] * idx_tensor) * 3 - 99
+            roll_predicted = torch.sum(roll_predicted.data[0] * idx_tensor) * 3 - 99
 
             # Print new frame with cube and axis
             txt_out.write(str(frame_num) + ' %f %f %f\n' % (yaw_predicted, pitch_predicted, roll_predicted))

--
Gitblit v1.8.0