TannerGilbert / TFLite-Object-Detection-with-TFLite-Model-Maker

Custom object detection with the TFLite Model Maker
https://gilberttanner.com/blog/tflite-model-maker-object-detection
33 stars 14 forks source link

getting "list index out of range" error #3

Open tanmay-18 opened 1 year ago

tanmay-18 commented 1 year ago
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
[<ipython-input-5-13aae2c79e61>](https://localhost:8080/#) in <cell line: 9>()
      7 
      8 # Run inference and draw detection result on the local copy of the original file
----> 9 detection_result_image = run_odt_and_draw_results(
     10     INPUT_IMAGE_URL,
     11     interpreter,

2 frames
[<ipython-input-1-e5b13d81f88d>](https://localhost:8080/#) in get_output_tensor(interpreter, index)
     36 def get_output_tensor(interpreter, index):
     37   """Retur the output tensor at the given index."""
---> 38   output_details = interpreter.get_output_details()[index]
     39   tensor = np.squeeze(interpreter.get_tensor(output_details['index']))
     40   return tensor

IndexError: list index out of range

when i tried to print index and interpreter.get_output_details() the output was-

0
[{'name': 'Identity', 'index': 408, 'shape': array([   1,    9, 8400], dtype=int32), 'shape_signature': array([   1,    9, 8400], dtype=int32), 'dtype': <class 'numpy.float32'>, 'quantization': (0.0, 0), 'quantization_parameters': {'scales': array([], dtype=float32), 'zero_points': array([], dtype=int32), 'quantized_dimension': 0}, 'sparsity_parameters': {}}]
1
[{'name': 'Identity', 'index': 408, 'shape': array([   1,    9, 8400], dtype=int32), 'shape_signature': array([   1,    9, 8400], dtype=int32), 'dtype': <class 'numpy.float32'>, 'quantization': (0.0, 0), 'quantization_parameters': {'scales': array([], dtype=float32), 'zero_points': array([], dtype=int32), 'quantized_dimension': 0}, 'sparsity_parameters': {}}]