New Custom Compontent - Image Processing - Object Detection - DOODS

If you go to the link in the first post that says source for server is here and scroll down to the bottom of that page it says how to enable cuda support. I have yet to try it, but will as soon as I have time.

hello
i have a problem installing doods on hassio. i get the following message in the logs

Protokolldetails ( ERROR )
Logger: homeassistant.components.image_processing
Source: custom_components/doods/image_processing.py:100
Integration: Bildverarbeitung (documentation, issues)
First occurred: 21:52:18 (1 occurrences)
Last logged: 21:52:18

Error while setting up doods platform for image_processing
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 160, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 84, in create_connection
    raise err
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 74, in create_connection
    sock.connect(sa)
OSError: [Errno 113] Host is unreachable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 677, in urlopen
    chunked=chunked,
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 392, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/local/lib/python3.7/http/client.py", line 1252, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1298, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1247, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/usr/local/lib/python3.7/http/client.py", line 966, in send
    self.connect()
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 187, in connect
    conn = self._new_conn()
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 172, in _new_conn
    self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0xa893d7d0>: Failed to establish a new connection: [Errno 113] Host is unreachable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 725, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/retry.py", line 439, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='192.168.178.153', port=8080): Max retries exceeded with url: /detectors (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0xa893d7d0>: Failed to establish a new connection: [Errno 113] Host is unreachable'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 178, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/doods/image_processing.py", line 100, in setup_platform
    doods = PyDOODS(url, auth_key, timeout)
  File "/usr/local/lib/python3.7/site-packages/pydoods/__init__.py", line 13, in __init__
    self.get_detectors()
  File "/usr/local/lib/python3.7/site-packages/pydoods/__init__.py", line 20, in get_detectors
    response = requests.get(self.url + "/detectors", **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 76, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='192.168.178.153', port=8080): Max retries exceeded with url: /detectors (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0xa893d7d0>: Failed to establish a new connection: [Errno 113] Host is unreachable'))

whats the problem?

It can’t reach your Doods add-on. Check the settings you used in HA, and that your add-on is running.

thanks. now its running

then i changed from default to inception and now i have these error.

Protokolldetails ( ERROR )
Logger: homeassistant.components.image_processing
Source: custom_components/doods/image_processing.py:100
Integration: Bildverarbeitung (documentation, issues)
First occurred: 18:06:50 (1 occurrences)
Last logged: 18:06:50

Error while setting up doods platform for image_processing
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 160, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 84, in create_connection
    raise err
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 74, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 677, in urlopen
    chunked=chunked,
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 392, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/local/lib/python3.7/http/client.py", line 1252, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1298, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1247, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/usr/local/lib/python3.7/http/client.py", line 966, in send
    self.connect()
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 187, in connect
    conn = self._new_conn()
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 172, in _new_conn
    self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0xa8a74cb0>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 725, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/retry.py", line 439, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=8080): Max retries exceeded with url: /detectors (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0xa8a74cb0>: Failed to establish a new connection: [Errno 111] Connection refused'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 178, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/doods/image_processing.py", line 100, in setup_platform
    doods = PyDOODS(url, auth_key, timeout)
  File "/usr/local/lib/python3.7/site-packages/pydoods/__init__.py", line 13, in __init__
    self.get_detectors()
  File "/usr/local/lib/python3.7/site-packages/pydoods/__init__.py", line 20, in get_detectors
    response = requests.get(self.url + "/detectors", **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 76, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=8080): Max retries exceeded with url: /detectors (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0xa8a74cb0>: Failed to establish a new connection: [Errno 111] Connection refused'))

this is my configuration.yaml

# Example advanced configuration.yaml entry
image_processing:
  - platform: doods
    scan_interval: 20
    url: "http://127.0.0.1:8080"
    timeout: 60
    detector: inception
    source:
      - entity_id: camera.entenkamera
    file_out:
      - "/config/www/doods/{{ camera_entity.split('.')[1] }}_latest.jpg"
      - "/config/www/doods/{{ camera_entity.split('.')[1] }}_{{ now().strftime('%Y%m%d_%H%M%S') }}.jpg"
    labels:
      - name: person
      - name: horse
      - name: bird

and this is the add-on config:

server:
  port: '8080'
auth_key: ''
doods.detectors:
  - name: default
    type: tflite
    modelFile: /opt/doods/models/coco_ssd_mobilenet_v1_1.0_quant.tflite
    labelFile: /opt/doods/models/coco_labels0.txt
    numThreads: 1
    numConcurrent: 1
    hwAccel: false
  - name: inception
    type: tensorflow
    modelFile: /share/doods/faster_rcnn_inception_v2_coco_2018_01_28.pb
    labelFile: /share/doods/coco_labels1.txt
    numThreads: 1
    numConcurrent: 1
    hwAccel: false

what is wrong??

If I were you I’d try to change the url to the actual IP address of the host rather than the 127.0.0.1.

ok thanks i changed it. but after starting Doods it shuts down after few minute with this errors :frowning:

Protokolldetails ( ERROR )
Logger: homeassistant.helpers.entity
Source: components/doods/image_processing.py:294
First occurred: 17:19:12 (1 occurrences)
Last logged: 17:19:12

Update for image_processing.doods_yicam fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 426, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 421, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/lib/python3.7/http/client.py", line 1344, in getresponse
    response.begin()
  File "/usr/local/lib/python3.7/http/client.py", line 306, in begin
    version, status, reason = self._read_status()
  File "/usr/local/lib/python3.7/http/client.py", line 267, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/local/lib/python3.7/socket.py", line 589, in readinto
    return self._sock.recv_into(b)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 725, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/retry.py", line 403, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/usr/local/lib/python3.7/site-packages/urllib3/packages/six.py", line 735, in reraise
    raise value
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 677, in urlopen
    chunked=chunked,
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 428, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 336, in _raise_timeout
    self, url, "Read timed out. (read timeout=%s)" % timeout_value
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='192.168.1.107', port=8080): Read timed out. (read timeout=60)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 272, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 463, in async_device_update
    await self.async_update()  # type: ignore
  File "/usr/src/homeassistant/homeassistant/components/image_processing/__init__.py", line 132, in async_update
    await self.async_process_image(image.content)
  File "/usr/src/homeassistant/homeassistant/components/image_processing/__init__.py", line 112, in async_process_image
    return await self.hass.async_add_job(self.process_image, image)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/doods/image_processing.py", line 294, in process_image
    image, dconfig=self._dconfig, detector_name=self._detector_name
  File "/usr/local/lib/python3.7/site-packages/pydoods/__init__.py", line 30, in detect
    self.url + "/detect", json={"data": PyDOODS.encode_image(image), "detector_name": detector_name, "detect": dconfig, "id": id}, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 119, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 529, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPConnectionPool(host='192.168.1.107', port=8080): Read timed out. (read timeout=60)

this is the log of doods

2020-07-15T17:33:10.424+0200	INFO	detector/detector.go:78	Configured Detector	{"package": "detector", "name": "tensorflow", "type": "tensorflow", "model": "/share/faster_rcnn_inception_v2_coco_2018_01_28.pb", "labels": 65, "width": -1, "height": -1}
2020-07-15T17:33:10.458+0200	INFO	server/server.go:274	API Listening	{"package": "server", "address": ":8080", "tls": false, "version": "v0.2.1-0-g91828a0-dirty"}
2020-07-15T17:34:18.807+0200	INFO	server/server.go:138	HTTP Request	{"status": 200, "took": 0.034315815, "request": "/detectors", "method": "GET", "package": "server.request", "request-id": "d5f40609-doods/mBKJO2GG2P-000001", "remote": "192.168.1.107:50832"}
2020-07-15T17:34:18.918+0200	INFO	server/server.go:138	HTTP Request	{"status": 200, "took": 0.00540873, "request": "/detectors", "method": "GET", "package": "server.request", "request-id": "d5f40609-doods/mBKJO2GG2P-000002", "remote": "192.168.1.107:50834"}
2020-07-15T18:16:11.369+0200	INFO	detector/detector.go:78	Configured Detector	{"package": "detector", "name": "tensorflow", "type": "tensorflow", "model": "/share/faster_rcnn_inception_v2_coco_2018_01_28.pb", "labels": 65, "width": -1, "height": -1}
2020-07-15T18:16:11.452+0200	INFO	server/server.go:274	API Listening	{"package": "server", "address": ":8080", "tls": false, "version": "v0.2.1-0-g91828a0-dirty"}
2020-07-15 18:16:17.320144: W tensorflow/core/framework/cpu_allocator_impl.cc:81] Allocation of 6220800 exceeds 10% of free system memory.
2020-07-15 18:16:25.473950: W tensorflow/core/framework/cpu_allocator_impl.cc:81] Allocation of 1441792 exceeds 10% of free system memory.
2020-07-15 18:16:25.511402: W tensorflow/core/framework/cpu_allocator_impl.cc:81] Allocation of 786432 exceeds 10% of free system memory.
2020-07-15 18:16:25.526146: W tensorflow/core/framework/cpu_allocator_impl.cc:81] Allocation of 2211840 exceeds 10% of free system memory.
2020-07-15 18:16:25.565658: W tensorflow/core/framework/cpu_allocator_impl.cc:81] Allocation of 786432 exceeds 10% of free system memory.

