From 88df50f98e0f4d105071bd46845ea30e031a1558 Mon Sep 17 00:00:00 2001 From: haziyevv Date: Wed, 30 Jun 2021 15:33:41 +0400 Subject: [PATCH] Fixed the compatibility problems caused by tensorflow version. Just replaced **tensorflow** imports with **tensorflow.compat.v1** and **tf.disable_v2_behavior** thats all. --- api/object_counting_api.py | 4 +++- real_time_counting_targeted_object.py | 3 ++- utils/backbone.py | 4 +++- utils/label_map_util.py | 4 +++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/api/object_counting_api.py b/api/object_counting_api.py index 51a6e85..43c6195 100755 --- a/api/object_counting_api.py +++ b/api/object_counting_api.py @@ -4,7 +4,9 @@ #--- Date : 27th January 2018 #---------------------------------------------- -import tensorflow as tf +import tensorflow.compat.v1 as tf +tf.disable_v2_behavior() + import csv import cv2 import numpy as np diff --git a/real_time_counting_targeted_object.py b/real_time_counting_targeted_object.py index f475b0c..80eb414 100755 --- a/real_time_counting_targeted_object.py +++ b/real_time_counting_targeted_object.py @@ -5,7 +5,8 @@ #---------------------------------------------- # Imports -import tensorflow as tf +import tensorflow.compat.v1 as tf +tf.disable_v2_behavior() # Object detection imports from utils import backbone diff --git a/utils/backbone.py b/utils/backbone.py index 2ab0089..be77b09 100755 --- a/utils/backbone.py +++ b/utils/backbone.py @@ -1,5 +1,7 @@ import glob, os, tarfile, urllib -import tensorflow as tf +import tensorflow.compat.v1 as tf +tf.disable_v2_behavior() + from utils import label_map_util def set_model(model_name, label_name): diff --git a/utils/label_map_util.py b/utils/label_map_util.py index 709c86a..0d24f38 100755 --- a/utils/label_map_util.py +++ b/utils/label_map_util.py @@ -17,7 +17,9 @@ import logging -import tensorflow as tf +import tensorflow.compat.v1 as tf +tf.disable_v2_behavior() + from google.protobuf import text_format from protos import string_int_label_map_pb2