DVR-Scan icon indicating copy to clipboard operation
DVR-Scan copied to clipboard

Failed to Detect Black Bear

Open meen6thi opened this issue 3 years ago • 1 comments

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

meen6thi avatar Aug 20 '22 23:08 meen6thi

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:

  • set a smaller region-of-interest using the -roi flag to exclude parts of the frame
    • since the effective frame size is smaller, any motion within the ROI will have a higher motion score
    • this is typically what the first step should be when possible - see image below for an example
  • increase detection sensitivity by lowering the threshold (e.g. set -t 0.1, default is 0.15, lower = more sensitive)
    • this can lead to increased false positives, especially if trees move, but this can be compensated for by setting minimum event length
    • reducing this can lead to a significant increase in false positives for the majority of use cases, which is why the default sensitivity threshold was set to a more conservative value
  • lower noise reduction by setting -k 5 (default is 7 for 1080p videos)
    • this has the same problems as lowering threshold

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:

  • [ ] Add a guide to the documentation for how to approach tuning motion detection parameters, include this footage if permission is granted
  • [ ] Determine what background subtraction parameters might be tuned to provide better results in cases like this
    • history amount may need to be adjusted for framerate
    • variance might need to be adjusted for effective resolution

Breakthrough avatar Aug 21 '22 15:08 Breakthrough