My config looks similar except I removed the default detector completely.
So where you have:

server:
  port: '8080'
auth_key: ''
doods.detectors:
  - name: default
    type: tflite
    modelFile: /opt/doods/models/coco_ssd_mobilenet_v1_1.0_quant.tflite
    labelFile: /opt/doods/models/coco_labels0.txt
    numThreads: 1
    numConcurrent: 1
    hwAccel: false
  - name: inception
    type: tensorflow
    modelFile: /share/doods/faster_rcnn_inception_v2_coco_2018_01_28.pb
    labelFile: /share/doods/coco_labels1.txt
    numThreads: 1
    numConcurrent: 1
    hwAccel: false

I have:

server:
  port: '8080'
auth_key: ''
doods.detectors:
    - name: inception
    type: tensorflow
    modelFile: /share/doods/faster_rcnn_inception_v2_coco_2018_01_28.pb
    labelFile: /share/doods/coco_labels1.txt
    numThreads: 1
    numConcurrent: 1
    hwAccel: false

Don’t know if it matters or not. Just noticed it.

Wow this is an awesome add-on, it works so well, is it possible to use it for OCR?

interesting!! what type of detector was that? tensorflow or tflite? tensorflow can not go that wrong so must be tflite. right?

Tensorflow can most definitely go that wrong!
In the last week I’ve had a deer be identified as a person and a reflection that looks like a wavy horizontal line of fog. A while ago a bird flew in close to my cam and the snapshot caught it with wings open and it said person.

