Running the notebook in google colab produces an error when processing the visualization of the test predictions:
/usr/local/lib/python3.7/dist-packages/object_detection/utils/visualization_utils.py in
visualize_boxes_and_labels_on_image_array(image, boxes, classes, scores, category_index, instance_masks, instance_boundaries, keypoints, keypoint_scores, keypoint_edges, track_ids, use_normalized_coordinates, max_boxes_to_draw, min_score_thresh, agnostic_mode, line_thickness, mask_alpha, groundtruth_box_visualization_color, skip_boxes, skip_scores, skip_labels, skip_track_ids)
1187 if max_boxes_to_draw == len(box_to_color_map):
1188 break
-> 1189 if scores is None or scores[i] > min_score_thresh:
1190 box = tuple(boxes[i].tolist())
1191 if instance_masks is not None:
IndexError: invalid index to scalar variable.
This appears to be because the assignment of output tensors is incorrect in the detect function:
boxes = interpreter.get_tensor(output_details[0]['index'])classes = interpreter.get_tensor(output_details[1]['index'])scores = interpreter.get_tensor(output_details[2]['index'])
this is the output of interpreter.get_output_details():
Prerequisites
Please answer the following question for yourself before submitting an issue.
1. The entire URL of the documentation with the issue
https://github.com/tensorflow/models/blob/master/research/object_detection/colab_tutorials/eager_few_shot_od_training_tflite.ipynb
2. Describe the issue
Running the notebook in google colab produces an error when processing the visualization of the test predictions:
This appears to be because the assignment of output tensors is incorrect in the detect function:
boxes = interpreter.get_tensor(output_details[0]['index'])
classes = interpreter.get_tensor(output_details[1]['index'])
scores = interpreter.get_tensor(output_details[2]['index'])
this is the output of interpreter.get_output_details():
re-assigning the output tensors produces the expected result:
though, I admit, I'm not sure this is the most complete way to solve this issue and whether the order of the output tensors is stable