7272data_dir = "inception/"
7373
7474# File containing the mappings between class-number and uid. (Downloaded)
75- path_uid_to_cls = os . path . join ( data_dir , "imagenet_2012_challenge_label_map_proto.pbtxt" )
75+ path_uid_to_cls = "imagenet_2012_challenge_label_map_proto.pbtxt"
7676
7777# File containing the mappings between uid and string. (Downloaded)
78- path_uid_to_name = os . path . join ( data_dir , "imagenet_synset_to_human_label_map.txt" )
78+ path_uid_to_name = "imagenet_synset_to_human_label_map.txt"
7979
8080# File containing the TensorFlow graph definition. (Downloaded)
81- path_graph_def = os . path . join ( data_dir , "classify_image_graph_def.pb" )
81+ path_graph_def = "classify_image_graph_def.pb"
8282
8383########################################################################
8484# Names for tensors in the computational graph.
@@ -142,7 +142,8 @@ def __init__(self):
142142 self ._cls_to_uid = {} # Map from cls to uid.
143143
144144 # Read the uid-to-name mappings from file.
145- with open (file = path_uid_to_name , mode = 'r' ) as file :
145+ path = os .path .join (data_dir , path_uid_to_name )
146+ with open (file = path , mode = 'r' ) as file :
146147 # Read all lines from the file.
147148 lines = file .readlines ()
148149
@@ -163,7 +164,8 @@ def __init__(self):
163164 self ._uid_to_name [uid ] = name
164165
165166 # Read the uid-to-cls mappings from file.
166- with open (file = path_uid_to_cls , mode = 'r' ) as file :
167+ path = os .path .join (data_dir , path_uid_to_cls )
168+ with open (file = path , mode = 'r' ) as file :
167169 # Read all lines from the file.
168170 lines = file .readlines ()
169171
@@ -270,7 +272,8 @@ def __init__(self):
270272 # platforms. In this case it is saved as a binary file.
271273
272274 # Open the graph-def file for binary reading.
273- with tf .gfile .FastGFile (path_graph_def , 'rb' ) as file :
275+ path = os .path .join (data_dir , path_graph_def )
276+ with tf .gfile .FastGFile (path , 'rb' ) as file :
274277 # The graph-def is a saved copy of a TensorFlow graph.
275278 # First we need to create an empty graph-def.
276279 graph_def = tf .GraphDef ()
0 commit comments