Did anyone tried using any of mobilenet_v2 models with success? I can’t get them working.
Inception model is too heavy for my current setup while coco_ssd_mobilenet_v1_1.0_quant_2018_06_29 seems to be a little bit too inaccurate. So I’m looking for something a little more accurate.

{
      "name": "inception",
      "type": "tensorflow",
      "modelFile": "/share/doods/faster_rcnn_inception_v2_coco_2018_01_28.pb",
      "labelFile": "/share/doods/coco_labels1.txt",
      "numThreads": 1,
      "numConcurrent": 1,
      "hwAccel": false

Thank you, super easy to switch from Tensorflow component. Your work is appreciated.

Did you find any improvements in speed when scanning the snapshots instead of the stream? I’ve been pretty pleased with it not missing people on my main front cameras but I still store snapshots of all motion regardless of person but only get notified when a person is detected. It would be nice to shave a second or two off the response time

I still get many false detection with tensorflow type, can we use other libraries, like these: https://github.com/tensorflow/models/blob/e54fcee236a1258302342bd703ee27cbba0c12e3/research/object_detection/g3doc/tf2_detection_zoo.md ? I had with tensorflow faster_rcnn_inception_v2_coco model, but had better detection.
But it is a very good component for HA, easy to use!

Great question. I just tried this yesterday and couldn’t get it to work. I probably missed something simple though.
I’ll have to sit down and try again.

I’m using the V2 edgetpu coco model with a coral on a pi4. Detection times are in the 0.01 to 0.02 sec range, but i can’t say it is any more accurate. It is convinced my weber grill and my neighbor’s super beetle are people.

Nonetheless, i love this thing. What a cool integration. I have it setup run through like five detections when my hikvision cams trigger on motion. I put a cool down in there to keep it from running away from me, but all in all, the pi handles it like a champ.

Edit: per how i got it working, i simply downloaded the model and labels files, then made sure to bind them to the container:

One thing i’ve noticed since switching to the coral: when i restart the pi, the doods container bugs out and responds to each service call with a 404. From the logs it looks like it is because it can’t find the coral. A restart of the container and it is back up and running.

Anyone else see this?

Hi,

@snowzach: i really like doods & the way you packaged!

  • works out of the box
  • REST API + pydoods allows testing, e.g. model performance
  • (somewhat) good documented samples how to get it working

I have it running, meanwhile with edgeTPU (dump idea) - still some questions:

  • for permanent monitoring a scan_interval =1 or smaller will require HW acceleration (or a weak model)
  • Coral Edge TPU doesn’t seem worth its money for this. Its very quick, but snowzach is right - its just to unreliable with the models supported
  • Trigger doods based on cam motion alert - start detection / recording - I don’t see how that would work, as its involving doods ‘after the fact’ only?
  • I’m imagining a 24/7 stream detection as alternative (also would make a nice showcase) - anybody went down that path? I know its going to lean heavy on the HW.
  • Nvidia GPU acceleration feels like best model support. Anybody has that running with a ‘budget’ card?
  • faster_rcnn_inception_v2_coco seems to have better detection - but is in the 15s+ on my j4105 CPU
  • Doods doesn’t take rtsp streams - only still images, right?

Would be very cool to move the ‘draw rectangle’ function into the container. That would allow easy testing of models via RESTApi. Alternativly a pydoods sample on how to test & draw the resulting rectangles in python afterwards might be nice.
Do you accept contributions?

Where I’m coming from:

  • Couple of foscam & new reolink around the house
  • Motion detection of cameras to FTP
  • Postprocessing with OpenCv: compare n-1 + n image, convert both to b&w, highlight brightness differences, define min / max rectange size, mask areas = filter down pictures by ~75%)
  • Tried to train custom model, liked Google Collabs, but the effort (per cam?) kills my available time. Models / code still seem to change

