Microsoft facial recognition, who is able to make it work?

@CommonBlob No not yet. A time ago I played around a little bit with OpenVC but I had not the intension to use it with OpenHAB. Nevertheless I was a little confused to read that someone who uses OpenHAB wants to integrate MS facial recognition. I am using OpenHAB, because I do not want to spread any personal information in the internet, otherwise I could use HomeKit or something similar. So for me it is a contradiction.

Based on your link, the program can only do face detection, NOT face recognition. Detection and recognition are 2 different things. Are you sure OpenVC can do face recognition?

So I am curious if anyone else is burning through their free quota. Depending on what you configured for the scan interval in imaging processing, it will constantly make transactions trying to identify faces on each scan. It doesn’t look like I can apply conditions to image processing in order to reduce transactions. Any work around?

@masterkenobi Yes it can, here is an example video

Hi,

I tested that, Opencv can do face recognition.
I took the code from the project treasure box and modified the short code (:slight_smile:) to write to a file my name.
HA was able to poll the file with a cat command and trigger some actions.

OpenCV on raspberry is a little bit slow for that…

the code used was on pyhton (perhaps for the next update of HA) :pray:

Interesting.
Were you doing it on a rpi3? or earlier?

Was this also taking images from a camera?

Hi

My system was on rpi2
I used the /dev/video0 device to do that…

Ah ok, thanks. So I guess the 3 should be a bit better :slight_smile:

Anyone have any step by step instructions. from someone who got it working … reading through everyone post I try adding {“group”:“family”, “name”:“bobby walters”} to service but I am just getting bit and pieces of everyone conversations… A step by step would instructions would help me and others who are trying to get it working.

The local image upload via curl is not working so I used the camera method and it works.
Training via dev-service works too.
I just followed the steps indicated on the microsoft face components page, as well as the Microsoft face identify and image processing.

Do you mine posting a step by step instructions

hot do you add these entries in the config file ?

microsoft_face:
api_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

service: microsoft_face.create_group
data:
name: ‘Family’

service: microsoft_face.create_person
data:
group: family
name: ‘Hans Maier’

service: microsoft_face.face_person
data:
group: family
name: ‘Hans Maier’
camera_entity: camera.door

service: microsoft_face.train_group
data:
group: family

Do I add them like this
or can you or anyone post their code so I can simulate it?

api key is added in yaml file

you add the groups and persons using dev tools in HA frontend.
Face is added using dev tools or from Microsoft side (i was told) but I have not done this so I cannot confirm

service info you have listed in your post is used in automations

I added 4 family members using this command
{“group”:“family”, “name”:“ben”} I just change the name for each family members

How did you or anyone add faces and train the group?

Yes, now add a face for each person. I used the curl command to load the image locally.

curl -v -X POST “https://westus.api.cognitive.microsoft.com/face/v1.0/persongroups/{GroupName}/persons/{personId}/persistedFaces
-H “Ocp-Apim-Subscription-Key: YOUR_API_KEY”
-H “Content-Type: application/octet-stream” --data “@/tmp/image.jpg”

Pay special attention to the following:

  1. {group name} is the group name you used. For your example, is family.
  2. {personID} is actually the key MS provide for that person you added. I login to MS portal to get that. Is a long key.
  3. you must use “@” in front of the path of the image file. If you don’t, you will get file too big or too small error from MS.

I train using MS portal after. I did not have success getting my face recognized. Similar to what adamfox posted above but reboot didn’t fix it.

Ben: 6e6cbf55-f959-4bd2-97de-bcc672fd9baa
Bobby Walters: 64e69391-f8ab-43e4-b40c-812399fc4c11
Monty Davis: c76713a9-ecda-4484-80d0-ac2317409a80
Saraiyh Walters: 852c45f4-cf43-4640-84b6-54c279e30634
friendly_name: Family

I try it like this

curl -v -X POST “https://westus.api.cognitive.microsoft.com/face/v1.0/persongroups/{Family}/persons/{852c45f4-cf43-4640-84b6-54c279e30634}/persistedFaces
-H “Ocp-Apim-Subscription-Key: 0xxxxxxxxxxxxxxxxxxxxxxxxxxxx”
-H “Content-Type: application/octet-stream” --data “@/tmp/saraiyhw.jpg”

I added a pic to the tmp folder to test
but I am getting this

{“error”:{“code”:“InvalidImageSize”,“message”:“Image size is too small or too big.”}}

https://westus.api.cognitive.microsoft.com/face/v1.0/persongroups/Family/persons/852c45f4-cf43-4640-84b6-54c279e30634/persistedFaces
-H “Ocp-Apim-Subscription-Key: 0xxxxxxxxxxxxxxxxxxxxxxxxxxxx”
-H “Content-Type: application/octet-stream” --data “@/tmp/saraiyhw.jpg”

see command without the { }. replace the subscription-key with real key.

Have you tried uploading images directly using the camera? It was able to trigger one of my automations.

am still getting

{“error”:{“code”:“InvalidImageSize”,“message”:“Image size is too small or too big.”}}

what the correct size of pictures or how can I use the camera to take a pic

now I am getting this

{“error”:{“code”:“InvalidImage”,“message”:“Decoding error, image format unsupported.”}}

I try every format png, jpg, gif

and sizes 200x200
100x100
50x50
500x500