Skip to content

Commit 734b08f

Browse files
pvizelifabaff
authored andcommitted
Microsoft face (home-assistant#1876)
* Microsoft Face * Add platform doku
1 parent b2bbe1d commit 734b08f

File tree

6 files changed

+142
-1
lines changed

6 files changed

+142
-1
lines changed

source/_components/image_processing.markdown

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,24 @@ automation:
3434
```
3535

3636
The following event attributes will be present: `entity_id`, `plate`, `confidence`
37+
38+
## {% linkable_title Face identify %}
39+
40+
Face entities attribute have a face counter `total_faces` and all validated person as `known_faces`.
41+
42+
This event is trigger after Microsoft Face identify found a known faces.
43+
44+
```yaml
45+
# Example configuration.yaml automation entry
46+
automation:
47+
- alias: Known person in front of my door
48+
trigger:
49+
platform: event
50+
event_type: identify_face
51+
event_data:
52+
entity_id: image_processing.door
53+
name: 'Hans Maier'
54+
...
55+
```
56+
57+
The following event attributes will be present: `entity_id`, `name`, `confidence`
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
layout: page
3+
title: "Microsoft Face identify"
4+
description: "Instructions how to integrate microsoft face identify into Home Assistant."
5+
date: 2017-01-25 00:00
6+
sidebar: true
7+
comments: false
8+
sharing: true
9+
footer: true
10+
logo: microsoft.png
11+
ha_category: Image_Processing
12+
featured: false
13+
ha_release: 0.37
14+
---
15+
16+
The `microsoft_face_identify` image processing platform lets you use [Microsoft Face identify](https://www.microsoft.com/cognitive-services/en-us/) API through Home Assistant.
17+
18+
Please refer to the [component](/components/microsoft_face/) configuration on how to setup the API key.
19+
20+
For using inside automation look on [component](/components/image_processing) page.
21+
22+
### {% linkable_title Configuration Home Assistant %}
23+
24+
```yaml
25+
# Example configuration.yaml entry
26+
image_processing:
27+
- platform: microsoft_face_identify
28+
group: family
29+
source:
30+
- entity_id: camera.door
31+
```
32+
Configuration variables:
33+
34+
- **group** (*Required*): Micrsoft face group to detect person from it.
35+
- **confidence** (*Optional*): The minimum of confidence in percent to process with Home Assistant. Defaults to 80.
36+
- **source** array (*Required*): List of image sources.
37+
- **entity_id** (*Required*): A camera entity id to get picture from.
38+
- **name** (*Optional*): This parameter allows you to override the name of your `image_processing` entity.

source/_components/image_processing.openalpr_cloud.markdown

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ ha_release: 0.36
1515

1616
[OpenALPR](http://www.openalpr.com/) integration for Home Assistant allows you to process licences plates from a camera. You can use them to open a garage door or trigger any other [automation](https://home-assistant.io/components/automation/).
1717

18+
For using inside automation look on [component](/components/image_processing) page.
19+
1820
### {% linkable_title Configuration Home Assistant %}
1921

2022
```yaml
@@ -30,7 +32,7 @@ Configuration variables:
3032
3133
- **region** (*Required*): Country or region. List of supported [values](https://github.com/openalpr/openalpr/tree/master/runtime_data/config).
3234
- **api_key** (*Required*): You need an API key from [OpenALPR Cloud](https://cloud.openalpr.com/).
33-
- **confidence** (*Optional*): The minimum of confidence in percent to process with Home Assistant. Defaults to 80.
35+
- **confidence** (*Optional*): The minimum of confidence in percent to process with Home Assistant. Defaults to 80.
3436
- **source** array (*Required*): List of image sources.
3537
- **entities** (*Required*): A list of devices to add in Home Assistant.
3638
- **name** (*Optional*): This parameter allows you to override the name of your OpenALPR entity.

source/_components/image_processing.openalpr_local.markdown

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ ha_release: 0.36
1515

1616
[OpenALPR](http://www.openalpr.com/) integration for Home Assistant allows you to process licences plates from a camera. You can use them to open a garage door or trigger any other [automation](https://home-assistant.io/components/automation/).
1717

18+
For using inside automation look on [component](/components/image_processing) page.
19+
1820
### {% linkable_title Local installation %}
1921

2022
If you want process all data locally, you need version 2.3.1 or higher of the `alpr` commandline tool.
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
---
2+
layout: page
3+
title: "Microsoft Face"
4+
description: "Instructions how to integrate Microsoft Face component into Home Assistant."
5+
date: 2017-01-25 00:00
6+
sidebar: true
7+
comments: false
8+
sharing: true
9+
footer: true
10+
logo: microsoft.png
11+
ha_category: Hub
12+
ha_release: "0.37"
13+
---
14+
15+
The `microsoft_face` component platform is the main component for Microsoft Azure Cognitive service [Face](https://www.microsoft.com/cognitive-services/en-us/face-api). All data are in a own private instance in the azure cloud.
16+
17+
You need an API key which is free but requires a [Azure registration](https://azure.microsoft.com/de-de/free/) with your microsoft ID. The free resource (*F0*) is limit to 30K request in a month and 20 per minute. If you don't want use a azure cloud, you can also get a API key with registration on [cognitive-services](https://www.microsoft.com/cognitive-services/en-us/subscriptions) but they need to recreate all 90 days.
18+
19+
To enable the Microsoft Face component, add the following lines to your `configuration.yaml`:
20+
21+
```yaml
22+
# Example configuration.yaml entry
23+
microsoft_face:
24+
api_key: YOUR_API_KEY
25+
```
26+
27+
Configuration variables:
28+
29+
- **api_key** (*Required*): The API key for your Cognitive resource.
30+
- **timeout** (*Optional)*: Set timeout for api connection (default 10sec).
31+
32+
### {% linkable_title Person and Groups %}
33+
34+
For most of service you need set a group or a person. So it process and detect only stuff they will given with this group. Home-Assistent create for all group a entity and allow your to show the state, person and IDs inside UI.
35+
36+
For manage this feature you have following services they can call with UI, script or rest api.
37+
38+
- *microsoft_face.create_group*
39+
- *microsoft_face.delete_group*
40+
```yaml
41+
service: microsoft_face.create_group
42+
data:
43+
name: 'Family'
44+
```
45+
46+
- *microsoft_face.create_person*
47+
- *microsoft_face.delete_person*
48+
```yaml
49+
service: microsoft_face.create_person
50+
data:
51+
group: family
52+
name: 'Hans Maier'
53+
```
54+
55+
We need add image to a person. We can add multiple image for every person to make the detection better. We can take a picture from a camera or send a local image to our azure resource.
56+
57+
- *microsoft_face.face_person*
58+
```yaml
59+
service: microsoft_face.face_person
60+
data:
61+
group: family
62+
name: 'Hans Maier'
63+
camera_entity: camera.door
64+
```
65+
66+
For the local image we need *curl*. The personId is present in group entity as attribute.
67+
68+
```bash
69+
curl -v -X POST "https://westus.api.cognitive.microsoft.com/face/v1.0/persongroups/{GroupName}/persons/{personId}/persistedFaces" -H "Ocp-Apim-Subscription-Key: {ApiKey}" -H "Content-Type: application/octet-stream" --data "@/tmp/image.jpg"
70+
```
71+
72+
After we done with changes on a group, we need train this group to make our AI fit to handle the new data.
73+
74+
- *microsoft_face.train_group*
75+
```yaml
76+
service: microsoft_face.train_group
77+
data:
78+
group: family
15.3 KB
Loading

0 commit comments

Comments
 (0)