-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrun_demo.py
30 lines (23 loc) · 1.02 KB
/
run_demo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import sys
import argparse
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(BASE_DIR)
sys.path.append(os.path.dirname(BASE_DIR))
from global_variables import *
sys.path.append(os.path.join(g_render4cnn_root_folder, 'view_estimation'))
from evaluation_helper import viewpoint
if __name__ == '__main__':
# img_filenames = [os.path.join(BASE_DIR, 'aeroplane_image.jpg')]
# class_idxs = [g_shape_names.index('aeroplane')]
img_filenames = [os.path.join(BASE_DIR, sys.argv[1])]
class_idxs = [g_shape_names.index('car')]
output_result_file = os.path.join(BASE_DIR, 'est-view.txt')
if not os.path.exists(output_result_file):
viewpoint(img_filenames, class_idxs, output_result_file)
# display result by rendering an image of estimated viewpoint
estimated_viewpoints = [[float(x) for x in line.rstrip().split(' ')] for line in open(output_result_file,'r')]
v = estimated_viewpoints[0]
print "Estimated view: ", v