New Custom Compontent - Image Processing - Object Detection - DOODS

It’s because you are not using a model designed for the edgeTPU. You need to download and configure it for the edgetpu model. (Just google for edgetpu models and you’ll find them)

I started using Doods, it works. But when i wanne install this with a volume so i can use my Corel it give me errors. I filled the example file with the standerd setup, but i dont now witch models i have to use?

docker run -it --device /dev/bus/usb -v /volume1/docker/Doods/Models:/opt/doods/models -v /volume1/docker/Doods/example.yaml:/opt/doods/config.yaml -p 8080:8080 snowzach/doods:latest
ERROR: Could not open 'models/coco_ssd_mobilenet_v1_1.0_quant.tflite'.
ERROR: The model is not a valid Flatbuffer file
2019-11-10T13:45:12.203Z        ERROR   detector/detector.go:71 Could not initialize detector default: could not load model models/coco_ssd_mobilenet_v1_1.0_quant.tflite       {"package": "detector"}
2019-11-10T13:45:12.203Z        FATAL   detector/detector.go:81 No detectors configured {"package": "detector"}

Hi! I have a problem with DOODS + Coral TPU. The main problem that i dont have “/dev/bus/usb” folder.
I have many folders there, but not “bus”. After plugging Coral into PC i have new file “/dev/usbdev2.5”.

I’ve tried to map ‘/sys/bus/usb/devices/2-2’ folder(this is exactly Coral TPU) but DOODS logs are saying:

ERROR detector/detector.go:71 Could not initialize detector default: could not initialize edgetpu /sys/bus/usb/devices/2-2 {“package”: “detector”}

I’m using Asustor NAS 6204T (x64 Intel CPU). Deconz Conbee USB Stick perfectly works there through ‘/dev/ttyACM0’.

thanks for the tip, i have now gotten 2 edgetpu.tflite from google.

mobilenet_ssd_v1_coco_quant_postprocess_edgetpu.tflite
mobilenet_ssd_v2_coco_quant_postprocess_edgetpu.tflite

both seems to load fine, because im getting this msg

doods    | 2019-11-10T20:20:59.123+0100 INFO    detector/detector.go:76 Configured Detector     {"package": "detector", "name": "default", "type": "tflite-edgetpu", "model": "models/mobilenet_ssd_v2_coco_quant_postprocess_edgetpu.tflite", "labels": 80, "width": 300, "height": 300}

but when i i need to do detection on incoming pictures, im getting status 408, seems like a timeout, any chance that i can enable debug on the docker container ?

doods    | 2019-11-10T20:23:46.805+0100 INFO    server/server.go:137    HTTP Request    {"status": 408, "took": 90.0897328, "request": "/detect", "method": "POST", "package": "server.request", "request-id": "fb33055bae16/DLJ3jgjctp-000001", "remote": "192.168.1.10:36692"}
doods    | 2019-11-10T20:23:47.773+0100 INFO    server/server.go:137    HTTP Request    {"status": 408, "took": 90.083287224, "request": "/detect", "method": "POST", "package": "server.request", "request-id": "fb33055bae16/DLJ3jgjctp-000002", "remote": "192.168.1.10:36694"}
doods    | 2019-11-10T20:23:51.836+0100 INFO    server/server.go:137    HTTP Request    {"status": 408, "took": 90.088504908, "request": "/detect", "method": "POST", "package": "server.request", "request-id": "fb33055bae16/DLJ3jgjctp-000003", "remote": "192.168.1.10:36700"}
doods    | 2019-11-10T20:23:54.007+0100 INFO    server/server.go:137    HTTP Request    {"status": 408, "took": 90.082303282, "request": "/detect", "method": "POST", "package": "server.request", "request-id": "fb33055bae16/DLJ3jgjctp-000004", "remote": "192.168.1.10:36702"}
doods    | 2019-11-10T20:23:54.085+0100 INFO    server/server.go:137    HTTP Request    {"status": 408, "took": 90.09071714, "request": "/detect", "method": "POST", "package": "server.request", "request-id": "fb33055bae16/DLJ3jgjctp-000005", "remote": "192.168.1.10:36704"}

even with the

echo "{\"detector_name\":\"default\", \"detect\":{\"*\":60}, \"data\":\"`cat grace_hopper.png|base64 -w0`\"}" > /tmp/postdata.json && curl -d@/tmp/postdata.json -H "Content-Type: application/json" -X POST http://localhost:8080/detect

im getting the same error, i’ve test the stick with google coral guide and it work fine here :confused:

Rene, get the edgetpu files from google:

