Breakthrough / DVR-Scan

:vhs: Tool for extracting scenes with motion from videos (e.g. security camera or DVR footage). Written in Python, uses OpenCV.
http://www.dvr-scan.com/
Other
362 stars 47 forks source link

Failed to Detect Black Bear #100

Open meen6thi opened 1 year ago

meen6thi commented 1 year ago

Hi, I just started using DVR-Scan with WansView 1080p W9 cameras to detect wildlife passing through my yard. It seems to work well with my test videos, but I just found one instance where it failed to detect a black bear with cubs.

A 10 minute sample from the original video is here:

https://drive.google.com/file/d/1grZ7XgcLxOPhZ-zNYl6D1TXYrZEcneDt/view?usp=sharing

Mama is in the frame from 07:00 - 07:44, and the cubs shortly thereafter at 07:51 - 08:04. I should note that I had good detection and tracking of these bears on video from another camera of the same model mounted on a different side of the house.

I'm using version 1.5.1 with default parameters. The only additional option that I'm using is "-bb".

Thanks

Breakthrough commented 1 year ago

Hi @meen6thi;

Thank you so much for the report and providing a sample video. Real-world examples like this are incredibly useful for improving DVR-Scan. Running this locally on my machine, I was able to get the first part with the mama bear in the frame, but indeed the cubs are missed. It's useful in cases like this to generate a mask file with -mo so you can see how DVR-Scan processes the input video. To try and cover most typical use cases, the default motion sensitivity is a somewhat conservative value in order to not cause too many false positives for most users.

In this particular case, the cubs take up a very small proportion of the video frame. Motion is detected based on the percentage of the frame containing motion. There's a few detection parameters you can change to help in this case:

This has gotten me thinking about adding some presets for these parameters with better names (e.g. allowing users to set sensitivity to "low/medium/high" in addition to numeric values). The difficulty in setting default values is that there needs to be a balance between false positives vs. missed events that covers the majority of use cases. For some background, see this discussion, in particular this response, and feel free to chime in there as well if you have any feedback.

Would it be alright if I include this video in the DVR-Scan test suite, and use it for an example in the documentation? I think there's an opportunity to improve the documentation here, and write a guide on tuning detection parameters when you don't get the correct results using the default parameters. With your permission, I would like to use the footage you shared for that, as it is an excellent example, and the above information isn't really well documented anywhere yet.

Lastly, there are some other parameters used in the underlying background subtraction algorithms which are not tuned whatsoever currently. The background subtraction itself seems to not work well with the bears, so there's some investigation that can be done there as well. You can see this with the output of -mo as they nearly disappear when moving slowly, which should not happen that fast. The next version of DVR-Scan will add additional parameters which can be tuned which should help in cases like this, so this sample will be useful in determining how those default values should be changed.

Many thanks again for sharing this - I hope this response helps, and would be happy to answer any follow up questions or hear any suggestions you might have.


Example of the ROI I used to successfully detect the mama and cubs:

roi selection


Tasks remaining before closing this issue for v1.6: