Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion utils/label_map_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def load_labelmap(path):
Returns:
a StringIntLabelMapProto
"""
with tf.gfile.GFile(path, 'r') as fid:
with tf.compat.v2.io.gfile.GFile(path, 'r') as fid:
label_map_string = fid.read()
label_map = string_int_label_map_pb2.StringIntLabelMap()
try:
Expand Down
6 changes: 3 additions & 3 deletions vehicle_detection_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@
# Load a (frozen) Tensorflow model into memory.
detection_graph = tf.Graph()
with detection_graph.as_default():
od_graph_def = tf.GraphDef()
with tf.gfile.GFile(PATH_TO_CKPT, 'rb') as fid:
od_graph_def = tf.compat.v1.GraphDef()
with tf.compat.v2.io.gfile.GFile(PATH_TO_CKPT, 'rb') as fid:
serialized_graph = fid.read()
od_graph_def.ParseFromString(serialized_graph)
tf.import_graph_def(od_graph_def, name='')
Expand Down Expand Up @@ -95,7 +95,7 @@ def object_detection_function():
size = 'waiting...'
color = 'waiting...'
with detection_graph.as_default():
with tf.Session(graph=detection_graph) as sess:
with tf.compat.v1.Session(graph=detection_graph) as sess:

# Definite input and output Tensors for detection_graph
image_tensor = detection_graph.get_tensor_by_name('image_tensor:0')
Expand Down