https://coral.withgoogle.com/models/

go for one of these 2:

get both the edge tpu model file and labels file, wget on the host running DOODS, and edit the config.yaml something like this:

doods:
  detectors:
    - name: default
      type: tflite
      modelFile: models/mobilenet_ssd_v2_coco_quant_postprocess_edgetpu.tflite
      labelFile: models/coco_labels.txt
      numThreads: 4
      numConcurrent: 4
      hwAccel: true

start your docker with the normal one liner or docker-compose
im using docker-compose:

services:
  doods:
    image: snowzach/doods:latest
    container_name: doods
    restart: unless-stopped
    environment:
      - TZ=Europe/Copenhagen
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /root/docker/doods/data/models:/opt/doods/models
      - /root/docker/doods/config.yaml:/opt/doods/config.yaml
    devices:
      - /dev/bus/usb:/dev/bus/usb
    ports:
      - "8080:8080"

depends on your hardware, but im running my docker on i5 NUC, if you using PI, be aware about numThreds and numConcurrent

1 Like

I have all but one camera setup in Hass with onvif component. The other is generic using jpeg url. Neither seem to work when I switch to use tensorflow as the detector. Processing works as expected (though lots of false detections) with default detector.

On default detector, if I implement a confidence score over 40% people are regularly missed, which is why I was trying to figure out how to implement the tensorflow and see if it worked better but based on the logs I’m seeing, the images are being passed, but it looks like the tensorflow detector can’t make sense of it.

Is there a reason why the default would work and tensorflow wouldn’t? Isn’t it the same mechanism doing the conversion, just the only difference being the model it’s comparing against?

Looks like i instald this correct but it won’t recgonize the coral, i’m running docker on an Synology 218+, INTEL Celeron J3355. The Synology finds an usb device

[51810.574800] usb 1-1.2: new full-speed USB device number 19 using xhci_hcd
[51810.686800] ftdi_sio 1-1.2:1.0: FTDI USB Serial Device converter detected
[51810.695520] usb 1-1.2: Detected FT232RL
[51810.700260] usb 1-1.2: FTDI USB Serial Device converter now attached to ttyUSB0
[51810.899831] usb 1-1.4: new high-speed USB device number 20 using xhci_hcd
[51811.007521] Got empty serial number. Generate serial number from product.
[51811.016018] drivers/usb/core/hub.c (2850) Same device found. Change serial to ffffffd1ffffffb2ffffffdbffffffa0

docker run -it --device /dev/bus/usb -v /volume1/docker/Doods/Models:/opt/doods/models -v /volume1/docker/Doods/example.yaml:/opt/doods/config.yaml -v /etc/localtime:/etc/localtime:ro -e TZ=Europe/Amsterdam -p 8080:8080 snowzach/doods:latest
2019-11-11T21:12:47.191+0100 ERROR detector/detector.go:71 Could not initialize detector default: could not initialize edgetpu /sys/bus/usb/devices/2-3 {“package”: “detector”}
2019-11-11T21:12:47.275+0100 FATAL detector/detector.go:81 No detectors configured {“package”: “detector”}

Any idea?

what does the lsusb say?

Every ~24 hours or so I get

“2019-11-11T23:05:24.695+0200 INFO server/server.go:137 HTTP Request {“status”: 408, “took”: 90.053634088, “request”: “/detect”, “method”: “POST”, “package”: “server.request”, “request-id”: “d5f40609-doods.local.hass.io/CXC1ZLoEld-015006”, “remote”: “172.30.32.1:33198”}”

Is there a way to restart the Hassio add-on automatically?

Hey @Bogdan_Mazurenko I am not really sure there. I wonder if your kernel is too old for the EdgeTPU to work. It actually looks like it does detect the device because it sees it under /sys/bu/usb/devices/2-2… Maybe try just --device /sys/bus/usb and see if that works? The other thing you could try is just using the --privileged option. That will basically allow doods root access.

@nic0dk Something is off there. It should only take less than a second to do the detection with that model. Curl is the one timing out. You could increase the time there but I doubt that is the issue. Try using the --privileged option on the docker container and see if that helps maybe?

1 Like

@champ26 it looks like the image decoder does not understand how many channels are in the image. Are you able to tell me? It assumes there are 3 channels (RGB) but maybe there is an Alpha channel included in the image and I am not properly handling that.

@reneeetje can you try stopping and starting doods again? I have noticed that the edgetpu renames itself the first time you start doods. If that doesn’t work, try starting it with --privileged and see if that helps.

@ros is this a tflite detector or tensorflow?

thx for the fast reply - tried with --privileged in docker-compose mode:

