Skip to content

Commit 4401b82

Browse files
authored
Update README.md
1 parent 6847187 commit 4401b82

File tree

1 file changed

+6
-55
lines changed

1 file changed

+6
-55
lines changed

README.md

+6-55
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,12 @@
11
# CodeProject.AI Home Assistant Object Detection custom component
22

3-
## This version has been updated to fix the issue with "ANTIALIAS" command being deprecated in Pillow >= 10 in latest HomeAssistant (as of 06/08/2023)
3+
# This version has been updated to fix the issue with "ANTIALIAS" command being deprecated in Pillow >= 10 in latest HomeAssistant (as of 06/08/2023)
44

55
This component is a direct port of the [HASS-Deepstack-object](https://github.com/robmarkcole/HASS-Deepstack-object) component by [Robin Cole](https://github.com/robmarkcole). This component provides AI-based Object Detection capabilities using [CodeProject.AI Server](https://codeproject.com/ai).
66

7-
[CodeProject.AI Server](https://codeproject.com/ai) is a service which runs either in a Docker container or as a Windows Service and exposes various an API for many AI inferencing operations via a REST API. The Object Detection capabilities use the [YOLO](https://arxiv.org/pdf/1506.02640.pdf) algorithm as implemented by Ultralytics and others. It can identify 80 different kinds of objects by default, but custom models are also available that focus on specific objects such as animals, license plates or objects typically encountered by home webcams. CodeProject.AI Server is free, locally installed, and can run without an external internet connection, is is comatible with Windows, Linux, macOS. It can run on Raspberry Pi, and supports CUDA and embedded Intel GPUs.
8-
9-
On the machine in which you are running CodeProject.AI server, either ensure the service is running, or if using Docker, [start a Docker container](https://www.codeproject.com/ai/docs/why/running_in_docker.html#launching-a-container).
10-
11-
### A note on Ports
12-
CodeProject.AI Server typically runs on port 32168, so you will need to ensure the machine hosting the server has this port open. If you need to changes ports (eg switch to port 80) thenf or Docker use the -p flag:
13-
```
14-
docker run --name CodeProject.AI-Server -d -p 80:32168 ^
15-
--mount type=bind,source=C:\ProgramData\CodeProject\AI\docker\data,target=/etc/codeproject/ai ^
16-
--mount type=bind,source=C:\ProgramData\CodeProject\AI\docker\modules,target=/app/modules ^
17-
codeproject/ai-server
18-
```
19-
For Windows server you will need to either set an environment variable `CPAI_PORT` with value 80 (on the host running CodeProject.AI Server), or edit the appsettings.json file in the `C:\Program Files\CodeProject\AI folder` and change the value of the CPAI_PORT environment variable in the file.
207

218
## Usage of this component
22-
Thanks again to Robin for the original write up for his component.
9+
Thanks again to Robin for the original write up for his component. Please refer to the extended documentation available on the official repo or here: https://github.com/NeoMod/CodeProject.AI-HomeAssist-ObjectDetect/blob/master/extended-readme.md
2310

2411
The `codeproject_ai_object` component adds an `image_processing` entity where the state of the entity is the total count of target objects that are above a `confidence` threshold which has a default value of 80%. You can have a single target object class, or multiple. The time of the last detection of any target object is in the `last target detection` attribute. The type and number of objects (of any confidence) is listed in the `summary` attributes. Optionally a region of interest (ROI) can be configured, and only objects with their center (represented by a `x`) within the ROI will be included in the state count. The ROI will be displayed as a green box, and objects with their center in the ROI have a red box.
2512

@@ -28,7 +15,9 @@ Also optionally the processed image can be saved to disk, with bounding boxes sh
2815
**Note** that by default the component will **not** automatically scan images, but requires you to call the `image_processing.scan` service e.g. using an automation triggered by motion.
2916

3017
## Home Assistant setup
31-
Place the `custom_components` folder in your configuration directory (or add its contents to an existing `custom_components` folder). Then configure object detection. **Important:** It is necessary to configure only a single camera per `codeproject_ai_object` entity. If you want to process multiple cameras, you will therefore need multiple `codeproject_ai_object` `image_processing` entities.
18+
19+
- Install using HACS
20+
- Manual Install: place the `custom_components` folder in your configuration directory (or add its contents to an existing `custom_components` folder). Then configure object detection. **Important:** It is necessary to configure only a single camera per `codeproject_ai_object` entity. If you want to process multiple cameras, you will therefore need multiple `codeproject_ai_object` `image_processing` entities.
3221

3322
The component can optionally save snapshots of the processed images. If you would like to use this option, you need to create a folder where the snapshots will be stored. The folder should be in the same folder where your `configuration.yaml` file is located. In the example below, we have named the folder `snapshots`.
3423

@@ -142,13 +131,7 @@ homeassistant:
142131
143132
media_source:
144133
```
145-
And configure CodeProject.AI Server to use the above directory for `save_file_folder`, then saved images can be browsed from the HA front end like below:
146-
147-
<p align="center">
148-
<img src="https://github.com/robmarkcole/HASS-Deepstack-object/blob/master/docs/media_player.png" width="750">
149-
150-
<small>(Image courtesy of Robin Cole, and uses his original Deepstack implementation)</small>
151-
</p>
134+
And configure CodeProject.AI Server to use the above directory for `save_file_folder`, then saved images can be browsed from the HA front end.
152135

153136
## Face recognition
154137
For face recognition with CodeProject.AI Server use https://github.com/codeproject/CodeProject.AI-HomeAssist-FaceDetect
@@ -159,26 +142,6 @@ For face recognition with CodeProject.AI Server use https://github.com/codeproje
159142
- For bugs and suggestions related to CodeProject.AI Server, please use the [CodeProject.AI forum](https://www.codeproject.com/Feature/CodeProjectAI-Discussions.aspx).
160143
- For general chat or to discuss Home Assistant specific issues related to configuration or use cases, please [use the Home Assistant forums](https://community.home-assistant.io/).
161144

162-
### Docker tips
163-
164-
Please view the [CodeProject.AI Server docs](https://www.codeproject.com/AI/docs/why/running_in_docker.html)
165-
Add the `-d` flag to run the container in background
166-
167-
### FAQ
168-
Q1: I get the following warning, is this normal?
169-
```
170-
2019-01-15 06:37:52 WARNING (MainThread) [homeassistant.loader] You are using a custom component for image_processing.codeproject_ai_face which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
171-
```
172-
A1: Yes this is normal
173-
174-
------
175-
176-
Q6: I am getting an error from Home Assistant: `Platform error: image_processing - Integration codeproject_ai_object not found`
177-
178-
A6: This can happen when you are running in Docker/Hassio, and indicates that one of the dependencies isn't installed. It is necessary to reboot your Hassio device, or rebuild your Docker container. Note that just restarting Home Assistant will not resolve this.
179-
180-
------
181-
182145
## Objects
183146
The following lists all valid target object names:
184147
```
@@ -206,15 +169,3 @@ Currently only the helper functions are tested, using pytest.
206169
* `source venv/bin/activate`
207170
* `pip install -r requirements-dev.txt`
208171
* `venv/bin/py.test custom_components/codeproject_ai_object/tests.py -vv -p no:warnings`
209-
210-
## Videos of usage
211-
212-
Robin Cole has a series of videos using Deepstack with Home Asssistant which may provide some assistance.
213-
214-
Checkout this excellent video of usage from [Everything Smart Home](https://www.youtube.com/channel/UCrVLgIniVg6jW38uVqDRIiQ)
215-
216-
[![](http://img.youtube.com/vi/vMdpLiAB9dI/0.jpg)](http://www.youtube.com/watch?v=vMdpLiAB9dI "")
217-
218-
Also see the video of a presentation I did to the [IceVision](https://airctic.com/) community on deploying Deepstack on a Jetson nano.
219-
220-
[![](http://img.youtube.com/vi/1O0mCaA22fE/0.jpg)](http://www.youtube.com/watch?v=1O0mCaA22fE "")

0 commit comments

Comments
 (0)