Open tonyprince6 opened 4 years ago
my tensorflow- gpu:1.13.1 cuda:10.0 cudnn:7.3.1
I too got this error, I had updated tensorflow to latest version but still the print(tf.__version__)
shows 1.13.1)
I solved this error, I had installed tensorflow
inconda
environement.Just went inside and conda install tensorflow=2.0.0
and then just re run the notebook.
thanks for your replay. I konw the reason,this example notebook must need TensorFlow2.x.x!
I solved this error, I had installed
tensorflow
inconda
environement.Just went inside andconda install tensorflow=2.0.0
and then just re run the notebook.
hi what is your cuda and cudnn version
Despite Readme specifically says TensorFlow version 1.15 is required and version 2 is not supported, object_detection_tutorial.ipynb uses Tensorflow 2
And on installation.md it says required version of Tensorflow is 1.15
I quote:
Dependencies
Tensorflow Object Detection API depends on the following libraries:
- Protobuf 3.0.0
- Python-tk
- Pillow 1.0
- lxml
- tf Slim (which is included in the "tensorflow/models/research/" checkout)
- Jupyter notebook
- Matplotlib
- Tensorflow (1.15.0)
- Cython
- contextlib2
- cocoapi
But Object Detection Tutorial installs Tensorflow 2 with
pip install -U --pre tensorflow=="2.*"
You need to change load model function from:
model = tf.saved_model.load(str(model_dir))
to
model = tf.saved_model.load_v2(str(model_dir))
or
model = tf.compat.v2.saved_model.load(str(model_dir))
which works for both Tensorflow 1 and 2
Without running session we can't get numeric results on Tensorflow 1, so you will see this error:
int() argument must be a string, a bytes-like object or a number, not 'Tensor'
on line:
num_detections = int(output_dict.pop('num_detections'))
Since this line expects a numeric value you need to enable eager execution just after imports with
tf.compat.v1.enable_eager_execution()
There is a version conflict between Object Detection Readme and Object Detection Tutorial
Despite Readme specifically says TensorFlow version 1.15 is required and version 2 is not supported, object_detection_tutorial.ipynb uses Tensorflow 2
And on installation.md it says required version of Tensorflow is 1.15
I quote:
Dependencies
Tensorflow Object Detection API depends on the following libraries:
- Protobuf 3.0.0
- Python-tk
- Pillow 1.0
- lxml
- tf Slim (which is included in the "tensorflow/models/research/" checkout)
- Jupyter notebook
- Matplotlib
- Tensorflow (1.15.0)
- Cython
- contextlib2
- cocoapi
But Object Detection Tutorial installs Tensorflow 2 with
pip install -U --pre tensorflow=="2.*"
For Tutorial to work with Tensorflow Version 1.15
You need to change load model function from:
model = tf.saved_model.load(str(model_dir))
tomodel = tf.saved_model.load_v2(str(model_dir))
ormodel = tf.compat.v2.saved_model.load(str(model_dir))
which works for both Tensorflow 1 and 2Eager Execution
Without running session we can't get numeric results on Tensorflow 1, so you will see this error:
int() argument must be a string, a bytes-like object or a number, not 'Tensor'
on line:
num_detections = int(output_dict.pop('num_detections'))
Since this line expects a numeric value you need to enable eager execution just after imports with
tf.compat.v1.enable_eager_execution()
I tried your solution,but it says: INFO:tensorflow:Saver not created because there are no variables in the graph to restore
@ZOUYIyi detection should work despite the info message, it's probably about saving the session while training
You can check this version of tutorial
For tensorflow 1.15, load and model inference try this
import tensorflow as tf
from tensorflow.python.saved_model import tag_constants
model = tf.saved_model.load_v2(
model_path, tags=[tag_constants.SERVING]
)
For tensorflow 2.3, load and model inference try this
import tensorflow as tf
from tensorflow.python.saved_model import tag_constants
model = tf.saved_model.load(input_saved_model_dir, tags=[tag_constants.SERVING])
)
There is a version conflict between Object Detection Readme and Object Detection Tutorial
Despite Readme specifically says TensorFlow version 1.15 is required and version 2 is not supported, object_detection_tutorial.ipynb uses Tensorflow 2 And on installation.md it says required version of Tensorflow is 1.15 I quote:
Dependencies
Tensorflow Object Detection API depends on the following libraries:
- Protobuf 3.0.0
- Python-tk
- Pillow 1.0
- lxml
- tf Slim (which is included in the "tensorflow/models/research/" checkout)
- Jupyter notebook
- Matplotlib
- Tensorflow (1.15.0)
- Cython
- contextlib2
- cocoapi
But Object Detection Tutorial installs Tensorflow 2 with
pip install -U --pre tensorflow=="2.*"
For Tutorial to work with Tensorflow Version 1.15
You need to change load model function from:
model = tf.saved_model.load(str(model_dir))
tomodel = tf.saved_model.load_v2(str(model_dir))
ormodel = tf.compat.v2.saved_model.load(str(model_dir))
which works for both Tensorflow 1 and 2Eager Execution
Without running session we can't get numeric results on Tensorflow 1, so you will see this error:
int() argument must be a string, a bytes-like object or a number, not 'Tensor'
on line:
num_detections = int(output_dict.pop('num_detections'))
Since this line expects a numeric value you need to enable eager execution just after imports withtf.compat.v1.enable_eager_execution()
I tried your solution,but it says: INFO:tensorflow:Saver not created because there are no variables in the graph to restore
just a information, it doesn't matter for the detection later, as @irfan798 mentioned.
when i run :: model_name = 'ssd_mobilenet_v1_coco_2017_11_17' detection_model = load_model(model_name)
amazing thing happens!(and i do not knew how to deal with it..):
WARNING:tensorflow:From:11: load (from tensorflow.python.saved_model.loader_impl) is deprecated and will be removed in a future version.
Instructions for updating:
This function will only be available through the v1 compatibility library as tf.compat.v1.saved_model.loader.load or tf.compat.v1.saved_model.load. There will be a new function for importing SavedModels in Tensorflow 2.0.
TypeError Traceback (most recent call last)