---
version: "3"
services:
  doods:
    privileged: true
    image: snowzach/doods:latest
    container_name: doods
    restart: unless-stopped
    environment:
      - TZ=Europe/Copenhagen
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /root/docker/doods/data/models:/opt/doods/models
      - /root/docker/doods/config.yaml:/opt/doods/config.yaml
    devices:
      - /dev/bus/usb:/dev/bus/usb
    ports:
      - "8080:8080"
docker-compose.yaml (END)

but are still getting the “timeouts” 408 :frowning: just for you info, i can see the edgetpu is flashing, so it doing some kind of load:

doods    | 2019-11-12T15:09:16.173+0100	INFO	detector/detector.go:76	Configured Detector	{"package": "detector", "name": "default", "type": "tflite-edgetpu", "model": "models/mobilenet_ssd_v2_coco_quant_postprocess_edgetpu.tflite", "labels": 80, "width": 300, "height": 300}
doods    | 2019-11-12T15:09:16.178+0100	INFO	server/server.go:273	API Listening	{"package": "server", "address": ":8080", "tls": false}
doods    | 2019-11-12T15:10:29.549+0100	INFO	server/server.go:137	HTTP Request	{"status": 408, "took": 14.438229225, "request": "/detect", "method": "POST", "package": "server.request", "request-id": "f61e96ee029a/EanHpFBzMc-000001", "remote": "172.21.0.1:42886"}
doods    | 2019-11-12T15:12:55.760+0100	INFO	server/server.go:137	HTTP Request	{"status": 408, "took": 90.086086374, "request": "/detect", "method": "POST", "package": "server.request", "request-id": "f61e96ee029a/EanHpFBzMc-000002", "remote": "192.168.1.10:35442"}
doods    | 2019-11-12T15:12:58.895+0100	INFO	server/server.go:137	HTTP Request	{"status": 408, "took": 90.074436491, "request": "/detect", "method": "POST", "package": "server.request", "request-id": "f61e96ee029a/EanHpFBzMc-000003", "remote": "192.168.1.10:35448"}
doods    | 2019-11-12T15:12:59.804+0100	INFO	server/server.go:137	HTTP Request	{"status": 408, "took": 90.060866307, "request": "/detect", "method": "POST", "package": "server.request", "request-id": "f61e96ee029a/EanHpFBzMc-000004", "remote": "192.168.1.10:35452"}
doods    | 2019-11-12T15:13:01.168+0100	INFO	server/server.go:137	HTTP Request	{"status": 408, "took": 90.087273484, "request": "/detect", "method": "POST", "package": "server.request", "request-id": "f61e96ee029a/EanHpFBzMc-000005", "remote": "192.168.1.10:35456"}
doods    | 2019-11-12T15:13:01.331+0100	INFO	server/server.go:137	HTTP Request	{"status": 408, "took": 90.065343961, "request": "/detect", "method": "POST", "package": "server.request", "request-id": "f61e96ee029a/EanHpFBzMc-000006", "remote": "192.168.1.10:35458"}

@nic0dk do you think it’s possible you have some sort of power issue? Is it plugged into a USB 3.0 port?

thats correct - i did test it with google’s model python test, and working fine, i can also run up blakeblackshear’s frigate to test it out (was using it before DOODS) :slight_smile:

It is a tflite detector

1 Like

yes there are alpha channels. but would this be different between the different detectors though? isn’t the image decoder the same for both detectors?

i repluged the coral in the Synology
dmesg:

[131370.363012] usb 2-3: new SuperSpeed USB device number 5 using xhci_hcd
[131370.387698] Got empty serial number. Generate serial number from product.
[131370.395597] drivers/usb/core/hub.c (2850) Same device found. Change serial to ffffffd1ffffffb2ffffffdbffffffa
lsusb:
hub
|__2-3 1a6e:089a:0100 00 3.10 5000MBit/s 896mA 1IF ( ffffffd1ffffffb2ffffffdbffffffa0)

ok im getting a bit confused.
getting a bit closer, after adjusting numThreads to 0 and letting numConcurrent stay at 4, it seems to work for about 5-8 mins.
i tried to tweak up and down on numConcurrent could all of them crash after some time! any ideas?

in the last end i returned to default settings:

      numThreads: 4
      numConcurrent: 4 

but again, the same behavior :frowning:

looked like every time i restart docker container, it gives me a few mins run?

1 Like

Will doods integration Not Start if Doods Server is offline when integration starting?

What happen if reboot Doods Server while HA/Doods Integration running?

What happen if restart HA but not restart Doods server? I