Skip to content
This repository has been archived by the owner on Mar 19, 2023. It is now read-only.

Commit

Permalink
Remove face code
Browse files Browse the repository at this point in the history
Remove face
  • Loading branch information
robmarkcole committed Jul 16, 2019
1 parent 4c55977 commit 5922948
Show file tree
Hide file tree
Showing 19 changed files with 5 additions and 1,756 deletions.
63 changes: 5 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# HASS-Deepstack
[Home Assistant](https://www.home-assistant.io/) custom components for using Deepstack face & object detection. [Deepstack](https://www.deepquestai.com/insider/) is a service which runs in a docker container and exposes deep-learning models via a REST API. There is no cost for using Deepstack, although you will need a machine with 8 GB RAM. On your machine with docker, pull the latest image (approx. 2GB):
# HASS-Deepstack-object
[Home Assistant](https://www.home-assistant.io/) custom components for using Deepstack object detection. [Deepstack](https://www.deepquestai.com/insider/) is a service which runs in a docker container and exposes deep-learning models via a REST API. There is no cost for using Deepstack, although you will need a machine with 8 GB RAM. On your machine with docker, pull the latest image (approx. 2GB):

```
sudo docker pull deepquestai/deepstack
Expand All @@ -23,53 +23,6 @@ Now go to http://YOUR_SERVER_IP_ADDRESS:5000/ on another computer or the same on
## Home Assistant setup
Place the `custom_components` folder in your configuration directory (or add its contents to an existing `custom_components` folder). Then configure face recognition and/or object detection. Note that at we use `scan_interval` to (optionally) limit computation, [as described here](https://www.home-assistant.io/components/image_processing/#scan_interval-and-optimising-resources).

## Face recognition
Deepstack [face recognition](https://deepstackpython.readthedocs.io/en/latest/facerecognition.html) counts faces and will recognise them if you have trained your Deepstack using the `deepstack_teach_face` service.

On you machine with docker, run Deepstack with the face recognition service active on port `5000`:
```
sudo docker run -e VISION-FACE=True -v localstorage:/datastore -p 5000:5000 deepquestai/deepstack
```

The `deepstack_face` component adds an `image_processing` entity where the state of the entity is the total number of faces that are found in the camera image. Recognised faces are listed in the entity `matched faces
` attribute.

Add to your Home-Assistant config:
```yaml
image_processing:
- platform: deepstack_face
ip_address: localhost
port: 5000
scan_interval: 20000
source:
- entity_id: camera.local_file
name: face_counter
```
Configuration variables:
- **ip_address**: the ip address of your deepstack instance.
- **port**: the port of your deepstack instance.
- **source**: Must be a camera.
- **name**: (Optional) A custom name for the the entity.
#### Service `deepstack_teach_face`
This service is for teaching (or [registering](https://deepstackpython.readthedocs.io/en/latest/facerecognition.html#face-registeration)) faces with deepstack, so that they can be recognised.

Example valid service data:
```
{
"name": "superman",
"file_path": "/Users/robincole/.homeassistant/images/superman_1.jpeg"
}
```

<p align="center">
<img src="https://github.com/robmarkcole/HASS-Deepstack/blob/master/docs/face_usage.png" width="500">
</p>

<p align="center">
<img src="https://github.com/robmarkcole/HASS-Deepstack/blob/master/docs/face_detail.png" width="350">
</p>

## Object Detection
Deepstack [object detection](https://deepstackpython.readthedocs.io/en/latest/objectdetection.html) can identify 80 different kinds of objects, including people (`person`) and animals. On you machine with docker, run Deepstack with the object detection service active on port `5000`:
```
Expand Down Expand Up @@ -100,11 +53,11 @@ Configuration variables:
- **name**: (Optional) A custom name for the the entity.

<p align="center">
<img src="https://github.com/robmarkcole/HASS-Deepstack/blob/master/docs/object_usage.png" width="800">
<img src="https://github.com/robmarkcole/HASS-Deepstack-object/blob/master/docs/object_usage.png" width="800">
</p>

<p align="center">
<img src="https://github.com/robmarkcole/HASS-Deepstack/blob/master/docs/object_detail.png" width="350">
<img src="https://github.com/robmarkcole/HASS-Deepstack-object/blob/master/docs/object_detail.png" width="350">
</p>

#### Event `image_processing.object_detected`
Expand Down Expand Up @@ -176,7 +129,7 @@ sudo docker run -e VISION-DETECTION=True -e VISION-FACE=True -v localstorage:/da
```

<p align="center">
<img src="https://github.com/robmarkcole/HASS-Deepstack/blob/master/docs/face_and_object_usage.png" width="500">
<img src="https://github.com/robmarkcole/HASS-Deepstack-object/blob/master/docs/face_and_object_usage.png" width="500">
</p>

### Support
Expand Down Expand Up @@ -229,9 +182,3 @@ Q7: Can object detection be configured to detect car/car colour?
A7: The list of detected object classes is at the end of the page [here](https://deepstackpython.readthedocs.io/en/latest/objectdetection.html). There is no support for detecting the colour of an object.

------

Q8: If I teach (register) a face do I need to re-teach if I restart the container?

A8: So long as you have run the container including `-v localstorage:/datastore` then you do not need to re-teach, as data is persisted between restarts.

------
1 change: 0 additions & 1 deletion custom_components/deepstack_face/__init__.py

This file was deleted.

206 changes: 0 additions & 206 deletions custom_components/deepstack_face/image_processing.py

This file was deleted.

8 changes: 0 additions & 8 deletions custom_components/deepstack_face/manifest.json

This file was deleted.

505 changes: 0 additions & 505 deletions development/.ipynb_checkpoints/Deepstack face dev-checkpoint.ipynb

This file was deleted.

This file was deleted.

Binary file not shown.
505 changes: 0 additions & 505 deletions development/Deepstack face dev.ipynb

This file was deleted.

Binary file removed development/adele_test.jpg
Binary file not shown.
Binary file removed development/adele_train.jpg
Binary file not shown.
Binary file removed development/bad.jpg
Binary file not shown.
Binary file removed development/boxed_img.jpg
Binary file not shown.
Binary file removed development/face_0.jpg
Binary file not shown.
Binary file removed development/face_1.jpg
Binary file not shown.
Binary file removed development/face_2.jpg
Binary file not shown.
Binary file removed development/face_3.jpg
Binary file not shown.
Binary file removed docs/face_detail.png
Binary file not shown.
Binary file removed docs/face_usage.png
Binary file not shown.
Binary file removed docs/notification.jpg
Binary file not shown.

0 comments on commit 5922948

Please sign in to comment.