StefansAI / Yolov8_Rpi5_CoralUSB

Install and Test of Yolov8 on Raspberry Pi5 with USB Coral TPU
6 stars 2 forks source link

IndexError: list index out of range #1

Open tharindu326 opened 2 months ago

tharindu326 commented 2 months ago

Hi @StefansAI

I have noticed that you had the same problem with YOLOv8 edge TPU compiling. https://github.com/orgs/ultralytics/discussions/8398 When i try to use Colab to do the edge TPU model conversion and when i try to run that model on raspberry pi with pycoral library, i got the same error;

Traceback (most recent call last):
  File "/home/raspi/Desktop/Demo/camera.py", line 111, in <module>
    processor.process_video()
  File "/home/raspi/Desktop/Demo/camera.py", line 55, in process_video
    objs = self.detector.run_inference(frame)
  File "/home/raspi/Desktop/Demo/inference.py", line 23, in run_inference
    return detect.get_objects(self.interpreter, 0.4, scale)
  File "/usr/lib/python3/dist-packages/pycoral/adapters/detect.py", line 214, in get_objects
    elif common.output_tensor(interpreter, 3).size == 1:
  File "/usr/lib/python3/dist-packages/pycoral/adapters/common.py", line 29, in output_tensor
    return interpreter.tensor(interpreter.get_output_details()[i]['index'])()
IndexError: list index out of range

This is the colab notebook im using Could you please let me know how did you fix it?

Thanks

StefansAI commented 1 month ago

Hi @tharindu326, Sorry for the delay, I was traveling for the last weeks. I had similar index-errors when the versions of different packages were not matching each other. I opened your notebook link, and it installs everything exactly as in my script, so it should work. Running it in Colab, it ends up with an error "OSError: libedgetpu.so.1: cannot open shared object file: No such file or directory" at the line "interpreter = tflite.Interpreter(model_file, experimental_delegates=[tflite.load_delegate('libedgetpu.so.1', options={"device": "usb"})])". I assume, you run it on the RPi5 and the libraries are installed there. But the export was working. Do you still have the index issue? I could run your notebook on my RPi5 to test it. Let me know