zmevennotification object detection on edge tpu

Discussion topics related to mobile applications and ZoneMinder Event Server (including machine learning)
Magic919
Posts: 1381
Joined: Wed Sep 18, 2013 6:56 am

Re: zmevennotification object detection on edge tpu

Post by Magic919 »

Now it’s getting dark earlier I find the TPU results are pretty hilarious in the dark. It recognised a rock as a person. I went back to CPU.
-
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: zmevennotification object detection on edge tpu

Post by asker »

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
Not yet, but the plumbing is already in place.
The new version of pyzm allows you to:
a) chain models and fallback to different ones
b) Analyze arbitrary frames
c) Select based on multiple criteria (example within a given pattern, match the most objects, or most unique objects etc)

https://github.com/pliablepixels/pyzm/b ... /stream.py

If you are comfortable experimenting in python, you can code this out yourself as well using pyzm.

What is done so far: the hard part - the chaining/streaming/filtering/detection (80% of the work)
What is left: integrating with zm_detect and mlapi (20% of the work)

Of course, the 20% I'm not finding time for
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
fennec
Posts: 59
Joined: Thu Mar 20, 2014 1:17 am

Re: zmevennotification object detection on edge tpu

Post by fennec »

ok thanks little experience on python

i see that

thanks
fennec
Posts: 59
Joined: Thu Mar 20, 2014 1:17 am

Re: zmevennotification object detection on edge tpu

Post by fennec »

do you try another models ?

https://coral.ai/models/

all model works in Input size: 224x224

but no resize for height |---------- TPU (input image: 224w*125h) ----------|

Normal ?
VicThor
Posts: 39
Joined: Tue Oct 13, 2020 8:47 pm

Re: zmevennotification object detection on edge tpu

Post by VicThor »

https://coral.ai/news/updates-11-2020/

Has anyone tried MobileDet SSD ?
How does it compare to yolo ?
VicThor
Posts: 39
Joined: Tue Oct 13, 2020 8:47 pm

Re: zmevennotification object detection on edge tpu

Post by VicThor »

I guess I can answer my own question :)
The new library will break zmeventnotification as it removes python3-edgetpu

sudo apt-get install python3-pycoral
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libedgetpu1-std python3-tflite-runtime
The following packages will be REMOVED:
python3-edgetpu
The following NEW packages will be installed:
python3-pycoral python3-tflite-runtime
The following packages will be upgraded:
libedgetpu1-std

Which will break zmdetect:

/zm_detect.py[1931]: FAT [zmesdetect_m3] [Unrecoverable error:No module named 'edgetpu' Traceback:Traceback (most recent call last):#012 File "/var/lib/zmeventnotification/bin/zm_detect.py", line 849, in <module>#012 main_handler()#012 File "/var/lib/zmeventnotification/bin/zm_detect.py", line 321, in main_handler#012 m = object_detection.Object(logger=g.logger, options=g.config)#012 File "/usr/local/lib/python3.8/dist-packages/pyzm/ml/object.py", line 30, in __init__#012 import pyzm.ml.coral_edgetpu as tpu#012 File "/usr/local/lib/python3.8/dist-packages/pyzm/ml/coral_edgetpu.py", line 14, in <module>#012 from edgetpu.detection.engine import DetectionEngine#012ModuleNotFoundError: No module named 'edgetpu'#012]
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: zmevennotification object detection on edge tpu

Post by asker »

You seem to be using an old version. The new stable versions use the new libraries.
And I just switched to the new model - It seems to be faster, but not sure it is any better
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 give it a go.
VicThor
Posts: 39
Joined: Tue Oct 13, 2020 8:47 pm

Re: zmevennotification object detection on edge tpu

Post by VicThor »

It seems to work much better than previous library and models.
However it creates way too many polygons for the same object.
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: Thu Jan 07, 2021 11:55 pm It seems to work much better than previous library and models.
However it creates way too many polygons for the same object.
Can you post an example? I'm not seeing that issue of multiple polygons compared to the old model.
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 »

Here is an example where not only wrongly detected but it's all over the place :D

https://i.postimg.cc/52zNv5vT/4-227763-0.jpg
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: zmevennotification object detection on edge tpu

Post by asker »

Can you link to the original image without the boxes so I can test?
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.

Here is the original:
https://i.postimg.cc/s266rLDZ/4-227763-101.jpg
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: zmevennotification object detection on edge tpu

Post by asker »

This is an interesting one. You're right, the new model goes all over the place. Interestingly when I first ran it, it came out perfectly as a dog, but then I realized I had my config as:

a) First run TPU at 0.6 confidence
b) Then run YoloV4 at 0.3 confidence

So this filtered out all the boxes in your image.

I've realized, in my case, if I keep TPU threshold to 0.6, I do away with most of the useless things and I fallback to Yolov4 if TPU fails.
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, that's really good. I will have to modify my objectconfig accordingly to the new way.
Is it possible you can put your config here? Or the important bits :)
Post Reply