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

Commit

Permalink
Merge pull request #192 from robmarkcole/issue-190
Browse files Browse the repository at this point in the history
Allow setting object_type as target
  • Loading branch information
robmarkcole authored Jan 13, 2021
2 parents 930ca57 + 340cf6f commit 5060ad1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ image_processing:
roi_y_max: 0.8
targets:
- person
- car
- mask
- vehicle
- dog
source:
- entity_id: camera.local_file
```
Expand All @@ -55,7 +55,7 @@ Configuration variables:
- **roi_y_min**: (optional, default 0), range 0-1, must be less than roi_y_max
- **roi_y_max**: (optional, default 1), range 0-1, must be more than roi_y_min
- **source**: Must be a camera.
- **targets**: The list of target objects, default `person`.
- **targets**: The list of target object names and/or `object_type`, default `person`.
- **confidence**: (Optional) The confidence (in %) above which detected targets are counted in the sensor state. Default value: 80

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.
Expand All @@ -76,7 +76,7 @@ An event `deepstack.object_detected` is fired for each object detected above the
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:

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

## Objects
The following lists all target objects:
The following lists all valid target object names:
```
person, bicycle, car, motorcycle, airplane,
bus, train, truck, boat, traffic light, fire hydrant, stop_sign,
Expand Down
2 changes: 1 addition & 1 deletion custom_components/deepstack_object/image_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ def process_image(self, image):
self._targets_found = [
obj
for obj in self._objects
if (obj["name"] in self._targets)
if (obj["name"] or obj["object_type"] in self._targets)
and (obj["confidence"] > self._confidence)
and (object_in_roi(self._roi_dict, obj["centroid"]))
]
Expand Down

0 comments on commit 5060ad1

Please sign in to comment.