From f88eb163a3a8ba179d6a826d8722a205f79562ec Mon Sep 17 00:00:00 2001 From: Aayush Garg <65889104+Aayush-hub@users.noreply.github.com> Date: Sun, 3 Jan 2021 23:24:29 +0530 Subject: [PATCH 1/2] Update vehicle_detection_main.py --- vehicle_detection_main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vehicle_detection_main.py b/vehicle_detection_main.py index ffa86ea..4cb55ad 100644 --- a/vehicle_detection_main.py +++ b/vehicle_detection_main.py @@ -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='') @@ -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') From 18acded39361f40f83ab848131a0ec00919dad79 Mon Sep 17 00:00:00 2001 From: Aayush Garg <65889104+Aayush-hub@users.noreply.github.com> Date: Sun, 3 Jan 2021 23:25:33 +0530 Subject: [PATCH 2/2] Update label_map_util.py --- utils/label_map_util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/label_map_util.py b/utils/label_map_util.py index 709c86a..c10e12d 100644 --- a/utils/label_map_util.py +++ b/utils/label_map_util.py @@ -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: