I am using the object_detection_tutorial.ipynb to run an inference.
After I run the inference, I got this error on the output_dict:
# Run inference
output_dict = model(input_tensor)
# All outputs are batches tensors.
# Convert to numpy arrays, and take index [0] to remove the batch dimension.
# We're only interested in the first num_detections.
num_detections = int(output_dict.pop('num_detections'))
output_dict = {key:value[0, :num_detections].numpy()
for key,value in output_dict.items()}
output_dict['num_detections'] = num_detections
Error log:
Traceback (most recent call last): File "detect.py", line 140, in show_inference(detection_model, image_path) File "detect.py", line 109, in show_inference output_dict = run_inference_for_single_image(model, image_np) File "detect.py", line 94, in run_inference_for_single_image num_detections = int(output_dict.pop('num_detections')) TypeError: int() argument must be a string, a bytes-like object or a number, not 'Tensor'