Using ESP32-CAM, is it possible to do face *detection* (not recognition) in Esphome?

Hi all,

I recently read this article, in which the author uses an ESP32-CAM to detect faces, and use these as trigger events for automation. Note, they are not trying to do face recognition, they are simply detecting when a face is in the frame. Any face.

To me, this seems to be a very useful additional layer one could use for presence detection, and in certain cases could work better than PIR, since the face wouldn’t need to be moving, it could just be in frame.

I’ve read the ESPhome.io docs pertaining to the ESP32-CAM module, and I can’t see how this could be done with the methods that are there. Am I looking at a pure homebrew project? I could, for example, hack something up that could send an MQTT message on face detect. I actually like this idea because it’s quite privacy friendly: there’s no need to send video, just a trigger event.

I’d appreciate any input you have.

Thanks

There is the ability to use custom libraries. In practice, not my area. Looks like a great feature.

1 Like

Thanks for the feedback, @nickrout. I’ll post here again if I stumble over anything useful. The idea of a device that does face detection, with sensors all over the free pins, appeals to me greatly.

1 Like

Me too, would be great :slight_smile:

i was also looking for the same, have anyone found a solution?

I recently started looking into this myself, not seriously, but as an “I wonder if…” idea and I came upon this thread. I recently came upon a few ESP32-CAM devices and I’m looking for uses for them. :sweat_smile:

I read through the article you linked and, I mean, looking at the code sample he uploaded to the ESP32-CAM, it’s essentially just a function making a call to the sonoff API with a “TOGGLE” command.

If you’re looking at this as a basis to start, you could update the API call to call your HA and do something based on the logic, like call an automation or switch. There’s a couple of bits you’d need to update in addition like the cleanup logic but it’s doable.

I’ve never programmed in arduino IDE, but I’ve read plenty of code in my time and it doesn’t look especially impossible, and would probably be a fun project for someone with time to learn and test.

I could be completely wrong about all of the above though… :sweat_smile:

Something else I came upon was this Facebox integration that uses AI and can actually do face recognition, although it can be turned off for just face detection.

According to the integration docs, Facebox runs as an x86 docker container, so that could well run as an Home Assistant add-on, and it might already be available somewhere if someone already did that.

With this, the idea is that you can use a door-cam to provide that video feed and have it recognised and identified.

I don’t see why you couldn’t use the ESP32-CAM as a video feed for that as well.

Just a thought.

Something else here to take a look at: