Replies: 23 comments 83 replies
-
While working on the code I noticed that the code might not be doing letterboxing to the image that is sent for inference. It might help to implement it to increase the accuracy. |
Beta Was this translation helpful? Give feedback.
-
Hi. I am using yolov8 with openvino and would be very happy testing yolov8 on my Coral. |
Beta Was this translation helpful? Give feedback.
-
Please find it here: https://github.com/lkaino/frigate/tree/edgetpu_yolo_support. It is based on Here are the models: Configure them into use like this:
|
Beta Was this translation helpful? Give feedback.
-
Here are yolov5s and yolov5n models if you want to test those: |
Beta Was this translation helpful? Give feedback.
-
Hi. This is just amazing, i am running yolov8n on latest dev with your changes. It is still slower than on intel igpu with openvino but most important is it lowered my cpu usage almost 5% and server power usage about 15W. I will wait one day to check for false positives and detection rate. Any chances you export an 288x288 yolov8n? Thanks for your work. |
Beta Was this translation helpful? Give feedback.
-
@lkaino are the NMS/IoU steps necessary? Frigate has its own version of these processes after calling detect_raw I believe, so you are doubling up are you not? |
Beta Was this translation helpful? Give feedback.
-
The shared memory for the detector is initialized to hold 20 detections. Without the NMS this limit might be filled. Of course it would be easy to allocate more slots in the SHM. Nevertheless I implemented it without the NMS here: https://github.com/lkaino/frigate/tree/edgetpu_yolo_support (it is now based on master). There is a variable that can be used to toggle the NMS on/off: https://github.com/lkaino/frigate/blob/8a5f52d70bf758c4cd8b9512f53b99163f7c9e6f/frigate/detectors/plugins/edgetpu_tfl.py#L20C13-L20C13. There is also an info print here if your detection boxes are going over the 20 limit: https://github.com/lkaino/frigate/blob/8a5f52d70bf758c4cd8b9512f53b99163f7c9e6f/frigate/detectors/plugins/edgetpu_tfl.py#L389. There is no big difference in execution time to using the NMS or not. I measured the NMS taking 2-3ms, where as without it it takes 1-2 ms. |
Beta Was this translation helpful? Give feedback.
-
@lkaino thanks for the reply. i would be interested to test these models on your changes: These guys have apparently been able to map yolov8 and v5 fully 100% to the edgetpu (no operations on CPU) but the output tensor is not the same as native yolov8 so it would require some code modifications to work with your changes. Here is a post on the ultralytics page that announced it: |
Beta Was this translation helpful? Give feedback.
-
What is the maximum capacity for Coral Edge TPU, YoloV8n? |
Beta Was this translation helpful? Give feedback.
-
@lkaino first of all, thank you for your contribution. In my situation "default" Frigate models are not working reliably so it would be great to have YOLO as an alternative. What surprises me is that (judging by lack of tracking) this effort is apparently not interesting for @NickM-27 or @blakeblackshear (thank you for your great work guys). It would be great if you guys could provide any feedback on this. Any hopes that we get YOLO support in Frigate? Even with problems described below YOLO managed to detect some objects/situation that were non-detectable by the default model, so it's a real improvement. That saying, @lkaino have you progressed with this any further? Having YOLO would be great. I'm using your code (with yolov8s on an edge TPU - I simply patch-mounted your edgetpu_tfl.py to v12.0.1 image), but I'm new to the whole Frigate/image-recognition/models so some things are not clear for me:
2024-01-06 12:17:44.352886141 [2024-01-06 12:17:44] frigate.detectors.plugins.edgetpu_tfl INFO : Got exception from NMS (will fall-back to non-NMS): Traceback (most recent call last): NOTE: the last line size and shape messages happens for different values of these parameters: 2024-01-06 12:17:44.352912271 ValueError: cannot reshape array of size 252 into shape (83,0) NOTE2: NMS doesn't fail always (output from my catch-call): 2024-01-06 12:53:26.068832070 [2024-01-06 12:53:26] frigate.detectors.plugins.edgetpu_tfl INFO : NMS worked ok catch-all block:
|
Beta Was this translation helpful? Give feedback.
-
I am a very happy Frigate user. My setup is made of two Axis surveillance cameras pointing to an area with several trees and a lot of moving shadows. I am essentially detecting persons. |
Beta Was this translation helpful? Give feedback.
-
Since I see some tracking here :), as a follow-up to my messages above, I just want to let you know that I found a quick and dirty way (no experience with CV nor Python so far) that works for me with a great success in recognition quality. What I discovered is that @lkaino 's code doesn't support object type filters from configuration hence have the tendency to hit the recognition count limit. Because I need to discover only persons/people I simply:
Here's a patch against Ikaino's code to showcase this dirty attempt (still containing some debug logs)
|
Beta Was this translation helpful? Give feedback.
-
Can you let us test yolov8s_full_integer_quant_edgetpu.tflite ? |
Beta Was this translation helpful? Give feedback.
-
I'm AFK now. Since this has tracking, in 1-2 days I will provide output from my tests - graphs showcasing that in my case yolov8s turned out to be way better than other two models I tested (EfficientDet-Lite3 and SSD MobileNet V2 from https://coral.ai/models/object-detection/) - person detections rate faaaar better with inference times way better than EfficientDet-Lite3 and worse than SSD MobileNet V2. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
I've been working on AMD/ROCm GPU with yolov8 but I also have a coral. So I added support for it into my frigate branch: harakas@80ae30e Slightly based on what @lkaino did but mostly just condensed/minimal. It uses some utilities I wrote for yolov8 postprocessing. |
Beta Was this translation helpful? Give feedback.
-
What the difference between yolov8n-oiv7_320x320_edgetpu.tflite and yolov8n_320x320_edgetpu.tflite |
Beta Was this translation helpful? Give feedback.
-
@harakas, |
Beta Was this translation helpful? Give feedback.
-
I try your script (I only want to export n model for Coral on 288*288). => ERROR [process 6/7] RUN python3 build_edgetpu.py 12.1s
|
Beta Was this translation helpful? Give feedback.
-
can anyone provide docs on how to run the model please? |
Beta Was this translation helpful? Give feedback.
-
You should also remove your public fork as you are likely in violation as well. |
Beta Was this translation helpful? Give feedback.
-
I want to add my custom trained yolov8 model and I converted successfully it in .tflite format but now I can't configure it in the frigate config.yml file it shows error when give model_path: ....... How can I solve it ?anyone? |
Beta Was this translation helpful? Give feedback.
-
I modified the code support the other Google Coral ready made models + yolov8.
Unfortunately the compilation of yolov8 for edgetpu couldn't convert all the operations:
yolov8s inference speed on my machine is showing 150 ms, so it is slower than the default edgetpu model.
Here's an image from the default model:
And here's one from the yolov8s (320x320):
Time will show if it helps with false positives.
I can make it into a PR if others are interested in testing it out. Maybe someone can better optimize the yolo model to run on edgetpu.
Beta Was this translation helpful? Give feedback.
All reactions