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

Commit 5060ad1

Browse files
authored
Merge pull request #192 from robmarkcole/issue-190
Allow setting object_type as target
2 parents 930ca57 + 340cf6f commit 5060ad1

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ image_processing:
3535
roi_y_max: 0.8
3636
targets:
3737
- person
38-
- car
39-
- mask
38+
- vehicle
39+
- dog
4040
source:
4141
- entity_id: camera.local_file
4242
```
@@ -55,7 +55,7 @@ Configuration variables:
5555
- **roi_y_min**: (optional, default 0), range 0-1, must be less than roi_y_max
5656
- **roi_y_max**: (optional, default 1), range 0-1, must be more than roi_y_min
5757
- **source**: Must be a camera.
58-
- **targets**: The list of target objects, default `person`.
58+
- **targets**: The list of target object names and/or `object_type`, default `person`.
5959
- **confidence**: (Optional) The confidence (in %) above which detected targets are counted in the sensor state. Default value: 80
6060

6161
For the ROI, the (x=0,y=0) position is the top left pixel of the image, and the (x=1,y=1) position is the bottom right pixel of the image. It might seem a bit odd to have y running from top to bottom of the image, but that is the coordinate system used by pillow.
@@ -76,7 +76,7 @@ An event `deepstack.object_detected` is fired for each object detected above the
7676
An example use case for event is to get an alert when some rarely appearing object is detected, or to increment a [counter](https://www.home-assistant.io/components/counter/). The `deepstack.object_detected` event payload includes:
7777

7878
- `entity_id` : the entity id responsible for the event
79-
- `name` : the name of the type of object detected
79+
- `name` : the name of the object detected
8080
- `object_type` : the type of the object, from `person`, `vehicle`, `animal` or `other`
8181
- `confidence` : the confidence in detection in the range 0 - 100%
8282
- `box` : the bounding box of the object
@@ -172,7 +172,7 @@ A6: This can happen when you are running in Docker/Hassio, and indicates that on
172172
------
173173

174174
## Objects
175-
The following lists all target objects:
175+
The following lists all valid target object names:
176176
```
177177
person, bicycle, car, motorcycle, airplane,
178178
bus, train, truck, boat, traffic light, fire hydrant, stop_sign,

custom_components/deepstack_object/image_processing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ def process_image(self, image):
304304
self._targets_found = [
305305
obj
306306
for obj in self._objects
307-
if (obj["name"] in self._targets)
307+
if (obj["name"] or obj["object_type"] in self._targets)
308308
and (obj["confidence"] > self._confidence)
309309
and (object_in_roi(self._roi_dict, obj["centroid"]))
310310
]

0 commit comments

Comments
 (0)