Yawcam motion records hundreds of pitch black videos at night

Report and discuss bugs here!
Post Reply
Yaycu
Posts: 5
Joined: Wed Aug 05, 2020 12:27 pm

Yawcam motion records hundreds of pitch black videos at night

Post by Yaycu » Wed Aug 05, 2020 12:56 pm

Hello Malun,

I hope you can answer this question or suggest a workaround.

I have a Logitec webcam set up to motion sensor record my driveway. In daylight, it works OK. At night, I have a motion sensor light that turns on when it detects passive infrared. When this happens, Yawcam records, which is great.

However, my driveway has almost no traffic at night, so 99% of the time, the motion activated light does NOT turn on.
Yet, Yawcam still produces a pitch black video every minute or 2 (sometimes 2, 3 pitch black clips every minute).

The effect is that, every morning I wake up with 100+ of pitch black videos. I try to set the tolerance value to 10 (from a default value of 2), which lessens the number of pitch black videos somewhat, but now Yawcam misses a lot of real motions during daytime, with tolerance value @ 10.

It may not be feasible, but is there anyway you can put an additional logic into Yawcam to not record videos if most of the pixels are dark? I believe this would solve this problem. Then Yawcam would be pretty good, IMHO.

Thank you for the hard work. I understand programming is often under-appreciative. So kudos to you for continuing this helpful project.

Best,
Yaycu

Advertisement



malun
Site Admin
Posts: 1527
Joined: Sun Jan 04, 2004 1:29 pm

Re: Yawcam motion records hundreds of pitch black videos at night

Post by malun » Wed Aug 05, 2020 11:36 pm

It's sometimes tricky to get an acceptable level of false positives, especially during night time.
Are you using the motion detector with "auto level" enabled or disabled?

I would recommend to have it enabled.
I also recommend you to use the "Reference image" algorithm.

/malun

Yaycu
Posts: 5
Joined: Wed Aug 05, 2020 12:27 pm

Re: Yawcam motion records hundreds of pitch black videos at night

Post by Yaycu » Thu Aug 06, 2020 2:52 am

Thank you, Malun, for your reply.

For what it's worth, I'm actually using the "Reference Image" algorithm because I like slow motion to be captured. I also have "auto level" enabled.

I wonder if you could do this for the motion sensing video code portion:

if( /* most frame pixels are not dark (i.e., RGB value > certain threshold close to 0) /*)
{
/* Your regular video processing codes goes here */
}

In my simple mind, wouldn't the above *if* block essentially skips over everything when the frame image is dark? Yes, I understand everything is not as simple as I've laid out, but it would be nice if you could somehow check for dark frame at the top level of your video processing code and just skips it all together if the frame is dark.

Thanks for your effort, as always.

Yaycu

malun
Site Admin
Posts: 1527
Joined: Sun Jan 04, 2004 1:29 pm

Re: Yawcam motion records hundreds of pitch black videos at night

Post by malun » Thu Aug 06, 2020 6:22 pm

I guess a "darkness filter" only will be useful in the case where you have lights controlled by a PIR.
But in that case it probably can make some difference for the number of false positives.

It's never as simple as a single if-statement :D
But this change was simple enough.

Try this new beta version that has a darkness filter:
https://www.yawcam.com/beta/yawcam_BETA_2020-08-06.exe

You specify the darkness filter in %
darkness-filter.png
darkness-filter.png (8.25 KiB) Viewed 2369 times
100% would be a totally black image.
0% would be a totally white image.

I'm not sure what a good value will be for you.
Experiment at bit and let us know if any number works for you.

Every motion event will report the darkness of when the event was triggered:
darkness-example.png
darkness-example.png (61.89 KiB) Viewed 2369 times
That might be helpful when you try to tune in a good threshold value.

/malun

malun
Site Admin
Posts: 1527
Joined: Sun Jan 04, 2004 1:29 pm

Re: Yawcam motion records hundreds of pitch black videos at night

Post by malun » Thu Aug 06, 2020 7:28 pm

As a "teaser":
A future version of Yawcam will be more focused on motion detection and surveillance.
It will use machine learning to detect objects in the video. This eliminates a lot of false positives that you get when you only compare pixel changes. My tests so far looks promising. :D

It will however require an rather good nvidia graphics card to be able to run the object detection in real time.

This new version is far from ready for release. But I'm working on it...
Here's a preview:
yawcam-new-preview.jpg
yawcam-new-preview.jpg (97.76 KiB) Viewed 2362 times
.
/malun

Yaycu
Posts: 5
Joined: Wed Aug 05, 2020 12:27 pm

Re: Yawcam motion records hundreds of pitch black videos at night

Post by Yaycu » Fri Aug 07, 2020 1:31 am

Thank you for your fast turn around. I know it's not as simple as an *if* statement, but that, unfortunately, is the extent of my programming skill. Anything more advanced and my head would explode. What's that you say? Learning machine? Kaboom. :lol:

The new beta version sounds like it would help a great deal. I will try it out tonight (and maybe the next) and report back. I can't thank you enough! :D

