zmevennotification object detection on edge tpu

Forum for questions and support relating to the 1.34.x releases only.
Magic919
Posts: 349
Joined: Wed Sep 18, 2013 6:56 am

Re: zmevennotification object detection on edge tpu

Post by Magic919 » Sat Nov 21, 2020 11:33 am

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: 1448
Joined: Sun Mar 01, 2015 12:12 pm

Re: zmevennotification object detection on edge tpu

Post by asker » Sat Nov 21, 2020 4:10 pm

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
Please don't ask me questions via PM. Feel free to post in the forums or Github

My collection of ZoneMinder learnings:
https://wiki.zoneminder.com/Various_ZM_thoughts

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

Re: zmevennotification object detection on edge tpu

Post by fennec » Sat Nov 21, 2020 7:19 pm

ok thanks little experience on python

i see that

thanks

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

Re: zmevennotification object detection on edge tpu

Post by fennec » Sat Nov 28, 2020 12:16 pm

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: 17
Joined: Tue Oct 13, 2020 8:47 pm

Re: zmevennotification object detection on edge tpu

Post by VicThor » Tue Jan 05, 2021 8:46 pm

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

Has anyone tried MobileDet SSD ?
How does it compare to yolo ?

VicThor
Posts: 17
Joined: Tue Oct 13, 2020 8:47 pm

Re: zmevennotification object detection on edge tpu

Post by VicThor » Wed Jan 06, 2021 1:42 am

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: 1448
Joined: Sun Mar 01, 2015 12:12 pm

Re: zmevennotification object detection on edge tpu

Post by asker » Wed Jan 06, 2021 2:19 am

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
Please don't ask me questions via PM. Feel free to post in the forums or Github

My collection of ZoneMinder learnings:
https://wiki.zoneminder.com/Various_ZM_thoughts

VicThor
Posts: 17
Joined: Tue Oct 13, 2020 8:47 pm

Re: zmevennotification object detection on edge tpu

Post by VicThor » Wed Jan 06, 2021 8:24 pm

Thanks asker, will give it a go.

VicThor
Posts: 17
Joined: Tue Oct 13, 2020 8:47 pm

Re: zmevennotification object detection on edge tpu

Post by VicThor » 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.

User avatar
asker
Posts: 1448
Joined: Sun Mar 01, 2015 12:12 pm

Re: zmevennotification object detection on edge tpu

Post by asker » Sat Jan 09, 2021 12:00 pm

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.
Please don't ask me questions via PM. Feel free to post in the forums or Github

My collection of ZoneMinder learnings:
https://wiki.zoneminder.com/Various_ZM_thoughts

VicThor
Posts: 17
Joined: Tue Oct 13, 2020 8:47 pm

Re: zmevennotification object detection on edge tpu

Post by VicThor » Sat Jan 09, 2021 7:46 pm

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: 1448
Joined: Sun Mar 01, 2015 12:12 pm

Re: zmevennotification object detection on edge tpu

Post by asker » Sat Jan 09, 2021 10:04 pm

Can you link to the original image without the boxes so I can test?
Please don't ask me questions via PM. Feel free to post in the forums or Github

My collection of ZoneMinder learnings:
https://wiki.zoneminder.com/Various_ZM_thoughts

VicThor
Posts: 17
Joined: Tue Oct 13, 2020 8:47 pm

Re: zmevennotification object detection on edge tpu

Post by VicThor » Sat Jan 09, 2021 10:44 pm

Thanks asker.

Here is the original:
https://i.postimg.cc/s266rLDZ/4-227763-101.jpg

User avatar
asker
Posts: 1448
Joined: Sun Mar 01, 2015 12:12 pm

Re: zmevennotification object detection on edge tpu

Post by asker » Sun Jan 10, 2021 12:32 am

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.
Please don't ask me questions via PM. Feel free to post in the forums or Github

My collection of ZoneMinder learnings:
https://wiki.zoneminder.com/Various_ZM_thoughts

VicThor
Posts: 17
Joined: Tue Oct 13, 2020 8:47 pm

Re: zmevennotification object detection on edge tpu

Post by VicThor » Sun Jan 10, 2021 3:01 am

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

Who is online

Users browsing this forum: Magic919, suknil and 7 guests