The Integrated Catflap : Fine Tuning Cascade / Deep Learning
Hi,
I've built into a stock catflap, a prey sensing Raspberry Pi OpenCV camera system that will check the underside of our cat's mouth and if cascade trained prey is detected, will lock the catflap so Fluffy can't come in with her murder present.
I've spent a number of months trying different positives / scaling / neighbours. Whilst I've been able to get it to lock for some detections such as eyes and tail of the mouse, it doesn't seem to pick up noses or the claws very well.
I trained it with 200 positives and over 9000 negatives.
The best I've gotten was with the HAAR cascade, with Scale factor of 1.01 and Min Neigh of 2.
I don't need to scale much as the cat always comes through at the same distance and the mouse / bird is virtually the same size. It's a positional thing if the mouse if facing forward rather than rear etc. Hence getting as many positional positives as possible.
What I don't understand is when I tested the cascade with the images it was trained with, you'd think it would pick them all out but it doesn't.
Any recommendations on how to fine tune the Scale and Neighbours or even the images going into the cascade?
I've put the cascades, positives and tests here. https://bit.ly/2OKdP43
You're welcome to use the positives in your projects.
Many thanks
Richard
You might have better luck with a neural network. Check out this post.
In answer to the person who made the quote about the cascade being a binary classifier. The no cat, cat, cat with prey issue.
This was an issue before I cropped the images down as the fur of the cat and the fur of the mouse were being confused but that is a good point. I wanted to only put in features that are absolutely prey. This is why I didn't put in stock pictures of complete mice to train.
What I could do is for those images where there is a slight bit of cat, is black out that area only leaving the mouse and rerun the cascade.
Re the neural network, thanks. I had wondered if Tensorflow could help and I've worked with Adrian's code before plus he's a great help.
Great pointer.
Thanks
Richard
That's a deadly awesome project!!!
Thanks sjhalayka.
I started it a couple of years ago but due to life commitments have only spent 6 months or so on it total. Here is a link showing the electronics and outside of flap.
https://www.raspberrypi.org/forums/vi...
Richard
Have you tried the OpenCV feedforward back-propagation artificial neural network (aka plain vanilla ANN)?
I'm looking at neural nets now, so I'll add that to the list. :)
Cool. Let us know how it goes. Would you like to have some C++ source code or are you using Python?
I'm using Python.
The URL below has code for both binary and one-hot encoding, focusing on teaching the ANN how to solve the XOR problem. It doesn't take into account a loss function.
https://github.com/sjhalayka/python_o...
Thanks muchly.