I have been trying to use the object detection api of tensorflow. After alot of trouble I have installed all the necessary modules for the same. Then when I run the "object_detection_tutorial" from the models/research/object_detection I come up with the error as in the detection section as follows:
Detection
Load an object detection model:
model_name = 'ssd_mobilenet_v1_coco_2017_11_17'
detection_model = load_model(model_name)
tensorflow:Saver not created because there are no variables in the graph to restore
print(detection_model.inputs)
tf.Tensor 'image_tensor:0' shape=(?, ?, ?, 3) dtype=uint8
And again I get the error in below line as:
for image_path in TEST_IMAGE_PATHS:
show_inference(detection_model, image_path)
error:
* in run_inference_for_single_image(model, image)
12 # Convert to numpy arrays, and take index [0] to remove the batch dimension.
13 # We're only interested in the first num_detections.
---> 14 num_detections = int(output_dict.pop('num_detections'))
15 output_dict = {key:value[0, :num_detections].numpy()
16 for key,value in output_dict.items()}
TypeError: int() argument must be a string, a bytes-like object or a number, not 'Tensor'*
Please any help why am I getting this error. I am new to tensorflow just want to run this tutorial successfully. I have installed "Tensorflow 2.2.0" and all the modules. I also did the same with Tensorflow lower version but same issue.