Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ozett opened this issue Jan 30, 2022 · 13 comments
Closed

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

ozett opened this issue Jan 30, 2022 · 13 comments

Comments

@ozett
Copy link

ozett commented Jan 30, 2022

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:

ultralytics/yolov5#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
Copy link
Author

ozett commented Feb 1, 2022

i did it ...

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

image

@ozett
Copy link
Author

ozett commented Feb 1, 2022

i missed a step?

image

@ozett
Copy link
Author

ozett commented Feb 1, 2022

convertion was fast as hell...

image

@ozett
Copy link
Author

ozett commented Feb 1, 2022

same error...

image

@ozett
Copy link
Author

ozett commented Feb 1, 2022

another try in colab..

image

@ozett
Copy link
Author

ozett commented Feb 1, 2022

something is missing...

image

@ozett
Copy link
Author

ozett commented Feb 1, 2022

@mr6880
Copy link

mr6880 commented Feb 2, 2022

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
Copy link

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
Copy link
Author

ozett commented Feb 3, 2022

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...

frigate/frigate/edgetpu.py

Lines 102 to 111 in a2d1bd2

def detect_raw(self, tensor_input):
self.interpreter.set_tensor(self.tensor_input_details[0]["index"], tensor_input)
self.interpreter.invoke()
boxes = self.interpreter.tensor(self.tensor_output_details[0]["index"])()[0]
class_ids = self.interpreter.tensor(self.tensor_output_details[1]["index"])()[0]
scores = self.interpreter.tensor(self.tensor_output_details[2]["index"])()[0]
count = int(
self.interpreter.tensor(self.tensor_output_details[3]["index"])()[0]
)

edit: seems a well known problem: google-coral/edgetpu#272 (comment)

@ozett
Copy link
Author

ozett commented Feb 3, 2022

google-coral/edgetpu#272

@ozett
Copy link
Author

ozett commented Feb 3, 2022

😱

Thanks. My colleague run YOLOv5 v4 320x320 on EdgeTPU for 24 hours yesterday without errors.
google-coral/edgetpu#272 (comment)

edit: but as June 2021 still unsolved issue.. -> google-coral/edgetpu#272 (comment)

@stale
Copy link

stale bot commented Mar 6, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants