Sitemap

Member-only story

Computer Vision — Ding Dong the cat wants to be let in!

3 min read4 hours ago

--

Very often, I turn around to be met by the glare of my cat (and the neighbours’) waiting to be let in. The longer you leave the precious sods outside, the more they paw at the glass. So, as I’ve been wanting to learn about computer vision (CV) for a couple of weeks now, I thought: why not start that journey by making a cat doorbell?

The plan is simple: camera → find cat → is it at the door? → has it stayed there? → ding dong. It should make a good first CV project: it’s silly, small and should give results quickly. The hardest part is hoping the cat understands the plan.

Finding the cat

First, we need a model to detect the cat. Luckily, we don’t have to train anything, as YOLO (YOLO11n, about 5 MB) has already been trained on 80 everyday things from the COCO dataset and, not too surprisingly, cats are one of them.

Press enter or click to view image in full size
My cat spooky getting detected

For each frame, the model returns a box around anything it thinks is a cat, along with a confidence score for how sure it is. We only ask for cats by passing class 15, COCO’s class for cats, to the predict call, and we ignore anything below 40% confidence.

One problem came up quickly: cats jumping up on the desk and setting it off. To cut down on misfired ding dongs, you can draw a zone over the area you care about, such as the…

--

--

Ryan Hancock
Ryan Hancock

Written by Ryan Hancock

Software Engineer with over ten years of experience, engineering my way out of problems that probably didn't need solving.