zoneminder
zoneminder copied to clipboard
Integrate OpenCV's image detection into zm_monitor.cpp as an alternate option
OpenCV offers some "reasonable" methods to detect people. They are not as accurate as CNNs and use HOGs but are of orders of magnitude faster. The code is straight forward, for example, this. OpenCV code is very portable, and in C++, and therefore integration into ZM is not hard. (I don't feel like investigating - someone who knows zm_monitor.cpp and how ZM handles image buffers should be able to do it much faster than me)
There are multiple profiles to choose from (different XML files)
The request: a) Integrate OpenCV with ZM b) Select "Person Detection" as a scheme as a detection algorithm as an alternate to "Pixels/Filter/Blob" and basically replicate the functionality provided in the link above. c) Ability to specify a "frame interval" -> which will basically decide how often this logic will be used. In other words, even if I select the monitor FPS as say 5, I should be able to select "2" here, which will mean detection to be applied on the 1st, 3rd, 5th frames - for more speed control without affecting live fps d) Draw a bounding box around the person detected in frame (Again, already part of the sample code)
3rd party work a) This company did some early work here in 2011, if it helps. Licensed under GPL.
Future Enhancement Not a necessary condition for the bounty: a) Ability to make item b) above in request section more flexible. Let me select any XML profile in OpenCV so I can tweak my model.
I'll be putting in a $100 bounty for this.
So I have merge the CVisionLabs work into my opencv branch. However the plugin code is for an ancient version of opencv.... so I think I'll be updating that to version 3.
do you have a branch I can track/test?
my opencv branch
Since version 3.4.2 of OpenCV, it looks like it now supports the YOLOv3 DNN detector as well. Below link has some C++ and python examples. https://www.learnopencv.com/deep-learning-based-object-detection-using-yolov3-with-opencv-python-c/
I'm going to revise some of the asks based on integrating both OpenCV approaches in the ZM event notification server:
I originally said:
b) Select "Person Detection" as a scheme as a detection algorithm as an alternate to "Pixels/Filter/Blob" and basically replicate the functionality provided in the link above. c) Ability to specify a "frame interval" -> which will basically decide how often this logic will be used. In other words, even if I select the monitor FPS as say 5, I should be able to select "2" here, which will mean detection to be applied on the 1st, 3rd, 5th frames - for more speed control without affecting live fps
Based on my experience actually trying to get it working:
- Many (if not most) users of ZM are not running a GPU
- OpenCV SVM HOG is very fast but not quite accurate. It keeps identifying my water heater as a "person" (On an Intel Xeon 3.16GHz 4Core machine with no GPU HOG takes 0.25s)
- OpenCV DNN with Yolov3 (80 labels) but with Tiny-Yolo weight/config is much more accurate and takes almost the same time as HOG (On an Intel Xeon 3.16GHz 4Core machine with no GPU this takes 0.34s)
- OpenCV DNN with Yolov3 (80 labels) and yolov3 config /weight files is most accurate but without a GPU takes 10x the time as HOG (On an Intel Xeon 3.16GHz 4Core machine with no GPU YoloV3 takes 2.4s)
To make this practically useful, I'd like to suggest that "Person detection" is implemented as 2 options:
a) As a replacement for "motion" - that way people don't have to worry about defining zones and configuring its accuracy b) As a "after motion" analysis so that people can configure some basic but very lenient motion system and only trigger person detect if motion occurred first
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.
anyone know if these if going to do ?
I started on it... but there is lots more to do.
There is also some work done in this project for face recognition https://github.com/goruck/smart-zoneminder by goruck
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.
Is this still in progress?
bountysource will take this money on July 1st. Either contact bountysource to redirect your funds, or alternatively, I can close this out, collect the bounty, and I will hold the money until this issue is properly closed.
I’d prefer you just collect for the money I added.
@connortechnology Is implementing OpenCV into Zoneminder still on the list of things to do?
Yes
@connortechnology Hi is this still open please?
Yes it's still open. I'm not sure it's a good idea, as I think AI should be happening in it's own process.