As for the teaser, I'm salivating now. I'm sure we all can't wait. Hopefully the machine learning stuff won't recognize objects in the dark and therefore, won't record. :mrgreen: You mentioned a "good" nvidia graphics card is required. I wonder if that essentially makes laptops of yesteryear obsolete for this purpose? (We all know current Yawcam runs well on laptops a decade or older).

BUT I guess I'll splurge on some good hardware if the future version is as promising as you indicate. That is some great work there. Those teaser pictures look awesome!!!

Cheers,
Yaycu

malun
Site Admin
Posts: 1527
Joined: Sun Jan 04, 2004 1:29 pm

Re: Yawcam motion records hundreds of pitch black videos at night

Post by malun » Fri Aug 07, 2020 11:33 pm

Nice, I'm looking forward to hear about the results from your tests when they are ready.

Regarding the future version, It all comes down to the graphics card if you will be able to run the object detection with decent performance or not. I will have to make more tests on different hardware before I can say anything about the requirements. But I think there is a nvidia card in my old laptop from some years back. It will be a good starting point to see if/how it runs on that machine...

/malun

Yaycu
Posts: 5
Joined: Wed Aug 05, 2020 12:27 pm

Re: Yawcam motion records hundreds of pitch black videos at night

Post by Yaycu » Mon Aug 10, 2020 7:20 am

Greetings Malun,

I want to report that the darkness filter works great. Thanks for making it easy. The recorded darkness event shows 99% so I just set mine to 98% and the whole night goes by without a single clip. :D And yes, this is the same for 2 night straight now so it's fair to conclude that it works.

For anyone out there who might want to use this feature, just a note that my night setting is pretty ideal for this because there is no light from my neighbors (maybe they count on my motion light to do the work for them). So the darkness level is pretty consistent the whole night. If you have neighbors who turn on light randomly at night or you have light bleed from some other sources, it will be a trial-and-error process to set the filter, but it is much easier than tweaking the settings for the video motion sensor during the day.

Speaking of which, I still find that the video motion sensor during the day is less than ideal. It's a trade off between recording too much and recording too little (in other words, more false positive clips vs. missing some real action). Of course, this is through no fault of the software. As you pointed out, pixel comparison is no match for object recognition so I can't wait for the new version.

Seriously, if you get to a stage where you need testers for the new version, please count me in. :mrgreen:

Thank you, Malun, for adding the darkness filter. It is much appreciated!

malun
Site Admin
Posts: 1527
Joined: Sun Jan 04, 2004 1:29 pm

Re: Yawcam motion records hundreds of pitch black videos at night

Post by malun » Wed Aug 12, 2020 12:57 am

I'm glad to hear that the darkness filter turned out to work pretty well for you!
As you say, it sounds like your setup is close to ideal for this scenario.

A follow up question: Does your camera have IR-lights?
My guess is that the darkness filter would work better with IR-lights disabled on the camera and only rely on the separate PIR activated lights.

False positives will always be a problem, even with object recognition I'm afraid.
With that said, we could probably do something smarter with the pixel comparison in Yawcam to make it better. But for now, I want to spend most of my "Yawcam time" on the future version and on object recognition.
Hopefully the future version of Yawcam can be better also on pixel comparison, but time will tell :D

The future version will need a lot of testing. Sadly it is not ready for tests yet. It needs more work :roll:
But when the time is right, I would gladly accept your offer to help with the testing!

/malun

Yaycu
Posts: 5
Joined: Wed Aug 05, 2020 12:27 pm

Re: Yawcam motion records hundreds of pitch black videos at night

Post by Yaycu » Sun Aug 16, 2020 5:46 am

I have Logitech QuickCam Pro 9000, so it doesn't have infrared light, but it works better that way. I don't like the black & white videos produced by IR light anyway. Many thanks to you, now the webcam no longer records at night, except only when the PIR activated light is on.

For day time, I leave all settings at default, and also get hundreds of videos clips. However, I find this is optimal for catching all actions (as well as tons of false positives). I find that if I tweak settings to get less videos clips, I also miss some real motions (or the actions get chopped off on both ends).

You know, I actually don't mind the software catching motions like the moving tree branches, or even their moving shadows. To me, they are valid motions. The thing that bugs me a bit is that, about 50% of the clips produced are just about lighting changes due to webcam automatic light compensation.

And yes, I am aware of the max filter setting, but that doesn't seem to work for me. Once I set it to 60% (from the default of 75%), and it didn't seem to have any affects. I ought to go back and try that option out more. I'm just afraid of setting it to anything lower than 50% for fear it would ignore any action happening really close to the webcam.

Instead of just pixel comparison, it would be cool if your algorithm somehow can detect groups of similar color pixels that "move" or change shape from frame to frame. That would effectively detect any "blob" that moves and not lighting changes. That would cut the number of false positive clips roughly in half. :)

But I digress...

As you've mentioned, your effort and passion is best served working on the new version. Even if the object-detection algorithm can detect a "blob" that moves (be it humans, pets, or just shadows) and not lighting changes, it's already better than the current pixel comparison alg.

That said, I'm patiently awaiting the new version :D. Thank you for your effort and dedication.

Post Reply