Skip to content

Commit

Permalink
Fixed data_dir execution order bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hvass-Labs committed Oct 12, 2016
1 parent 0bd3e43 commit 1a2aa6e
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions inception.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@
data_dir = "inception/"

# File containing the mappings between class-number and uid. (Downloaded)
path_uid_to_cls = os.path.join(data_dir, "imagenet_2012_challenge_label_map_proto.pbtxt")
path_uid_to_cls = "imagenet_2012_challenge_label_map_proto.pbtxt"

# File containing the mappings between uid and string. (Downloaded)
path_uid_to_name = os.path.join(data_dir, "imagenet_synset_to_human_label_map.txt")
path_uid_to_name = "imagenet_synset_to_human_label_map.txt"

# File containing the TensorFlow graph definition. (Downloaded)
path_graph_def = os.path.join(data_dir, "classify_image_graph_def.pb")
path_graph_def = "classify_image_graph_def.pb"

########################################################################
# Names for tensors in the computational graph.
Expand Down Expand Up @@ -142,7 +142,8 @@ def __init__(self):
self._cls_to_uid = {} # Map from cls to uid.

# Read the uid-to-name mappings from file.
with open(file=path_uid_to_name, mode='r') as file:
path = os.path.join(data_dir, path_uid_to_name)
with open(file=path, mode='r') as file:
# Read all lines from the file.
lines = file.readlines()

Expand All @@ -163,7 +164,8 @@ def __init__(self):
self._uid_to_name[uid] = name

# Read the uid-to-cls mappings from file.
with open(file=path_uid_to_cls, mode='r') as file:
path = os.path.join(data_dir, path_uid_to_cls)
with open(file=path, mode='r') as file:
# Read all lines from the file.
lines = file.readlines()

Expand Down Expand Up @@ -270,7 +272,8 @@ def __init__(self):
# platforms. In this case it is saved as a binary file.

# Open the graph-def file for binary reading.
with tf.gfile.FastGFile(path_graph_def, 'rb') as file:
path = os.path.join(data_dir, path_graph_def)
with tf.gfile.FastGFile(path, 'rb') as file:
# The graph-def is a saved copy of a TensorFlow graph.
# First we need to create an empty graph-def.
graph_def = tf.GraphDef()
Expand Down

0 comments on commit 1a2aa6e

Please sign in to comment.