zmevennotification object detection on edge tpu

Discussion topics related to mobile applications and ZoneMinder Event Server (including machine learning)
VicThor
Posts: 39
Joined: Tue Oct 13, 2020 8:47 pm

zmevennotification object detection on edge tpu

Post by VicThor »

I have an "issue" running object detection on the TPU.

Compared to opencv, yolo4 detection which worked great, TPU detection misses object classification most of the times: dogs are persons or birds, bbqs are boats, persons rarely detected and so on whilst the accuracy(percentage) is halved when detecting.

Is there a better models file? How can I improve detection and precision on the TPU?
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: zmevennotification object detection on edge tpu

Post by asker »

1. The list of models you can use are here https://coral.ai/models/ - You are looking for the object detection section
2. In the list of published models, the SSDNet v2 model (which is currently being used) is the most accurate
3. There are other models, like YoloV4 etc. which are better but are not officially available for the Edge TPU, but google around and look for github repositories that advertise alternate models. I tried to use one, and it did not work.

Bottom line, experimentation required.
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
VicThor
Posts: 39
Joined: Tue Oct 13, 2020 8:47 pm

Re: zmevennotification object detection on edge tpu

Post by VicThor »

Thanks asker, will do the google :) see what I can find.
I guess I was expecting CPU load to go down heaps(not in reality) and to be more accurate OOB but yeah, bit disappointed.
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: zmevennotification object detection on edge tpu

Post by asker »

So CPU load _should_ go down a lot, because the complete OD is moved to the TPU. Are you not seeing that? (If you were using a GPU earlier then it doesn't apply)
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
VicThor
Posts: 39
Joined: Tue Oct 13, 2020 8:47 pm

Re: zmevennotification object detection on edge tpu

Post by VicThor »

No CPU usage seems to be the same as using YOLO4 (on CPU). Maybe YOLO is really fast on Ryzen7?
Magic919
Posts: 1381
Joined: Wed Sep 18, 2013 6:56 am

Re: zmevennotification object detection on edge tpu

Post by Magic919 »

I switched over to TPU after reading this thread. I only really want it to classify people, cars and trucks and it works. Also sees pot plants, benches and other objects, same as before. I haven’t seen any drop.

Can’t comment on CPU load as I don’t watch that sort of thing.
-
VicThor
Posts: 39
Joined: Tue Oct 13, 2020 8:47 pm

Re: zmevennotification object detection on edge tpu

Post by VicThor »

Do you find it to have the same accuracy as YOLO?
Which models are you using?
Magic919
Posts: 1381
Joined: Wed Sep 18, 2013 6:56 am

Re: zmevennotification object detection on edge tpu

Post by Magic919 »

I guess that depends how you define accuracy. It worked very well before and it does now. I want it to classify as I described before and that works. I'm no expert at this and I just want to get it working, then I leave it alone.

Mine is largely set as provided in the software. I had the TPU installed, but hadn't changed the config. I altered it, as below.

Code: Select all

object_weights={{base_data_path}}/models/coral_edgetpu/ssd_mobilenet_v2_coco_quant_postprocess_edgetpu.tflite
If there's anything I should check or set, feel free to suggest.
-
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: zmevennotification object detection on edge tpu

Post by asker »

VicThor wrote: Fri Oct 16, 2020 8:31 pm Do you find it to have the same accuracy as YOLO?
Which models are you using?
MobileNetSSDV2 is not as accurate as YoloVx when we are using full yolo weights. It is however, far more accurate than Yolo with tiny weights.
I'll echo Magic919's comment: for me, it hasn't yet missed objects I care about (cars and people).
It does misclassify objects I don't care about or produces false positives (example, it tells me a truck showed up in my deck, or tells me a person appeared at my door when there are none).

So here is what I have done to make the TPU system work well for me:

a) I've customized patterns and accuracy parameters. Example:

Code: Select all