ItsMee

Posting some files as I always enjoy others showing stuff that works well for them.

Supersimple test - takes filename, returns result. Missing rectangle drawing:

cat /root/doods/test.py
#! /usr/bin/python3

from pydoods import PyDOODS
import sys
import json

try:
pd = PyDOODS(“http://192.168.177.75:8080”,
auth_key=“abc1234”, timeout=90)
except OSError as err:
print(“OS error: {0}”.format(err))
exit
#image = open(“grace_hopper.png”, “rb”).read()
image = open(sys.argv[1], “rb”).read()

dconfig={}
dconfig[“car”] = 20
dconfig[“person”] = 10

detector_name=“default”
result=pd.detect(image, dconfig, detector_name)
print(json.dumps(result, indent=2, sort_keys=True))

Dockerfile + docker-compose.yml

cat Dockerfile
FROM snowzach/doods:latest

RUN apt-get update && apt-get -y install vim
RUN wget https://raw.githubusercontent.com/snowzach/doods/master/fetch_models.sh
RUN . ./fetch_models.sh

docker-compose.yml

cat docker-compose.yml
version: ‘2.4’

services:
iot-homeassistant-doods:
container_name: iot-home-assistant-doods
image: iot-home-assistant-doods
build: ./

  volumes:
     - ./config/opt/doods/config.yaml:/opt/doods/config.yaml

  devices:
    - /dev/bus/usb:/dev/bus/usb
  privileged: true

  ports:
   - 8080:8080

  cpus: 2

@snowzach
I’ve got a silly question. What should I do to pass Coral accelerator to the DOODS docker (hass.io add-on) when I’m running it on HassOS?

I’m getting following error in DOODS add-on logs:

2020-08-08T16:11:38.348Z ERROR detector/detector.go:73 Could not initialize detector mobilenet: could not initialize edgetpu /sys/bus/usb/devices/2-4.1 {“package”: “detector”}

I’m running HassOS with DOODS add-on under PROXMOX VE with USB passthrough enabled.

EDIT:
Ok, I managed to set it up by passing not USB port but specific device to my VM. Sorry, for the hassle.

Anyways, I’m not sure how to make Hass.io add-on restart itself if it’s being stopped by detector timeout. I’m not sure why that happens to me almost instantly after it detects an object.
I’m using only ‘person’ label, one tflite EdgeTPU detector and one camera/image_processing integration.