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

I’m excited to see facial recognition is finally here. Unfortunately, I’m unable to make it work even though I already have the API key. Who has better luck than me?

1 Like

Did it just say “These are not the droids we are looking for. Move along.”?

You may be a victim of your own powers, @masterkenobi

:wink:

3 Likes

I haven’t even understand how to put it all in the configuration

I have added the config as directed by the hass page that defines it >> https://home-assistant.io/components/microsoft_face/

Next I tried calling the service to add a group and nothing I input seems to work. First I tried no Service_data:

And I get the error in HASS:


Then I tried adding various iterations of: family, ‘family’, name: ‘family’, name=family, name = “Family” but I always get a JSON error:

I’d also love to know how this is set up since there doesn’t appear to be a way to set groups and people within the web interface of Microsoft’s Face Recognition site.

It only works if Satya Nadella enters your home.

I’m not even mad, I’d have a conversation with him at length even after he invited himself into my home by the very existence of his face! Also, if he could invite Bill Gates over so we talk about how to integrate Bill Gates’ mosquito laser into an automated system in my back yard, I’d be a little more than happy with that!!

1 Like

I think yo have to use JSON in service call, like {"name":"family"}

I can’t even find microsoft_face in the Domain. I added this in the configuration.yaml…

microsoft_face:
  api_key: !secret microsoft_face_api_key

The API key I got is from…

I chose Key 1.

But I see this on the front end.

This is the errors I have in the log…

ERROR (MainThread) [homeassistant.bootstrap] Error during setup of component microsoft_face
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/microsoft_face.py", line 375, in call_api
    raise HomeAssistantError(answer['error']['message'])
  File "/home/pi/.homeassistant/deps/async_timeout/__init__.py", line 44, in __exit__
    raise asyncio.TimeoutError from None
concurrent.futures._base.TimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/homeassistant/bootstrap.py", line 148, in _async_setup_component
    result = yield from component.async_setup(hass, config)
  File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/microsoft_face.py", line 125, in async_setup
    yield from face.update_store()
  File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/microsoft_face.py", line 324, in update_store
    groups = yield from self.call_api('get', 'persongroups')
  File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/microsoft_face.py", line 382, in call_api
    _LOGGER.warning("Timeout from microsoft face api %s", response.url)
AttributeError: 'NoneType' object has no attribute 'url'

I had to use key2 because key1 was not recognized.

Now I’m trying to upload faces, but I get lot of non-supported format, even when they are simple jpg images

1 Like

Thanks. Key2 works.

But I don’t understand how the service calls work. What happen after I call microsoft_face.create_group or microsoft_face.create_person in the front end? How do I see what I have previously created?

Anybody else having an issue with the cURL command? Seems to upload properly but returns a invalid image size error:

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

Trying to run train_group retruns:

WARNING:aiohttp.client:Attempt to decode JSON with unexpected mimetype:
1 Like

not sure if its related, but i get the error: WARNING:aiohttp.client:Attempt to decode JSON with unexpected mimetype: due to a problem with aiohttp on the synology component. aiohttp borks up the cookie header.
nugget opened a case here https://github.com/KeepSafe/aiohttp/issues/1566

After a group creation you can see it at developers entities page ( < > ), and you can see there your person id.

1 Like

Thanks.

After I created the person using microsoft_face.create_person, next step is microsoft_face.face_person.

From my understanding, if I use the service call like in the example…

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

Hans Maier has to stand in front of camera.door before I call the service, am I right?

Another method is to upload some photos to the same machine that HA runs on and SSH into the machine and run this command…

$ 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"

Am I right so far?

I am wondering "@/tmp/image.jpg" is referring to which directory? What does the @ means?

same doubt as mine

this for the group.

And for the person (inside that group)?

{"group":"family", "name":"Hans Maier"}

I got it working!

This is what i did

First 3 steps are through services in HA frontend:

created group (called family through HA)
create person (me)
used my camera to create the picture of me through
But when i came to train the group, it would error.
So i logged onto the cognitive services api reference and then did the train through there (curl was complaining)
It then recognised me and turned my lights on per my automation.

Where is that?

thanks now I put two names, and I have this

{
“James”: “1b1c8246-7ccccc44962f”,
“Anna”: “36342bcfccccc06a95e1858c”,
“friendly_name”: “family”
}