object_detection_pattern=(person) # don't care about anything else
object_min_confidence=0.4 
max_detection_size=90%
What I noticed is mobileNet seems to incorrectly classify objects as big as the whole frame -which is obviously wrong. So I said 'if it goes beyond 90% of the frame, it's not valid'. Similarly, I bumped up min_confidence to 0.4

For my deck:

Code: Select all

object_detection_pattern=^(?!chair|table|bench|truck)
(Note the not in front)
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
Greg_Talyor
Posts: 34
Joined: Mon Aug 17, 2020 7:41 pm

Re: zmevennotification object detection on edge tpu

Post by Greg_Talyor »

Sorry for chipping in. I got a kit (Coral Edge TPU USB Accelerator), but don't know where to start. Any guidance for dummies is welcomed. Ta.
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: zmevennotification object detection on edge tpu

Post by asker »

Greg_Talyor wrote: Sat Oct 17, 2020 5:48 pm Sorry for chipping in. I got a kit (Coral Edge TPU USB Accelerator), but don't know where to start. Any guidance for dummies is welcomed. Ta.
https://coral.ai/docs/accelerator/get-started/
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
tommycw1
Posts: 3
Joined: Tue Dec 31, 2013 2:22 pm

Re: zmevennotification object detection on edge tpu

Post by tommycw1 »

Something I haven't been able to figure out is this: Does it matter which version of the board I use? It seems to come in a USB version, a PCIe version, an M2 version a and maybe others. Do all of these operate the same and do they all work with ZMES?
Magic919
Posts: 1381
Joined: Wed Sep 18, 2013 6:56 am

Re: zmevennotification object detection on edge tpu

Post by Magic919 »

I expect most of us are using the USB version. It'll be simpler from a Linux point of view, as well as physical ease of install.
-
tommycw1
Posts: 3
Joined: Tue Dec 31, 2013 2:22 pm

Re: zmevennotification object detection on edge tpu

Post by tommycw1 »

Magic919 wrote: Tue Oct 27, 2020 10:20 am I expect most of us are using the USB version. It'll be simpler from a Linux point of view, as well as physical ease of install.
Thanks @Magic919. TBH I thought the PCIe was nicer as its internal and I don't have a usb thing laying on the ground behind my PC. Its also like 1/3 the price for some reason. The price difference was what made me wonder if it wasnt' as powerful or something.
fennec
Posts: 59
Joined: Thu Mar 20, 2014 1:17 am

Re: zmevennotification object detection on edge tpu

Post by fennec »

asker wrote: Sat Oct 17, 2020 1:52 pm
VicThor wrote: Fri Oct 16, 2020 8:31 pm Do you find it to have the same accuracy as YOLO?
Which models are you using?
MobileNetSSDV2 is not as accurate as YoloVx when we are using full yolo weights. It is however, far more accurate than Yolo with tiny weights.
I'll echo Magic919's comment: for me, it hasn't yet missed objects I care about (cars and people).
It does misclassify objects I don't care about or produces false positives (example, it tells me a truck showed up in my deck, or tells me a person appeared at my door when there are none).

So here is what I have done to make the TPU system work well for me:

a) I've customized patterns and accuracy parameters. Example:

Code: Select all

object_detection_pattern=(person) # don't care about anything else
object_min_confidence=0.4 
max_detection_size=90%
What I noticed is mobileNet seems to incorrectly classify objects as big as the whole frame -which is obviously wrong. So I said 'if it goes beyond 90% of the frame, it's not valid'. Similarly, I bumped up min_confidence to 0.4

For my deck:

Code: Select all

object_detection_pattern=^(?!chair|table|bench|truck)
(Note the not in front)

Same conclusion

MobileNetSSDV2 is not as accurate as YoloVx, specialement in night mode

But TPU is very very fast

So do you think possible on mlapi to use YoloVx only after MobileNetSSDV2 if MobileNetSSDV2 return nothing or no patern filter

[objectfirst]
[objectsecond]only if first failed

Thanks
Post Reply