From 18a21d4b07c581a8954b08518115fb035c712b28 Mon Sep 17 00:00:00 2001 From: natanielruiz <nataniel777@hotmail.com> Date: 星期二, 08 八月 2017 07:34:09 +0800 Subject: [PATCH] Added new correct cropping for training and smoothing for video. --- code/test_resnet_bins.py | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-) diff --git a/code/test_resnet_bins.py b/code/test_resnet_bins.py index 8d0eaec..00d2109 100644 --- a/code/test_resnet_bins.py +++ b/code/test_resnet_bins.py @@ -46,9 +46,12 @@ gpu = args.gpu_id snapshot_path = os.path.join('output/snapshots', args.snapshot + '.pkl') - # ResNet50 with 3 outputs. - model = hopenet.Hopenet(torchvision.models.resnet.Bottleneck, [3, 4, 6, 3], 66) - # model = hopenet.Hopenet(torchvision.models.resnet.BasicBlock, [2, 2, 2, 2], 66) + # ResNet101 with 3 outputs. + # model = hopenet.Hopenet(torchvision.models.resnet.Bottleneck, [3, 4, 23, 3], 66) + # ResNet50 + # model = hopenet.Hopenet(torchvision.models.resnet.Bottleneck, [3, 4, 6, 3], 66) + # ResNet18 + model = hopenet.Hopenet(torchvision.models.resnet.BasicBlock, [2, 2, 2, 2], 66) print 'Loading snapshot.' # Load snapshot @@ -87,7 +90,6 @@ for i, (images, labels, name) in enumerate(test_loader): images = Variable(images).cuda(gpu) - total += labels.size(0) label_yaw = labels[:,0] label_pitch = labels[:,1] @@ -126,8 +128,7 @@ if args.save_viz: name = name[0] cv2_img = cv2.imread(os.path.join(args.data_dir, name + '.jpg')) - #cv2_img = cv2.cvtColor(cv2_img, cv2.COLOR_RGB2BGR) - #print name + #print os.path.join('output/images', name + '.jpg') #print label_yaw[0] * 3 - 99, label_pitch[0] * 3 - 99, label_roll[0] * 3 - 99 #print yaw_predicted * 3 - 99, pitch_predicted * 3 - 99, roll_predicted * 3 - 99 utils.plot_pose_cube(cv2_img, yaw_predicted * 3 - 99, pitch_predicted * 3 - 99, roll_predicted * 3 - 99) -- Gitblit v1.8.0