DOODS
The doods
image processing platform allows you to detect and recognize objects in a camera image using DOODS. The state of the entity is the number of objects detected, and recognized objects are listed in the summary
attribute along with quantity. The matches
attribute provides the confidence score
for recognition and the bounding box
of the object for each detection category.
Setup
You need to have DOODS running somewhere. It’s easiest to run as a docker container and deployment is described on docker hub DOODS - Docker
Configuration
The configuration loosely follows the tensorflow configuration. To enable this platform in your installation, add the following to your configuration.yaml
file:
# Example configuration.yaml entry
image_processing:
- platform: doods
url: "http://<my doods server>:8080"
detector: default
source:
- entity_id: camera.front_yard
Configuration Variables
- source
(map)(Required)
The list of image sources.
- url
(string)(Required)
The URL of the DOODS server
- timeout
-
(integer)(Optional)
Timeout for requests (in seconds)
Default value:
90
- detector
(string)(Required)
The DOODS detector to use
- confidence
(float)(Optional)
The default confidence for any detected objects where not explicitly set
- area
(map)(Optional)
Global detection area. Objects in this box will be reported. Top of image is 0, bottom is 1. Same left to right.
- top
-
(float)(Optional)
Top line defined as % from top of image.
Default value:
0
- left
-
(float)(Optional)
Left line defined as % from left of image.
Default value:
0
- bottom
-
(float)(Optional)
Bottom line defined as % from top of image.
Default value:
1
- right
-
(float)(Optional)
Right line defined as % from left of image.
Default value:
1
- covers
-
(boolean)(Optional)
If true the detection must be fully in this box. If false any part of the detection in the box will trigger.
Default value:
true
- file_out
(list)(Optional)
A template for the integration to save processed images including bounding boxes.
camera_entity
is available as theentity_id
string of the triggered source camera.- labels
(map)(Optional)
Information about the selected labels model.
- name
(string)(Required)
The label of the object to select for detection.
- confidence
(float)(Optional)
The minimum confidence for the selected label
- area
(map)(Optional)
Custom detection area. Only objects fully in this box will be reported. Top of image is 0, bottom is 1. Same left to right.
- top
-
(float)(Optional)
Top line defined as % from top of image.
Default value:
0
- left
-
(float)(Optional)
Left line defined as % from left of image.
Default value:
0
- bottom
-
(float)(Optional)
Bottom line defined as % from top of image.
Default value:
1
- right
-
(float)(Optional)
Right line defined as % from left of image.
Default value:
1
- covers
-
(boolean)(Optional)
If true the detection must be fully in this box. If false any part of the detection in the box will trigger.
Default value:
true
# Example advanced configuration.yaml entry
# Example configuration.yaml entry
image_processing:
- platform: doods
scan_interval: 1000
url: "http://<my doods server>:8080"
timeout: 60
detector: default
source:
- entity_id: camera.front_yard
file_out:
- "/tmp/{{ camera_entity.split('.')[1] }}_latest.jpg"
- "/tmp/{{ camera_entity.split('.')[1] }}_{{ now().strftime('%Y%m%d_%H%M%S') }}.jpg"
confidence: 50
# This global detection area is required for all labels
area:
# Exclude top 10% of image
top: 0.1
# Exclude right 5% of image
right: 0.95
# The entire detection must be inside this box
covers: true
labels:
- name: person
confidence: 40
area:
# Exclude top 10% of image
top: 0.1
# Exclude right 15% of image
right: 0.85
# Any part of the detection inside this area will trigger
covers: false
- car
- truck
Optimizing resources
Image processing components process the image from a camera at a fixed period given by the scan_interval
. This leads to excessive processing if the image on the camera hasn’t changed, as the default scan_interval
is 10 seconds. You can override this by adding to your config scan_interval: 10000
(setting the interval to 10,000 seconds), and then call the image_processing.scan
service when you actually want to perform processing.
# Example advanced configuration.yaml entry
image_processing:
- platform: doods
scan_interval: 10000
source:
- entity_id: camera.driveway
- entity_id: camera.backyard
# Example advanced automations.yaml entry
- alias: Doods scanning
trigger:
- platform: state
entity_id:
- binary_sensor.driveway
action:
- service: image_processing.scan
entity_id: camera.driveway