Face Recognition, MQTT and Rules

Hi everyone,

The last months I am reading a lot and trying to implement a custom library on a separated Raspberry Pi 4, a coral USB accelerator and local NVR with RTSP streams to make it learn family faces and through MQTT subscribe Topics to my main OpenHab instance, so I can write some rules but without luck.
Does anybody have trained any model like that in order to provide a kind of tutorial?
I’ve got completely confused with all the libraries out there.


Try codeproject.ai
Doing face recognition relies on a very good positioning of your camera. Ideally zoomed in on the face and close to eye level, so not too high and most definitely not wide angle camera.

Got Compreface for face recognition, Dahua SIP doorpnone, Asterisk to handle calls to doorphone, and Openhab with self-modified IpCamera binding. When a doorbell is pressed at doorphone, Asterisk runs a script, getting a photo from doorphone with IPCamera binding’s imageURL and sending that photo to Compreface API by post request like

curl -X POST ", gender, age" \
-H "Content-Type: multipart/form-data" \
-H "x-api-key: fe899886-9d0f-4fd0-860a-406c5b1623de" \
-F "file=@20160118_211020-1.jpg"

, Compreface returns JSON like

      "subjects": [ {
          "subject": "Dad",
          "similarity": 0.95776
        } ],

which Asterisk sends to Openhab, triggering a rule, which is parsing JSON and reacts to recognized subjects.
Doorphone is also serving as an IPCamera, triggering motion detection events and sending them to Openhab IpCamera binding, which is serving as NVR, starting to write RTSP stream as mp4 file to HDD.
A dedicated IP Camera with little bit of smart capabilities (like motion detection and zoom), specialized CPU inside and integrated to IP camera binding will do it’s job better than RPI (for the same price), while a dedicated x86 home server with lots of RAM, storage and CPU/GPU power will easily run both Openhab, NVR and face detection with a wide choice of different libraries.
And API POST/GET methods a waay more reliable than “MQTT subscribe topics” which maybe-maybe are actual for ultralow power consuming devices, but definitely should not be used everywhere, as half of smart home-related chats consists of MQTT-related bugs.

1 Like

That’s unlikely to be the fault of the MQTT protocol, and more about how the user has setup MQTT in the first place.

MQTT is incredibly reliable, and used in industry worldwide.

I would agree that API POST/GET is usually easier, but that’s not the same as “more reliable”.

I’ve moved this to a more appropriate category. Tutorials and Solutions is a place to post solutions, not ask for them.

Thank you, Rick

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.