blakeblackshear / frigate

NVR with realtime local object detection for IP cameras
https://frigate.video
MIT License
18k stars 1.64k forks source link

[Support]: Yolov5 as TFLITE model works? #2726

Closed ozett closed 2 years ago

ozett commented 2 years ago

Describe the problem you are having

i am wondering if anybody had tried to convert yolov5 to tflite and got it running with frigate. any experience with this and is it worth a try?

Version

DEBUG 0.10.0-B912851

here is how this could be done:

https://github.com/ultralytics/yolov5/issues/4586

Install method

Docker CLI

Coral version

M.2

Network connection

Wired

Camera make and model

all hikvision

Any other information that may be helpful

-

ozett commented 2 years ago

i did it ...

python3 export.py --weights yolov5s.pt --include tflite

image

ozett commented 2 years ago

i missed a step?

image

ozett commented 2 years ago

convertion was fast as hell...

image

ozett commented 2 years ago

same error...

image

ozett commented 2 years ago

another try in colab..

image

ozett commented 2 years ago

something is missing...

image

ozett commented 2 years ago

?? https://github.com/google-coral/edgetpu/issues/419#issuecomment-889878751

mr6880 commented 2 years ago

Same issue here when I tried it a few days ago

Process detector:coral_pci: Traceback (most recent call last): File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap self.run() File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run self._target(*self._args, self._kwargs) File "/opt/frigate/frigate/edgetpu.py", line 180, in run_detector detections = object_detector.detect_raw(input_frame) File "/opt/frigate/frigate/edgetpu.py", line 110, in detect_raw self.interpreter.tensor(self.tensor_output_details[3]["index"])()[0] IndexError: list index out of range Process detector:coral_pci3: Traceback (most recent call last): File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap self.run() File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run self._target(*self._args, *self._kwargs) File "/opt/frigate/frigate/edgetpu.py", line 180, in run_detector detections = object_detector.detect_raw(input_frame) File "/opt/frigate/frigate/edgetpu.py", line 110, in detect_raw self.interpreter.tensor(self.tensor_output_details[3]["index"])()[0] IndexError: list index out of range Process detector:coral_pci2: Traceback (most recent call last): File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap self.run() File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run self._target(self._args, self._kwargs) File "/opt/frigate/frigate/edgetpu.py", line 180, in run_detector detections = object_detector.detect_raw(input_frame) File "/opt/frigate/frigate/edgetpu.py", line 110, in detect_raw self.interpreter.tensor(self.tensor_output_details[3]["index"])()[0] IndexError: list index out of range

rogerquake commented 2 years ago

Haven't tried yet, but curious how the results were after importing into Frigate? If it worked good, it would be amazing to get it uploaded so we didn't have to compile it!

ozett commented 2 years ago

happens at the point where the model is loaded, i guess looks like the converted model has different parameters than the usual edgetpu-models from google...

https://github.com/blakeblackshear/frigate/blob/a2d1bd2c6711015f2735b7f508b59cfec397b0f7/frigate/edgetpu.py#L102-L111

edit: seems a well known problem: https://github.com/google-coral/edgetpu/issues/272#issuecomment-822049646

ozett commented 2 years ago

https://github.com/google-coral/edgetpu/issues/272

ozett commented 2 years ago

😱

Thanks. My colleague run YOLOv5 v4 320x320 on EdgeTPU for 24 hours yesterday without errors. https://github.com/google-coral/edgetpu/issues/272#issuecomment-765042662

edit: but as June 2021 still unsolved issue.. -> https://github.com/google-coral/edgetpu/issues/272#issuecomment-865780130

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.