Code Monkey home page Code Monkey logo

doods2's Introduction

DOODS2 - Return of DOODS

Dedicated Open Object Detection Service - Yes, it's a backronym...

DOODS is a REST service that detects objects in images or video streams. It's designed to be very easy to use, run as a container and available remotely. It also supports GPUs and EdgeTPU hardware acceleration.

DOODS2 is a rewrite of DOODS in Python. It supports the exact same REST api endpoints as the original DOODS but it also includes endpoints for handling streaming feeds with realtime feedback as annotated video and websocket JSON detection data.

Why Python you may ask... Well, lots of machine learning stuff is in Python and there is pretty good support for Object Detection and helpers in Python. Maintaining the code in Go was a huge pain. DOODS2 is designed to have a compatible API specification with DOODS as well as adding some additional features. It's my hope that in Python I might get a little more interest from the community in maintaining it and adding features.

DOODS2 drops support for gRPC as I doubt very much anyone used it anyways.

Quickstart in Docker

On your local machine run: docker run -it -p 8080:8080 snowzach/doods2:latest and open a browser to http://localhost:8080 Try uploading an image file or passing it an RTSP video stream. You can make changes to the specification by referencing the Detect Request payload.

Three detectors are included with the base image that you can try.

  • default - coco_ssd_mobilenet_v1_1.0_quant.tflite - A decent and fast Tensorflow light object detector.
  • tensorflow - faster_rcnn_inception_v2_coco_2018_01_28.pb - A much slower but more accurate Tensorflow object detector.
  • yolov5s - https://github.com/ultralytics/yolov5 yolo V5 model - A fast and accurate detector

Docker Images

DOODS2 is distributed in a docker image. There are several tags you can reference to pick the image you like.

  • armv7l - 32 bit ARM devices with a v7 CPU like the Raspberry Pi
    • Does not include PyTorch or Tensorflow Object Detection
  • aarch64 - 64 bit ARM devices with a v8 CPU (Raspberry Pi 64 bit, ODroid, etc)
    • Does not include PyTorch or Tensorflow Object Detection
  • noavx - 64 bit x86_64 architecture WITHOUT avx support. This should run on just about everything.
  • latest - The latest tag references the above 3 tags so if you pick latest it should work on just about everything.

Additional more optimized tags are available:

  • amd64 - 64 bit x86_64 architecture WITH avx support. This should be faster than the noavx image on newer processors.
  • amd64-gpu - 64 bit x86_64 architecture with NVidia GPU support. See the section below on how to run this.

REST API

The REST API has several endpoints for detecting objects in images as well as streams. Details of the payloads and endpoints are below.

DETECT REQUEST

Every request to DOODS involves the Detect Request JSON object that looks like this.

{
  // This ID field is user definable and will return the same ID that was passed in.
  "id": "whatever",
  // This is the name of the detector to be used for this detection. If not specified, 'default' will be used if it exists.
  "detector_name": "default",
  // Data is either base64 encoded image data for a single image, it may also be a URL to an image
  // For a stream it's expected to be a URL that can be read by ffmpeg. `rtsp://..` or `http://..` is typical.
  // You can also provide a video URL to detect a single image. It will grab a single frame from the source to 
  // run detection on. (It may be kinda slow though)
  "data": "b64 or url",
  // The image option determines, for API calls that return an image, what format the image should be.
  // Supported options currently are "jpeg" and "png"
  "image": "jpeg",
  // The throtle option determines, for streaming API calls only, how often it should return results
  // in seconds. For example, 5 means return 1 result about every 5 seconds. A value of 0 indicates
  // it should return results as fast as it can. 
  "throttle": 5,
  // Ths is an optional list of strings of preprocessing functions to apply to the images. Each supported
  // option is listed below.
  "preprocess": [
    // grayscale = changes the image to grayscale before processing  
    "grayscale"
  ],
  // detect is an object of label->confidence matches that will be applied to the entire image
  // The "*" for the label name indicates it can match any label. If a specific label is listed
  // then it cannot be matched by the wildcard. This example matches any label at 50% confidence
  // and only car if it's confidence is over 60%.
  "detect": {
    "*": 50,
    "car": 60
  },
  // The regions array is a list of specific matches for areas within your image/video stream.
  // When processing rules, the first detection rule to match wins. 
  "regions": [
    // The top,left,bottom and right are float values from 0..1 that indicate a bounding box to look
    // for object detections. They are based on the image size. A 400x300 image with a bounding box
    // as shown in the example blow would look for objects inside the box of
    // {top: 300*0.1 = 30, left: 400*0.1 = 40, bottom: 300*0.9 = 270, right: 400*0.9 = 360}
    // The detect field is exactly how it's described above in the global detection option for you
    // to specify the labels that you wish to match. 
    // The covers boolean indicates if this region must completely cover the detected object or 
    // not. If covers = true, then the detcted object must be completely inside of this region to match.
    // If covers = false than if any part of this object is inside of this region, it will match.
    // If defined, the optional id field will be included in detections that this region matched.  NOTE: 
    // only the first region (including the global detection) to match an object will be used.
    {"id": "someregion", "top": 0.1, "left": 0.1, "bottom": 0.9, "right": 0.9, "detect": {"*":50}, "covers": false}
    ...
  ],

  // NOTE: Below fields are only available in requests configured as part of the MQTT configuration

  // If separate_detections is true each detected object will be published separately into 
  // a sub-topic based on its type (e.g doods/detect/requestid/regionid/person).  When False, the default,
  // the whole DetectResponse object will be published to the request topic (e.g. doods/detect/requestid).
  "separate_detections" : false,
  // If crop is true and separate_detections is true requested images will be cropped to 
  // the decection box.  Has no effect if separate_detections is false.
  "crop": false,
  // If binary_images is true requested images will be pubished as binary data 
  // to a separate topic (e.g. doods/image/requestid) instead of base64 encoded into the response.
  "binary_images" : false,
}  

DETECT RESPONSE

{
  // This is the ID passed in the detect request.
  "id": "whatever",
  // If you specified a value for image in the detection request, this is the base64 encoded imge
  // returned from the detection. It has all of the detectons bounding boxes marked with label and 
  // confidence.
  "image": "b64 data...",
  // Detections is a list of all of the objects detected in the image after being passed through 
  // all of the filters. The top,left,bottom and right values are floats from 0..1 describing a 
  // bounding box of the object in the image. The label of the object and the confidence from 0..100
  // are also provided.
  "detections": [
    {"top": 0.1, "left": 0.1, "bottom": 0.9, "right": 0.9, "label": "dog", "confidence": 90.0 }
    ...
  ],
  // Any errors detected in the processing
  "error": "any errors"
}

API Endpoints

GET - /

If you just browse to the DOODS2 endpoint you will be presented with a very simple UI for testing and working with DOODS. It allows you to upload an image and test settings as well as kick off streaming video processes to monitor results in realtime as you tune your settings.

GET - /detectors

This API call returns the configured detectors on DOODS and includes the list of labels that each detector supports.

POST - /detect

This API call takes a JSON Detect Request in the POST body and returns a JSON Detect Response with the detections.

WS - /detect

This is a websocket endpoint that works exactly how the /detect API works except that you may send in many JSON Detect Request messages and it will process them asynchronously and return the responses. You should use unique id field values in the request to tell the responses apart.

POST /image

This API call takes a JSON Detect Request in the POST body and returns an image as specified in the image propert of the Detect Request with all of the bounding boxes drawn with labels and confidence. This is equivalent of calling the POST /detect endpoint but only returning the image rather than all of the detection information as well.

GET /stream?detect_request=

This endpoint takes a URL Encoded JSON Detect Request document as the detect_request query parameter. It expected the data value of the Detect Request to be a streaming video URL (like rtsp://...) It will connect to the stream and continuously process detections as fast as it can (or as dictated by the throttle parameter) and returns an MJPEG video stream suitable for viewing in most browsers. It's useful for testing.

WS /stream

This is a websocket endpoint where once connected expects you to send a single JSON Detect Request. In the request it's expected that the data parameter will be a streaming video URL (like rtsp://...) It will connect to the stream and continuously process detections as fast as it can (or as dictated by the throttle parameter). It will return JSON Detect Response every time it processes a frame. Additionally, if you specified a value for the image parameter, it will include the base64 encoded image in the image part of the response with the bounding boxes, labels and confidence marked.

Configuraton Format

DOODS requires a YAML configuration file to operate. There is a built in default configuration in the docker image that references built in default models. The configuration file looks like this by default.

server:
  host: 0.0.0.0
  port: 8080
  metrics: true
logging:
  level: info
doods:
  log: detections
  boxes:
    enabled: True
    boxColor: [0, 255, 0] # Or hex string "#00ff00"
    boxThickness: 1
    fontScale: 1.2
    fontColor: [0, 255, 0] # Or hex string "#00ff00"
    fontThickness: 1
  regions:
    enabled: True
    boxColor: [255, 0, 255] # Or hex string "#ff00ff"
    boxThickness: 1
    fontScale: 1.2
    fontColor: [255, 0, 255] # Or hex string "#ff00ff"
    fontThickness: 1
  globals:
    enabled: True
    fontScale: 1.2
    fontColor: [255, 255, 0] # Or hex string "#ffff00"
    fontThickness: 1
  detectors:
    - name: default
      type: tflite
      modelFile: models/coco_ssd_mobilenet_v1_1.0_quant.tflite
      labelFile: models/coco_labels0.txt
    - name: tensorflow
      type: tensorflow
      modelFile: models/faster_rcnn_inception_v2_coco_2018_01_28.pb
      labelFile: models/coco_labels1.txt
    - name: pytorch
      type: pytorch
      modelFile: ultralytics/yolov5,yolov5s
mqtt:
  

You can pass a new configuration file using an environment variable CONFIG_FILE. There is also a --config and -c command line option. for passing a configuration file. The environment variable takes precedences if set. Otherwise it defaults to looking for a config.yaml in the current directory.

Configuration options can also be set with environment variables using the value in all caps separated by underscore. For example you can set SERVER_HOST=127.0.0.1 to only listen on localhost. Setting the doods detectors must be done with a config file.

Server

This allows you to set the host and port the DOODS2 server listens on.

Logging

This lets you set the logging level of the server.

DOODS - log

This lets you set the logging of detections. detections - Log detections (default) all - Log ALL detections (before apply the filters for regions, labels, etc)

DOODS - boxes

The boxes allows you to set if, when requesting an image be returned, will the detections be drawn with bounding boxes. The defaults are shown above. You can disable the boxes as well as set the box color and line thickness. The color is specified as a 3 value list of RGB values. The font scale, thickness and color can be set seprately.

DOODS - regions, globals

This allows you to annotate returned images with the requested regions and global detection regions that you are scanning for in images. You could use this to debug and then disable them when you are done if you don't want to see them in your images.

CLI Example

Here's an example of how to call DOODS from the command line with a 1-Liner using curl with image data:

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

Another example 1-Liner specifying a region:

echo "{\"detector_name\":\"default\", \"regions\":[{\"top\":0,\"left\":0,\"bottom\":1,\"right\":1,\"detect\":{\"person\":40}}], \"data\":\"`cat grace_hopper.png|base64 -w0`\"}" > /tmp/postdata.json && curl -d@/tmp/postdata.json -H "Content-Type: application/json" -X POST http://localhost:8087/detect

EdgeTPU

DOODS2 supports the EdgeTPU hardware accelerator. This requires Tensorflow lite edgetpu.tflite models. In the config you need to set the hwAccel boolean to true for the model and it will load the edgeTPU driver and model. As well, you will need to pass the edgeTPU device to DOODS. This is typically done with the docker flag --device=/dev/bus/usb or in a docker-compose file with:

version: '3.2'
services:
  doods:
    image: snowzach/doods2:amd64-gpu
    ports:
      - "8080:8080"
    devices:
      - /dev/bus/usb

You can download models for the edgeTPU here: https://coral.ai/models/object-detection

GPU Support

NVidia GPU support is available in the :amd64-gpu tagged image. This requires the host machine have NVidia CUDA installed as well as Docker 19.03 and above with the nvidia-container-toolkit.

See this page on how to install the CUDA drives and the container toolkit: https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html

You need to tell docker to pass the GPU through for DOODS to use. You can do this with the docker run command by adding --gpus all to the command. You can also do this with docker-compose by adding this to the DOODS container specification:

version: '3.2'
services:
  doods:
    image: snowzach/doods2:amd64-gpu
    ports:
      - "8080:8080"
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities: [gpu]

Supported Detectors / Models

There are currently 5 supported dectector formats

  • tflite - Tensorflow lite .tflite models
  • tensorflow - Original tensoflow frozen models (Usually end with .pb)
  • pytorch - PyTorch based models like yolov5
  • deepstack - Deepstack models suppor
  • yolo - Ultralytics based models (yolo)
  • tensorflow2 - DISABLED - The libraries required were huge (2.2GB) and it was too slow to be useful for the time being.

Other Options

  • labelsStartFromZero: true - The labels file starts from index zero instead of 1 like most labels.

Tensorflow Lite - .tflite

Just download the file, make it available to dudes and put the path to the tflite model file in for the modelFile config option and the path to the text labelsFile in the config option. You can also set hwAccel if it's an edgetpu.tflite and of course you actually have a EdgeTPU connected.

Tensorflow Lite is the one type you can use the numThreads argument with and it will create a pool of tflite models for which to run detections. You can create as many as you want.

Tensorflow 1 - .pb

These are protobuf files that end in .pb. You just need to download them and usually un-tgz the archive and get the .pb file and provide it to DOODS along with the labels file.

There's a good list of these here: https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/tf1_detection_zoo.md

PyTorch - Automatically load from Torch Hub

This allows you to pull models directly from github using the torch.hub system. https://pytorch.org/docs/stable/hub.html

To configure these, for the model file specify the hub name and then the model separated by a comma. It will download and load the model.

Example: modelFile: ultralytics/yolov5,yolov5s

This is the PyTorch Hub https://pytorch.org/hub/ DOODS really only supports model detection models. All models may not work yet as I work out the shape of the detections.

If you want to cache the models that are downloaded, you can set the environment variables as below:

  • $TORCH_HOME/hub, if environment variable TORCH_HOME is set. (this will cache the models)
  • $XDG_CACHE_HOME/torch/hub, if environment variable XDG_CACHE_HOME is set. (this will cache the models and python modules)
  • The default is /root/.cache/torch

You can pass the enviroment variables using docker -e TORCH_HOME=/home/user/doods -v /home/user/doods:/data, this will cache the models to /data folder inside the docker container and to /home/user/doods in the host machine

More info here

Deepstack - PyTorch .pt files

Deepstack is a pretty slick system that works pretty similar to the way that DOODS operates. There are quite a few models that have been custom trained. There are some samples here: https://docs.deepstack.cc/custom-models-samples/ All you need to do is download the .pt files and list them as the model file in the config. The labels seems to be embedded.

If you receive a message that says No module named 'models.yolo' you are using a model that expects a very specific directory layout. You can fix the issue by downloading this file into your models directory adjacent to your model: https://raw.githubusercontent.com/johnolafenwa/deepstack-trainer/main/models/yolo.py This should resolve your issue.

YOLO - .pt files

Support for Ultralytics YOLO based models. Provide a .pt file as model file in the config. Labels are embedded.

Tensorflow 2 - Model Directory

REMOVED: The dependencies for Tensorflow 2 Object detection were massive and it was really slow so I removed it for the time being.

Tensorflow 2 models are a little more complex and have a directory of files that you must pass into DOODS. You can download the file and extract it to it's directory. For the modelFile option pass the path to the directory. You will need to download the labels file as well and provide it's path in the labelsFile option.

This is a model zoo for Tensorflow 2 models: https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/tf2_detection_zoo.md

I think they are better but they generally are much slower and probably require a GPU to work in a reasonable amount of time.

MQTT Mode

DOODS also supports a so called MQTT modes. In this mode, rather than listen via an HTTP api, it instead connects to an MQTT broker. The config file will instead look like this:

mqtt:
  broker:
    host: 127.0.0.1
    port: 1883
    user: username     # optional
    password: password # optional
  api:
    request_topic: doods2/request_topic
    response_topic: doods2/response_topic
  requests:
    - id: first
      detector_name: default
      throttle: 2
      detect:
        "person": 40
      data: rtsp://user:[email protected]/stream1
    - id: second
      detector_name: tensorflow
      throttle: 
      detect:
        "person": 40
      data: rtsp://user:[email protected]/stream2

You can then do a couple of things, you can send json formatted requests (same format as the HTTP API) to the request_topic and doods will respond on the response_topic. This is an asynchronous way to call doods via MQTT. The other thing you can do is configure requests with streams (like RTSP) and it will read from the stream and stream back detections on the response_topic. This might be useful for an NVR service to get back responses as fast as the throttle settings. For instance, 5 means 1 detection every 5 seconds. See the detection request section above for a list of all options.

doods2's People

Contributors

daoudeddy avatar frenetic00 avatar fusetak avatar sammy1am avatar snowzach avatar trunglam avatar turley avatar tux2000 avatar vipas-ana avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

doods2's Issues

Object has no attribute 'input_data'

This is from a png image sent over WebSockets. I think the image is being sent, maybe there's a issue decoding it? Could you add some error handling?

doods.api - ERROR - Exception(AttributeError):("'TensorflowLite' object has no attribute 'input_data'",)

Websockets memory leak

It's slowly using more and more memory. It takes a few million requests before it's noticeable.
Anything I should do before restarting it?

[FR:] Make confidence-number configurable on returning Image

would like to format the Precentage that is printed on the detection image.
i dont see global options for this
i dont see local detector options for this.

for my needs i would prefer two digits, like 90% or 62%
not 90.xxxxxxxxxxxxxxx.

would be best it could be configured per DETECTOR, not globally...

for example to much digits here:
image

Problems with detection areas and multiple image_processing pipelines

Iโ€™m facing some problems with a configuration with 2 image_processing pipelines activated with doods2, using the same detector.
The problem is related to the detection area definition: if I define a detection area for each image_processing only the first one works, while the other pipeline is stopped (no detection at all on the second image_processing pipeline).

This is my configuration (extract):

image_processing:
  - platform: doods
    scan_interval: 2
    url: !secret DOODS_url 
    timeout: 10
    detector: mydetector
    source:
      - entity_id: camera.cam_one
    file_out:
      - "/config/www/{{ camera_entity.split('.')[1] }}_latest.jpg"
    area:
      top:    0.3
      left:   0.05
      bottom: 1.0
      right:  0.95 
      
  - platform: doods
    scan_interval: 2
    url: !secret DOODS_url
    timeout: 10
    detector: mydetector
    source:
      - entity_id: camera.cam_two
    file_out:
      - "/config/www/{{ camera_entity.split('.')[1] }}_latest.jpg"
    confidence: 30
    area:
      top:    0.2
      left:   0.1
      bottom: 0.9
      right:  0.95 

    labels:
    - name: MYLABEL_1
    - name: MYLABEL_2
    - name: MYLABEL_3

May be there is an error in the configuration file... but I cannot see it.

Anyway without any area definition the two pipelines work correctly.... (i.e. DOODS2 rocks!)

Thank you for your precious help!

Doods server causes RPi to freeze

From time-to-time the Doods server (running in docker) will use up all memory on my RPi, which is also running my hass server, and subsequently freeze the whole machine. Only a reboot will unfreeze it. Any suggestions on how to track memory usage of the Doods server and restart it if it uses up too much memory. Hass logs from the most recent freeze are below:

Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 487, in async_update_ha_state
await self.async_device_update()
File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 691, in async_device_update
raise exc
File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/image_processing/init.py", line 138, in async_update
await self.async_process_image(image.content)
File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/image_processing/init.py", line 118, in async_process_image
return await self.hass.async_add_executor_job(self.process_image, image)
File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/doods/image_processing.py", line 295, in process_image
response = self._doods.detect(
File "/srv/homeassistant/lib/python3.8/site-packages/pydoods/init.py", line 29, in detect
response = requests.post(
File "/srv/homeassistant/lib/python3.8/site-packages/requests/api.py", line 117, in post
return request('post', url, data=data, json=json, **kwargs)
File "/srv/homeassistant/lib/python3.8/site-packages/requests/api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "/srv/homeassistant/lib/python3.8/site-packages/requests/sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "/srv/homeassistant/lib/python3.8/site-packages/requests/sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "/srv/homeassistant/lib/python3.8/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: /detect (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x5eb0b028>: Failed to establish a new connection: [Errno 24] Too many open files'))

Running doods2 on a Jetson Nano 4GB

Hi,
did anyone manage to run doods2 on a Jetson Nano 4GB Board including GPU support ? I found some related Issues in the old doods repository containing an old Dockerfile. Are there any plans to natively support it?

Thanks

does not create multiple images

I am trying to detect cats trespassing but for some reason, it is not saving the history of images, just the latest one.
This is what I am using for config. It used so save extra images too, but it stopped doing it for the last 2 days (plenty of space on disk)
- platform: doods url: "http://192.168.1.112:8080" detector: default source: - entity_id: camera.garage_camera file_out: - "/config/www/{{ camera_entity.split('.')[1] }}_latest.jpg" - "/config/www/doods/{{ camera_entity.split('.')[1] }}_{{ now().strftime('%Y%m%d_%H%M%S') }}.jpg" confidence: 20 scan_interval: 1 area: covers: false labels: - name: person confidence: 55 - name: car confidence: 50 - name: bird confidence: 50 - name: cat confidence: 20 - name: dog confidence: 20

Instalation with Coral Edge USB (report with issues)

Hello,

Did the installation and ran docker image with additional ยป -- device /dev/bus/usb ยซ. You have a typo in your instructions about this parameter.

Then I changed config.yaml in my container and copied model and label file for Edge Coral.

doods:
detectors:
- name: default
type: tflite
modelFile: models/ssd_mobilenet_v2_coco_quant_postprocess_edgetpu.tflite
labelFile: models/coco_labels_0.txt
hwAccel: true

  1. http://192.168.xxx.xxx:8080/detectors shows:

{"detectors":[{"name":"default","type":"tensorflow2","model":"models/ssd_mobilenet_v2_coco_quant_postprocess_edgetpu.tflite","labels":["person","bicycle","car","motorcycle","airplane","bus","train","truck","boat","traffic light","fire hydrant","n/a","stop sign","parking meter","bench","bird","cat","dog","horse","sheep","cow","elephant","bear","zebra","giraffe","n/a","backpack","umbrella","n/a","n/a","handbag","tie","suitcase","frisbee","skis","snowboard","sports ball","kite","baseball bat","baseball glove","skateboard","surfboard","tennis racket","bottle","n/a","wine glass","cup","fork","knife","spoon","bowl","banana","apple","sandwich","orange","broccoli","carrot","hot dog","pizza","donut","cake","chair","couch","potted plant","bed","n/a","dining table","n/a","n/a","toilet","n/a","tv","laptop","mouse","remote","keyboard","cell phone","microwave","oven","toaster","sink","refrigerator","n/a","book","clock","vase","scissors","teddy bear","hair drier","toothbrush"],"width":0,"height":0}]}

  1. Additional check upon startup of container

pi@raspberrypi:~ $ sudo docker start 6710fb8a10e2
6710fb8a10e2
pi@raspberrypi:~ $ sudo docker attach 6710fb8a10e2
/usr/local/lib/python3.8/dist-packages/tensorflow_io/python/ops/init.py:98: UserWarning: unable to load libtensorflow_io_plugins.so: unable to open file: li btensorflow_io_plugins.so, from paths: ['/usr/local/lib/python3.8/dist-packages/ tensorflow_io/python/ops/libtensorflow_io_plugins.so']
caused by: ["[Errno 2] The file to load file system plugin from does not exist.: '/usr/local/lib/python3.8/dist-packages/tensorflow_io/python/ops/libtensorflow_ io_plugins.so'"]
warnings.warn(f"unable to load libtensorflow_io_plugins.so: {e}")
/usr/local/lib/python3.8/dist-packages/tensorflow_io/python/ops/init.py:104: UserWarning: file system plugins are not loaded: unable to open file: libtensor flow_io.so, from paths: ['/usr/local/lib/python3.8/dist-packages/tensorflow_io/p ython/ops/libtensorflow_io.so']
caused by: ['/usr/local/lib/python3.8/dist-packages/tensorflow_io/python/ops/lib tensorflow_io.so: cannot open shared object file: No such file or directory']
warnings.warn(f"file system plugins are not loaded: {e}")
Failed to load delegate from libedgetpu.so.1.0

INFO: Started server process [1]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)

Question: Is this container related or raspberry bullseye OS?

Permission error

I just switched from DOODS to DOODS2. When I try to start the container I get the following error:

Fatal Python error: pyinit_main: can't initialize time
Python runtime state: core initialized
PermissionError: [Errno 1] Operation not permitted

Current thread 0xf7dc4310 (most recent call first):
<no Python frame>

I am running doods2 on a raspberry pi 4. In my understanding containers always run with root privileges. Nevertheless I tried running "sudo docker run ...", still without success.

Does anyone know how to solve this issue?

Label filtering not working with pytorch

I switched over from doods1 to doods2 using the Home Assistant plugin. I also decided to check out pytorch.

I noticed after scanning the image though that it detected a "bench" in the image, when that isn't list of labels configured in the doods image processing configuration.

File not found: libtensorflow_io_plugins.so

The following error occurs on my : "Raspberry Pi 3 Model B". However, the program still runs OK.

I also have: "Raspberry Pi 4 Model B", and "Raspberry PI 3 Model B+", both do not have the error.


2022-01-25T18:20:16.818386681Z /usr/local/lib/python3.8/dist-packages/tensorflow_io/python/ops/init.py:98: UserWarning: unable to load libtensorflow_io_plugins.so: unable to open file: libtensorflow_io_plugins.so, from paths: ['/usr/local/lib/python3.8/dist-packages/tensorflow_io/python/ops/libtensorflow_io_plugins.so']

2022-01-25T18:20:16.818622773Z caused by: ["[Errno 2] The file to load file system plugin from does not exist.: '/usr/local/lib/python3.8/dist-packages/tensorflow_io/python/ops/libtensorflow_io_plugins.so'"]

2022-01-25T18:20:16.818662565Z warnings.warn(f"unable to load libtensorflow_io_plugins.so: {e}")

2022-01-25T18:20:16.818698711Z /usr/local/lib/python3.8/dist-packages/tensorflow_io/python/ops/init.py:104: UserWarning: file system plugins are not loaded: unable to open file: libtensorflow_io.so, from paths: ['/usr/local/lib/python3.8/dist-packages/tensorflow_io/python/ops/libtensorflow_io.so']

2022-01-25T18:20:16.818739804Z caused by: ['/usr/local/lib/python3.8/dist-packages/tensorflow_io/python/ops/libtensorflow_io.so: cannot open shared object file: No such file or directory']

Tensorflow1 models support

First of all thank you for moving Doods to Python!!
I fully agree with you that Python is a good and well known environment for machine learning and computer vision tasks.

Iโ€™m experiencing some problems with a MobilenetV2 model that is actually derived from the model for TF1 provided by Coral Google and trained with my dataset.

It seems there is a problem in managing the output: the log reports an error on line 90 in tflite.py (omitting the full traceback):

2022-01-07 19:03:35,450 - uvicorn.access - INFO - 192.168.1.100:53992 - "POST /detect HTTP/1.1" 500
2022-01-07 19:03:35,450 - uvicorn.error - ERROR - Exception in ASGI application
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/uvicorn/protocols/http/h11_impl.py", line 373, in run_asgi
   result = await app(self.scope, self.receive, self.send)
โ€ฆ
โ€ฆ
  File "/opt/doods/detectors/tflite.py", line 90, in detect
    if int(classes[i]) in self.labels:
ValueError: cannot convert float NaN to integer

In my opinion this could be related to the fact that my model is TF1 and not TF2, as I can normally manage the output considering the result as tensors, with code similar to this one:

def output_tensor(interpreter, i):
  """Returns output tensor view."""
  tensor = interpreter.tensor(interpreter.get_output_details()[i]['index'])()
  return np.squeeze(tensor)

def get_output(interpreter, score_threshold, image_scale=1.0): 
  """Returns list of detected objects."""
  boxes = output_tensor(interpreter, 0)
  class_ids = output_tensor(interpreter, 1)
  scores = output_tensor(interpreter, 2)
  count = int(output_tensor(interpreter, 3))   
  width, height = input_size(interpreter)
  sx, sy = width / image_scale, height / image_scale 

while I noted the code in doods2 (tflite.py) is quite different:

boxes = self.interpreter.get_tensor(self.output_details[0]['index'])[0] # Bounding box coordinates of detected objects
classes = self.interpreter.get_tensor(self.output_details[1]['index'])[0] # Class index of detected objects
scores = self.interpreter.get_tensor(self.output_details[2]['index'])[0] # Confidence of detected objects

May be some change should be done in order to accept also TF1 models in doods.
If this is the case, could you consider to accept also TF1 models in doods2 providing a special flag in configuration (e.g tf_Version: 1 or 2)?
Thanks in advance.

config.yaml not used?

I'm running doods2 on a system that cannot use docker. So I have the files downloaded and I run it using a service file as a system service.
This seems to work okay, except for the fact that I cannot seem to make the config file work.

All I really wanted to do was change to font size for the detections and the colour of the capture area box to be a little less gaudy, but so far I can't seem to get any changes to stick.

I've put the sources in /home/nicole/doods2/src/doods2 with the required libraries for it in /home/nicole/doods2/bin|include|lib|share. All python libraries live there and this works overall.

The service file that makes this works is as follows:

[Unit]
Description=DOODS2 image detection service
After=multi-user.target

[Service]
Type=simple
User=nicole
WorkingDirectory=/home/nicole/doods2/src/doods2/
ExecStart=/home/nicole/doods2/bin/python3 main.py --config=/home/nicole/doods2/src/doods2/config.yaml
Environment="PATH=/home/nicole/doods2/bin:$PATH"
Restart=always

StandardOutput=file:/var/log/doods2.log
StandardError=file:/var/log/doods2.err.log

[Install]
WantedBy=multi-user.target

Note that I added the --config flag to ExecStart, but this is the part that doesn't seem to work. No error is thrown, but no config changes are being implemented, either.

There is a mention of the config.yaml file in the readme but it specifically talks about docker, and not just as a standalone service. Is there anything I need to do in particular to get the config file to be picked up, other than the inclusion of the --config= flag?

Also, is the example structure given in the readme correct? Perhaps it doesn't use my changes because the example doesn't make sense and it reverts to the built-in defaults instead.

Does DOODs 2 support buffering of requests

Hi,
I am new user to DOODs. Thanks for your work, it really helps
I am not sure whether I can post my query here.
I use two Raspberry Pis, one running image capture from IP camera and make request to another Pi which runs DOODs server.
DOODs running in docker,
My question is whether DOODs support buffer requests and process (Async) or requesting entity has to wait until receive response for request?
I couldn't solution or support about buffering requests (Async), so please guide me if it is feasible

Thanks
Karthik

WebSocket /detect doesn't have any error reporting

Connection closes without a error.

main.go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"net/http"
	"os"

	"github.com/gorilla/websocket"
)

const doodsPath = "127.0.0.1:8080"

func main() {
	if err := run(); err != nil {
		fmt.Println(err)
	}
}

func run() error {
	img, err := os.ReadFile("./image.png")
	if err != nil {
		return fmt.Errorf("could not read file: %w", err)
	}

	request := detectRequest{
		DetectorName: "tensorflow",
		Data:         img,
		Preprocess:   []string{"grayscale"},
		Detect:       map[string]int{"*": 0},
	}

	jsonRequest, err := json.Marshal(request)
	if err != nil {
		return fmt.Errorf("could not marshal request: %w", err)
	}

	if err := post(jsonRequest); err != nil {
		return err
	}

	fmt.Println("websocket start")
	if err := ws(jsonRequest); err != nil {
		return err
	}
	return nil
}

// Working.
func post(jsonRequest []byte) error {
	response, err := http.Post(
		"http://"+doodsPath+"/detect",
		"application/json",
		bytes.NewBuffer(jsonRequest))
	if err != nil {
		return fmt.Errorf("post error: %w", err)
	}
	defer response.Body.Close()

	var jsonResponse detectResponse
	json.NewDecoder(response.Body).Decode(&jsonResponse)

	fmt.Println(jsonResponse)

	return nil
}

// Error: could not read json response: websocket: close 1000 (normal).
func ws(jsonRequest []byte) error {
	conn, _, err := websocket.DefaultDialer.Dial("ws://"+doodsPath+"/detect", nil)
	if err != nil {
		return fmt.Errorf("could not connect to doods: %w", err)
	}
	defer conn.Close()

	if err := conn.WriteJSON(jsonRequest); err != nil {
		return fmt.Errorf("could not send request: %w", err)
	}

	var response detectResponse
	if err = conn.ReadJSON(&response); err != nil {
		return fmt.Errorf("could not read json response: %w", err)
	}
	return nil
}

type detectRequest struct {
	DetectorName string         `json:"detector_name"`
	Data         []byte         `json:"data"`
	Preprocess   []string       `json:"preprocess"`
	Detect       map[string]int `json:"detect"`
}

type detectResponse struct {
	Detections []Detection `json:"detections"`
	Error      string      `json:"error"`
}

// Detection .
type Detection struct {
	Top        float32 `json:"top"`
	Left       float32 `json:"left"`
	Bottom     float32 `json:"bottom"`
	Right      float32 `json:"right"`
	Label      string  `json:"label"`
	Confidence float32 `json:"confidence"`
}

Doods2 doesnt work after update /latest

Hi everyone

Im having some trouble with Doods2 after my container has updated to latest image

Im runing Home assistant to detect person with my camera's

but its failling when its trying to connect (log file from HA):

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 281, in _async_setup_platform await asyncio.shield(task) File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/usr/src/homeassistant/homeassistant/components/doods/image_processing.py", line 96, in setup_platform doods = PyDOODS(url, auth_key, timeout) File "/usr/local/lib/python3.10/site-packages/pydoods/__init__.py", line 13, in __init__ self.get_detectors() File "/usr/local/lib/python3.10/site-packages/pydoods/__init__.py", line 21, in get_detectors response.raise_for_status() File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 1021, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: http://192.168.1.205:8080/detectors 2022-08-20 22:51:33.253 ERROR (MainThread) [homeassistant.components.image_processing] Error while setting up doods platform for image_processing

The log file shows (Log file from Doods):

`today at 10:52:40 PM Container started
today at 10:50:48 PM File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/errors.py", line 159, in call
today at 10:50:48 PM await self.app(scope, receive, _send)
today at 10:50:48 PM File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 57, in call
today at 10:50:48 PM task_group.cancel_scope.cancel()
today at 10:50:48 PM2022-08-20 22:50:48,628 - uvicorn.access - INFO - 192.168.1.125:58677 - "GET /detectors HTTP/1.1" 500
today at 10:50:48 PM File "/usr/local/lib/python3.8/dist-packages/anyio/_backends/_asyncio.py", line 572, in aexit
today at 10:50:48 PM raise ExceptionGroup(exceptions)
today at 10:50:48 PManyio._backends.asyncio.ExceptionGroup: 2 exceptions were raised in the task group:
today at 10:50:48 PM----------------------------
today at 10:50:48 PMTraceback (most recent call last):
today at 10:50:48 PM File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 55, in call
today at 10:50:48 PM response = await self.dispatch_func(request, call_next)
today at 10:50:48 PM File "/usr/local/lib/python3.8/dist-packages/prometheus_fastapi_instrumentator/instrumentation.py", line 172, in dispatch_middleware
today at 10:50:48 PM raise e from None
today at 10:50:48 PM File "/usr/local/lib/python3.8/dist-packages/prometheus_fastapi_instrumentator/instrumentation.py", line 169, in dispatch_middleware
today at 10:50:48 PM response = await call_next(request)
today at 10:50:48 PM File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 37, in call_next
today at 10:50:48 PM raise RuntimeError("No response returned.")
today at 10:50:48 PMRuntimeError: No response returned.
today at 10:50:48 PM----------------------------
today at 10:50:48 PMTraceback (most recent call last):
today at 10:50:48 PM File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 30, in coro
today at 10:50:48 PM await self.app(scope, request.receive, send_stream.send)
today at 10:50:48 PM File "/usr/local/lib/python3.8/dist-packages/starlette/exceptions.py", line 82, in call
today at 10:50:48 PM raise exc
today at 10:50:48 PM File "/usr/local/lib/python3.8/dist-packages/starlette/exceptions.py", line 71, in call
today at 10:50:48 PM await self.app(scope, receive, sender)
today at 10:50:48 PM File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 656, in call
today at 10:50:48 PM await route.handle(scope, receive, send)
today at 10:50:48 PM File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 259, in handle
today at 10:50:48 PM await self.app(scope, receive, send)
today at 10:50:48 PM File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 61, in app
today at 10:50:48 PM response = await func(request)
today at 10:50:48 PM File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 234, in app
today at 10:50:48 PM response_data = await serialize_response(
today at 10:50:48 PM File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 137, in serialize_response
today at 10:50:48 PM raise ValidationError(errors, field.type
)
today at 10:50:48 PMpydantic.error_wrappers.ValidationError: 1 validation error for DetectorsResponse
today at 10:50:48 PMresponse -> detectors -> 2 -> labels
today at 10:50:48 PM value is not a valid list (type=type_error.list)
today at 10:50:48 PM
today at 10:51:33 PM2022-08-20 22:51:33,222 - uvicorn.error - ERROR - Exception in ASGI application
today at 10:51:33 PMTraceback (most recent call last):
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/uvicorn/protocols/http/h11_impl.py", line 373, in run_asgi
today at 10:51:33 PM result = await app(self.scope, self.receive, self.send)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/uvicorn/middleware/proxy_headers.py", line 75, in call
today at 10:51:33 PM return await self.app(scope, receive, send)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/fastapi/applications.py", line 208, in call
today at 10:51:33 PM await super().call(scope, receive, send)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/applications.py", line 112, in call
today at 10:51:33 PM await self.middleware_stack(scope, receive, send)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/errors.py", line 159, in call
today at 10:51:33 PM await self.app(scope, receive, _send)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 57, in call
today at 10:51:33 PM task_group.cancel_scope.cancel()
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/anyio/_backends/_asyncio.py", line 572, in aexit
today at 10:51:33 PM raise ExceptionGroup(exceptions)
today at 10:51:33 PManyio._backends.asyncio.ExceptionGroup: 2 exceptions were raised in the task group:
today at 10:51:33 PM----------------------------
today at 10:51:33 PMTraceback (most recent call last):
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 55, in call
today at 10:51:33 PM response = await self.dispatch_func(request, call_next)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/prometheus_fastapi_instrumentator/instrumentation.py", line 172, in dispatch_middleware
today at 10:51:33 PM raise e from None
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/prometheus_fastapi_instrumentator/instrumentation.py", line 169, in dispatch_middleware
today at 10:51:33 PM response = await call_next(request)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 37, in call_next
today at 10:51:33 PM raise RuntimeError("No response returned.")
today at 10:51:33 PMRuntimeError: No response returned.
today at 10:51:33 PM----------------------------
today at 10:51:33 PMTraceback (most recent call last):
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 30, in coro
today at 10:51:33 PM await self.app(scope, request.receive, send_stream.send)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/exceptions.py", line 82, in call
today at 10:51:33 PM raise exc
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/exceptions.py", line 71, in call
today at 10:51:33 PM await self.app(scope, receive, sender)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 656, in call
today at 10:51:33 PM await route.handle(scope, receive, send)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 259, in handle
today at 10:51:33 PM await self.app(scope, receive, send)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 61, in app
today at 10:51:33 PM response = await func(request)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 234, in app
today at 10:51:33 PM response_data = await serialize_response(
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 137, in serialize_response
today at 10:51:33 PM raise ValidationError(errors, field.type
)
today at 10:51:33 PMpydantic.error_wrappers.ValidationError: 1 validation error for DetectorsResponse
today at 10:51:33 PMresponse -> detectors -> 2 -> labels
today at 10:51:33 PM value is not a valid list (type=type_error.list)
today at 10:51:33 PM
today at 10:51:33 PM2022-08-20 22:51:33,223 - uvicorn.access - INFO - 192.168.1.204:48516 - "GET /detectors HTTP/1.1" 500
today at 10:51:33 PM2022-08-20 22:51:33,225 - uvicorn.error - ERROR - Exception in ASGI application
today at 10:51:33 PMTraceback (most recent call last):
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/uvicorn/protocols/http/h11_impl.py", line 373, in run_asgi
today at 10:51:33 PM result = await app(self.scope, self.receive, self.send)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/uvicorn/middleware/proxy_headers.py", line 75, in call
today at 10:51:33 PM return await self.app(scope, receive, send)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/fastapi/applications.py", line 208, in call
today at 10:51:33 PM await super().call(scope, receive, send)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/applications.py", line 112, in call
today at 10:51:33 PM await self.middleware_stack(scope, receive, send)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/errors.py", line 159, in call
today at 10:51:33 PM await self.app(scope, receive, _send)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 57, in call
today at 10:51:33 PM task_group.cancel_scope.cancel()
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/anyio/_backends/_asyncio.py", line 572, in aexit
today at 10:51:33 PM raise ExceptionGroup(exceptions)
today at 10:51:33 PManyio._backends.asyncio.ExceptionGroup: 2 exceptions were raised in the task group:
today at 10:51:33 PM----------------------------
today at 10:51:33 PMTraceback (most recent call last):
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 55, in call
today at 10:51:33 PM response = await self.dispatch_func(request, call_next)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/prometheus_fastapi_instrumentator/instrumentation.py", line 172, in dispatch_middleware
today at 10:51:33 PM raise e from None
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/prometheus_fastapi_instrumentator/instrumentation.py", line 169, in dispatch_middleware
today at 10:51:33 PM response = await call_next(request)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 37, in call_next
today at 10:51:33 PM2022-08-20 22:51:33,226 - uvicorn.access - INFO - 192.168.1.204:48500 - "GET /detectors HTTP/1.1" 500
today at 10:51:33 PM raise RuntimeError("No response returned.")
today at 10:51:33 PMRuntimeError: No response returned.
today at 10:51:33 PM----------------------------
today at 10:51:33 PMTraceback (most recent call last):
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 30, in coro
today at 10:51:33 PM await self.app(scope, request.receive, send_stream.send)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/exceptions.py", line 82, in call
today at 10:51:33 PM raise exc
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/exceptions.py", line 71, in call
today at 10:51:33 PM await self.app(scope, receive, sender)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 656, in call
today at 10:51:33 PM await route.handle(scope, receive, send)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 259, in handle
today at 10:51:33 PM await self.app(scope, receive, send)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 61, in app
today at 10:51:33 PM response = await func(request)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 234, in app
today at 10:51:33 PM response_data = await serialize_response(
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 137, in serialize_response
today at 10:51:33 PM raise ValidationError(errors, field.type
)
today at 10:51:33 PMpydantic.error_wrappers.ValidationError: 1 validation error for DetectorsResponse
today at 10:51:33 PMresponse -> detectors -> 2 -> labels
today at 10:51:33 PM value is not a valid list (type=type_error.list)
today at 10:51:33 PM
today at 10:51:33 PM2022-08-20 22:51:33,227 - uvicorn.error - ERROR - Exception in ASGI application
today at 10:51:33 PMTraceback (most recent call last):
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/uvicorn/protocols/http/h11_impl.py", line 373, in run_asgi
today at 10:51:33 PM result = await app(self.scope, self.receive, self.send)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/uvicorn/middleware/proxy_headers.py", line 75, in call
today at 10:51:33 PM return await self.app(scope, receive, send)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/fastapi/applications.py", line 208, in call
today at 10:51:33 PM await super().call(scope, receive, send)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/applications.py", line 112, in call
today at 10:51:33 PM await self.middleware_stack(scope, receive, send)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/errors.py", line 159, in call
today at 10:51:33 PM await self.app(scope, receive, _send)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 57, in call
today at 10:51:33 PM task_group.cancel_scope.cancel()
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/anyio/_backends/_asyncio.py", line 572, in aexit
today at 10:51:33 PM raise ExceptionGroup(exceptions)
today at 10:51:33 PManyio._backends.asyncio.ExceptionGroup: 2 exceptions were raised in the task group:
today at 10:51:33 PM----------------------------
today at 10:51:33 PMTraceback (most recent call last):
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 55, in call
today at 10:51:33 PM response = await self.dispatch_func(request, call_next)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/prometheus_fastapi_instrumentator/instrumentation.py", line 172, in dispatch_middleware
today at 10:51:33 PM raise e from None
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/prometheus_fastapi_instrumentator/instrumentation.py", line 169, in dispatch_middleware
today at 10:51:33 PM response = await call_next(request)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 37, in call_next
today at 10:51:33 PM raise RuntimeError("No response returned.")
today at 10:51:33 PMRuntimeError: No response returned.
today at 10:51:33 PM----------------------------
today at 10:51:33 PMTraceback (most recent call last):
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 30, in coro
today at 10:51:33 PM await self.app(scope, request.receive, send_stream.send)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/exceptions.py", line 82, in call
today at 10:51:33 PM2022-08-20 22:51:33,227 - uvicorn.access - INFO - 192.168.1.204:48530 - "GET /detectors HTTP/1.1" 500
today at 10:51:33 PM raise exc
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/exceptions.py", line 71, in call
today at 10:51:33 PM await self.app(scope, receive, sender)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 656, in call
today at 10:51:33 PM await route.handle(scope, receive, send)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 259, in handle
today at 10:51:33 PM await self.app(scope, receive, send)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 61, in app
today at 10:51:33 PM response = await func(request)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 234, in app
today at 10:51:33 PM response_data = await serialize_response(
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 137, in serialize_response
today at 10:51:33 PM raise ValidationError(errors, field.type
)
today at 10:51:33 PMpydantic.error_wrappers.ValidationError: 1 validation error for DetectorsResponse
today at 10:51:33 PMresponse -> detectors -> 2 -> labels
today at 10:51:33 PM value is not a valid list (type=type_error.list)
today at 10:51:33 PM
today at 10:51:33 PM2022-08-20 22:51:33,228 - uvicorn.error - ERROR - Exception in ASGI application
today at 10:51:33 PMTraceback (most recent call last):
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/uvicorn/protocols/http/h11_impl.py", line 373, in run_asgi
today at 10:51:33 PM result = await app(self.scope, self.receive, self.send)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/uvicorn/middleware/proxy_headers.py", line 75, in call
today at 10:51:33 PM return await self.app(scope, receive, send)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/fastapi/applications.py", line 208, in call
today at 10:51:33 PM await super().call(scope, receive, send)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/applications.py", line 112, in call
today at 10:51:33 PM await self.middleware_stack(scope, receive, send)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/errors.py", line 159, in call
today at 10:51:33 PM await self.app(scope, receive, _send)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 57, in call
today at 10:51:33 PM task_group.cancel_scope.cancel()
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/anyio/_backends/_asyncio.py", line 572, in aexit
today at 10:51:33 PM raise ExceptionGroup(exceptions)
today at 10:51:33 PManyio._backends.asyncio.ExceptionGroup: 2 exceptions were raised in the task group:
today at 10:51:33 PM----------------------------
today at 10:51:33 PMTraceback (most recent call last):
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 55, in call
today at 10:51:33 PM response = await self.dispatch_func(request, call_next)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/prometheus_fastapi_instrumentator/instrumentation.py", line 172, in dispatch_middleware
today at 10:51:33 PM raise e from None
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/prometheus_fastapi_instrumentator/instrumentation.py", line 169, in dispatch_middleware
today at 10:51:33 PM response = await call_next(request)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 37, in call_next
today at 10:51:33 PM raise RuntimeError("No response returned.")
today at 10:51:33 PMRuntimeError: No response returned.
today at 10:51:33 PM----------------------------
today at 10:51:33 PMTraceback (most recent call last):
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 30, in coro
today at 10:51:33 PM await self.app(scope, request.receive, send_stream.send)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/exceptions.py", line 82, in call
today at 10:51:33 PM raise exc
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/exceptions.py", line 71, in call
today at 10:51:33 PM await self.app(scope, receive, sender)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 656, in call
today at 10:51:33 PM await route.handle(scope, receive, send)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 259, in handle
today at 10:51:33 PM await self.app(scope, receive, send)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 61, in app
today at 10:51:33 PM response = await func(request)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 234, in app
today at 10:51:33 PM response_data = await serialize_response(
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 137, in serialize_response
today at 10:51:33 PM raise ValidationError(errors, field.type
)
today at 10:51:33 PMpydantic.error_wrappers.ValidationError: 1 validation error for DetectorsResponse
today at 10:51:33 PMresponse -> detectors -> 2 -> labels
today at 10:51:33 PM value is not a valid list (type=type_error.list)
today at 10:51:33 PM
today at 10:51:33 PM2022-08-20 22:51:33,228 - uvicorn.access - INFO - 192.168.1.204:48524 - "GET /detectors HTTP/1.1" 500
today at 10:51:33 PM2022-08-20 22:51:33,230 - uvicorn.error - ERROR - Exception in ASGI application
today at 10:51:33 PMTraceback (most recent call last):
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/uvicorn/protocols/http/h11_impl.py", line 373, in run_asgi
today at 10:51:33 PM result = await app(self.scope, self.receive, self.send)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/uvicorn/middleware/proxy_headers.py", line 75, in call
today at 10:51:33 PM return await self.app(scope, receive, send)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/fastapi/applications.py", line 208, in call
today at 10:51:33 PM await super().call(scope, receive, send)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/applications.py", line 112, in call
today at 10:51:33 PM await self.middleware_stack(scope, receive, send)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/errors.py", line 159, in call
today at 10:51:33 PM await self.app(scope, receive, _send)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 57, in call
today at 10:51:33 PM task_group.cancel_scope.cancel()
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/anyio/_backends/_asyncio.py", line 572, in aexit
today at 10:51:33 PM raise ExceptionGroup(exceptions)
today at 10:51:33 PManyio._backends.asyncio.ExceptionGroup: 2 exceptions were raised in the task group:
today at 10:51:33 PM----------------------------
today at 10:51:33 PMTraceback (most recent call last):
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 55, in call
today at 10:51:33 PM response = await self.dispatch_func(request, call_next)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/prometheus_fastapi_instrumentator/instrumentation.py", line 172, in dispatch_middleware
today at 10:51:33 PM raise e from None
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/prometheus_fastapi_instrumentator/instrumentation.py", line 169, in dispatch_middleware
today at 10:51:33 PM response = await call_next(request)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 37, in call_next
today at 10:51:33 PM raise RuntimeError("No response returned.")
today at 10:51:33 PMRuntimeError: No response returned.
today at 10:51:33 PM----------------------------
today at 10:51:33 PMTraceback (most recent call last):
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 30, in coro
today at 10:51:33 PM await self.app(scope, request.receive, send_stream.send)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/exceptions.py", line 82, in call
today at 10:51:33 PM raise exc
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/exceptions.py", line 71, in call
today at 10:51:33 PM await self.app(scope, receive, sender)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 656, in call
today at 10:51:33 PM await route.handle(scope, receive, send)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 259, in handle
today at 10:51:33 PM await self.app(scope, receive, send)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 61, in app
today at 10:51:33 PM response = await func(request)
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 234, in app
today at 10:51:33 PM response_data = await serialize_response(
today at 10:51:33 PM File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 137, in serialize_response
today at 10:51:33 PM raise ValidationError(errors, field.type
)
today at 10:51:33 PMpydantic.error_wrappers.ValidationError: 1 validation error for DetectorsResponse
today at 10:51:33 PMresponse -> detectors -> 2 -> labels
today at 10:51:33 PM value is not a valid list (type=type_error.list)
today at 10:51:33 PM
today at 10:51:33 PM2022-08-20 22:51:33,230 - uvicorn.access - INFO - 192.168.1.204:48532 - "GET /detectors HTTP/1.1" 500
today at 10:52:38 PM2022-08-20 22:52:38,391 - uvicorn.error - INFO - Shutting down
today at 10:52:38 PM2022-08-20 22:52:38,492 - uvicorn.error - INFO - Waiting for application shutdown.
today at 10:52:38 PM2022-08-20 22:52:38,493 - uvicorn.error - INFO - Application shutdown complete.
today at 10:52:38 PM2022-08-20 22:52:38,493 - uvicorn.error - INFO - Finished server process [1]
today at 10:52:42 PM2022-08-20 22:52:42,692 - doods.doods - INFO - Registered detector type:tflite name:default
today at 10:52:44 PM2022-08-20 22:52:44,048 - doods.doods - INFO - Registered detector type:tensorflow name:tensorflow
today at 10:52:45 PMUsing cache found in /root/.cache/torch/hub/ultralytics_yolov5_master
today at 10:52:45 PMYOLOv5 ๐Ÿš€ 2022-8-20 Python-3.8.10 torch-1.10.2+cu102 CPU
today at 10:52:45 PM
today at 10:52:45 PMFusing layers...
today at 10:52:45 PMYOLOv5s summary: 213 layers, 7225885 parameters, 0 gradients
today at 10:52:45 PMAdding AutoShape...
today at 10:52:45 PM2022-08-20 22:52:45,409 - doods.doods - INFO - Registered detector type:pytorch name:pytorch
today at 10:52:45 PM2022-08-20 22:52:45,440 - uvicorn.error - INFO - Started server process [1]
today at 10:52:45 PM2022-08-20 22:52:45,440 - uvicorn.error - INFO - Waiting for application startup.
today at 10:52:45 PM2022-08-20 22:52:45,440 - uvicorn.error - INFO - Application startup complete.
today at 10:52:45 PM2022-08-20 22:52:45,441 - uvicorn.error - INFO - Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)
today at 10:56:32 PM2022-08-20 22:56:32,502 - uvicorn.access - INFO - 192.168.1.194:44806 - "GET / HTTP/1.1" 304
today at 10:56:32 PM2022-08-20 22:56:32,591 - uvicorn.error - ERROR - Exception in ASGI application
today at 10:56:32 PMTraceback (most recent call last):
today at 10:56:32 PM File "/usr/local/lib/python3.8/dist-packages/uvicorn/protocols/http/h11_impl.py", line 373, in run_asgi
today at 10:56:32 PM result = await app(self.scope, self.receive, self.send)
today at 10:56:32 PM File "/usr/local/lib/python3.8/dist-packages/uvicorn/middleware/proxy_headers.py", line 75, in call
today at 10:56:32 PM return await self.app(scope, receive, send)
today at 10:56:32 PM File "/usr/local/lib/python3.8/dist-packages/fastapi/applications.py", line 208, in call
today at 10:56:32 PM await super().call(scope, receive, send)
today at 10:56:32 PM File "/usr/local/lib/python3.8/dist-packages/starlette/applications.py", line 112, in call
today at 10:56:32 PM await self.middleware_stack(scope, receive, send)
today at 10:56:32 PM File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/errors.py", line 159, in call
today at 10:56:32 PM await self.app(scope, receive, _send)
today at 10:56:32 PM File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 57, in call
today at 10:56:32 PM task_group.cancel_scope.cancel()
today at 10:56:32 PM File "/usr/local/lib/python3.8/dist-packages/anyio/_backends/_asyncio.py", line 572, in aexit
today at 10:56:32 PM raise ExceptionGroup(exceptions)
today at 10:56:32 PManyio._backends.asyncio.ExceptionGroup: 2 exceptions were raised in the task group:
today at 10:56:32 PM----------------------------
today at 10:56:32 PMTraceback (most recent call last):
today at 10:56:32 PM File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 55, in call
today at 10:56:32 PM response = await self.dispatch_func(request, call_next)
today at 10:56:32 PM File "/usr/local/lib/python3.8/dist-packages/prometheus_fastapi_instrumentator/instrumentation.py", line 172, in dispatch_middleware
today at 10:56:32 PM raise e from None
today at 10:56:32 PM File "/usr/local/lib/python3.8/dist-packages/prometheus_fastapi_instrumentator/instrumentation.py", line 169, in dispatch_middleware
today at 10:56:32 PM response = await call_next(request)
today at 10:56:32 PM File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 37, in call_next
today at 10:56:32 PM raise RuntimeError("No response returned.")
today at 10:56:32 PMRuntimeError: No response returned.
today at 10:56:32 PM----------------------------
today at 10:56:32 PMTraceback (most recent call last):
today at 10:56:32 PM File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 30, in coro
today at 10:56:32 PM await self.app(scope, request.receive, send_stream.send)
today at 10:56:32 PM File "/usr/local/lib/python3.8/dist-packages/starlette/exceptions.py", line 82, in call
today at 10:56:32 PM raise exc
today at 10:56:32 PM File "/usr/local/lib/python3.8/dist-packages/starlette/exceptions.py", line 71, in call
today at 10:56:32 PM await self.app(scope, receive, sender)
today at 10:56:32 PM File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 656, in call
today at 10:56:32 PM await route.handle(scope, receive, send)
today at 10:56:32 PM File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 259, in handle
today at 10:56:32 PM await self.app(scope, receive, send)
today at 10:56:32 PM File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 61, in app
today at 10:56:32 PM response = await func(request)
today at 10:56:32 PM File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 234, in app
today at 10:56:32 PM response_data = await serialize_response(
today at 10:56:32 PM File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 137, in serialize_response
today at 10:56:32 PM raise ValidationError(errors, field.type
)
today at 10:56:32 PMpydantic.error_wrappers.ValidationError: 1 validation error for DetectorsResponse
today at 10:56:32 PMresponse -> detectors -> 2 -> labels
today at 10:56:32 PM value is not a valid list (type=type_error.list)
today at 10:56:32 PM
today at 10:56:32 PM2022-08-20 22:56:32,597 - uvicorn.access - INFO - 192.168.1.194:44806 - "GET /detectors HTTP/1.1" 500

Im also getting an "Internal Server Error" when i try to open:
http://192.168.1.205:8080/detectors

All my containers is runing through Traefik as you can see here: 192.168.1.194
Any idear why this is happening?

It was working fine before with traefik and my setup, so im really clueless here

Any help will be pretiatet

GET /stream?detection_request= doesn't work.

The API endpoint GET /stream?detection_request= noted in the documation doesn't work. The API instead responds to GET /stream?detect_request=. Assuming this is a typo in the documentation?

Docker image version

I suggest to use a version when you build Docker Images instead of build only a latest tag. This is because if something is broken in the last build there's no way to return to the old working image as there's only a tag available.

debian docker

Docker image based on debian.

FROM python:3.10.4-slim-bullseye

# Value will be appended to .bazelrc Can be used to set no-avx.
# Example: "build --copt=-mno-avx"
ARG bazelrc=""

# Bazel options.
ARG bazel_opts="--config=release_base --config=avx_linux --config=nogcp --config=nonccl"

# Build Bazel and TensorFlow CPU.
RUN apt update && \
	apt install -y --no-install-recommends \
		bazel-bootstrap git build-essential openjdk-11-jdk zip unzip && \
	cd / && \
	git clone --branch 4.2.1 --depth 1 https://github.com/bazelbuild/bazel && \
	cd /bazel && \
	bazel build "//src:bazel" --compilation_mode=opt && \
	apt purge -y bazel-bootstrap build-essential openjdk-11-jdk zip unzip --autoremove && \
	mv /bazel/bazel-bin/src/bazel /usr/bin/ && \
	rm -r /bazel && \
	\
	cd / && \
	git clone --branch r2.8 --depth 1 https://github.com/tensorflow/tensorflow.git && \
	apt install -y --no-install-recommends python3-dev gcc g++ && \
	pip install -U pip numpy wheel packaging && \
	cd /tensorflow && \
	printf "$bazelrc" >> .bazelrc && \
	bazel build $bazel_opts tensorflow/tools/pip_package:build_pip_package && \
	mkdir /tensorflow/out && \
	./bazel-bin/tensorflow/tools/pip_package/build_pip_package /tensorflow/out --cpu && \
	pip install /tensorflow/out/* --no-deps && \
	pip uninstall -y wheel packaging && \
	apt purge -y git python3-dev gcc g++ --autoremove && \
	rm -rf /var/lib/apt/lists/* && \
	rm /usr/bin/bazel && \
	rm -r /root/.cache && \
	rm -r /tensorflow


# Install minimum amount of TensorFlow python dependencies.
RUN pip install absl-py==1.0.0 protobuf==3.20.0 \
	wrapt==1.14.0 opt_einsum==3.3.0 gast==0.5.3 \
	astunparse==1.6.3 termcolor==1.1.0 flatbuffers==2.0

MQTT Integration

This project is exactly what I'm looking for to work on some home automation projects (Frigate is pretty heavy-weight, and I'm not looking for security video recording, just automation based on location, posture, etc.). The tools I'm using so far often support MQTT as a way to trigger events, so one way or another I'd like to pipe the results out to MQTT.

It wouldn't be too difficult to write a separate service that just connects to the /stream WS and forwards all the returned JSON to MQTT, but it would mean a separate service to launch, monitor, etc.. Alternatively, I could try to add some MQTT info to the DetectRequest (sorry if I'm getting some of these names wrong, on a phone so it's hard to tab around) so that DOODS could just optionally send the JSON itself (at the expense of having to include MQTT libraries).

This definitely falls outside the scope of "REST service", so this isn't really a feature request. I just figured before I fork and start playing around with things I would ask and see if you had any thoughts on which approach would work best since you know the DOODS code.

Nvidia GPU support with Intel CPU

Hello,
I am not experienced with the differences of the various docker images, however, I could get a workstation with a Nvidia Quadro K420 and an Intel Core i7 CPU.
Could I use the amd64-gpu image with this hardware to get the GPU support or is it limited to amd CPUs?
Thanks for your support in advance.

How to add a model to TensorFlow?

Greetings,

I've originally posted this on self-hosted subreddit and it was really helpful to get me started.

My youngest son has Autism Spectrum Disorder (ASD), he's 5 now. Recently he developed a habit of taking off his clothes and playing around without any clothes on! I already have a few cameras around the house, however, I was wondering if anyone knows a solution that can detect if my son is moving around the house without any clothes on so I can fire up automation and play a pre-recorded voice note on speakers in the house asking him to put on his clothes again!

So I've managed to get a live camera feed into Hom Assistant, using (https://github.com/snowzach/doods2) also was able to detect objects and persons using (tensorflow) and HA saves a snapshot for labels I want to capture, such as "person" or "people". Seems to be working just fine.

I was looking for some pre-trained models to detect nudity / NSFW and found some such as: https://github.com/minto5050/NSFW-detection. However, I couldn't manage to upload this model and run it for some reason. I've downloaded the model and labels files and placed them in the models and declared it in the config file but it isn't working.

Here is how config.yaml lookslike:


doods:
  log: detections
  boxes:
    enabled: True
    boxColor: [0, 255, 0]
    boxThickness: 1
    fontScale: 1.2
    fontColor: [0, 255, 0]
    fontThickness: 1
  regions:
    enabled: True
    boxColor: [255, 0, 255]
    boxThickness: 1
    fontScale: 1.2
    fontColor: [255, 0, 255]
    fontThickness: 1
  globals:
    enabled: True
    fontScale: 1.2
    fontColor: [255, 255, 0]
    fontThickness: 1
  detectors:
    - name: default
      type: tflite
      modelFile: models/coco_ssd_mobilenet_v1_1.0_quant.tflite
      labelFile: models/coco_labels0.txt

    - name: tensorflow
      type: tensorflow
      modelFile: models/faster_rcnn_inception_v2_coco_2018_01_28.pb
      labelFile: models/coco_labels1.txt

    - name: nsfws
      type: tensorflow
      modelFile: models/NSFW.tflite
      labelFile: models/dict.txt

    - name: pytorch
      type: pytorch
      modelFile: ultralytics/yolov5,yolov5s
mqtt:
  metrics: true
  broker:
    host: "mqttBroker"
    #port: 1883
    #user: "username"
    #password: "password"
  requests:
    - id: firstrequest
      detector_name: default
      preprocess: []
      separate_detections: false
      crop: false
      binary_images: false
      detect:
        "*": 50
      regions:
      - top: 0.1
        left: 0.1
        bottom: 0.9
        right: 0.9
        detect:
          "*": 50
        covers: false
      data: rtsp://192.168.2.231/ch0_0.h264 

After restarting the container, I get this in the log:

2022-05-15 16:08:19,836 - doods.doods - INFO - Registered detector type:tflite name:default
2022-05-15 16:08:21,966 - doods.doods - INFO - Registered detector type:tensorflow name:tensorflow
2022-05-15 16:08:21,967 - doods.doods - ERROR - Could not create detector tensorflow/nsfws: Error parsing message with type 'tensorflow.GraphDef'
Using cache found in /root/.cache/torch/hub/ultralytics_yolov5_master
YOLOv5 ๐Ÿš€ 2022-5-10 torch 1.10.2+cu102 CPU

Fusing layers... 
YOLOv5s summary: 213 layers, 7225885 parameters, 0 gradients
Adding AutoShape... 
2022-05-15 16:08:24,158 - doods.doods - INFO - Registered detector type:pytorch name:pytorch
2022-05-15 16:08:24,208 - uvicorn.error - INFO - Started server process [1]
2022-05-15 16:08:24,208 - uvicorn.error - INFO - Waiting for application startup.
2022-05-15 16:08:24,208 - uvicorn.error - INFO - Application startup complete.
2022-05-15 16:08:24,209 - uvicorn.error - INFO - Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)
GitHub Discord Credits

Only NSFW detector is giving error.

Any thoughts on how can I make this model or any other similar model work for my purpose above?

Thanks and much appreciated.

Coral USB error: Could not load EdgeTPU detector

Hi there,

I need help with my doods2 setup. I'm trying to start doods2 with my coral usb device and it's failing to create the tflite detector.

$ docker run -it -p 7070:8080 --privileged --device /dev/bus/usb -v /path_example/doods2/config.yaml:/opt/doods/config.yaml -v /path_example/doods2/
models:/opt/doods/models snowzach/doods2:latest
2022-07-18 00:37:58,763 - doods.doods - ERROR - Could not create detector tflite/default: Could not load EdgeTPU detector
2022-07-18 00:37:59,030 - uvicorn.error - INFO - Started server process [1]
2022-07-18 00:37:59,031 - uvicorn.error - INFO - Waiting for application startup.
2022-07-18 00:37:59,033 - uvicorn.error - INFO - Application startup complete.
2022-07-18 00:37:59,034 - uvicorn.error - INFO - Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)

config.yaml

server:
  host: 0.0.0.0
  port: 8080
  metrics: true
logging:
  level: all
doods:
  log: detections
  boxes:
    enabled: True
    boxColor: [0, 255, 0]
    boxThickness: 1
    fontScale: 1.2
    fontColor: [0, 255, 0]
    fontThickness: 1
  regions:
    enabled: True
    boxColor: [255, 0, 255]
    boxThickness: 1
    fontScale: 1.2
    fontColor: [255, 0, 255]
    fontThickness: 1
  globals:
    enabled: True
    fontScale: 1.2
    fontColor: [255, 255, 0]
    fontThickness: 1
  detectors:
    - name: default
      type: tflite
      modelFile: /opt/doods/models/ssdlite_mobiledet_coco_qat_postprocess_edgetpu.tflite
      labelFile: /opt/doods/models/coco_labels.txt
      hwAccel: true
$ lsusb
Bus 002 Device 011: ID 18d1:9302 Google Inc. 

I'm running on a Raspberry Pi 4B. I've tried to connect the coral device straight into the USB2.0 and USB3.0 pi slots as well as connected to a powered USB3.0 hub.

When I attach the shell of the container and check for libedgetpu.so.1.0, I can see it present.

root@2a030aef58c4:/usr/lib# ls /usr/lib/aarch64-linux-gnu/libedgetpu.so.1.0 -ltr
-rw-r--r-- 1 root root 1135880 Jul  9  2021 /usr/lib/aarch64-linux-gnu/libedgetpu.so.1.0

Non-Quantized Model Breaks Detector

Good evening!

Giving this a shot and running into the first clear error. Using the Yolov5-built and exported to TF-Lite model, I'm getting the following:

ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/uvicorn/protocols/http/h11_impl.py", line 373, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "/usr/local/lib/python3.8/dist-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__
    return await self.app(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/fastapi/applications.py", line 208, in __call__
    await super().__call__(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/applications.py", line 112, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/errors.py", line 181, in __call__
    raise exc
  File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/exceptions.py", line 82, in __call__
    raise exc
  File "/usr/local/lib/python3.8/dist-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 656, in __call__
    await route.handle(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 259, in handle
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 61, in app
    response = await func(request)
  File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 226, in app
    raw_response = await run_endpoint_function(
  File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 159, in run_endpoint_function
    return await dependant.call(**values)
  File "/opt/doods/api.py", line 27, in detect
    detect_response = self.doods.detect(detect_request)
  File "/opt/doods/doods.py", line 108, in detect
    ret = detector.detect(image)
  File "/opt/doods/detectors/tflite.py", line 57, in detect
    self.input_data = (np.float32(self.input_data) - input_mean) / input_std
AttributeError: 'TensorflowLite' object has no attribute 'input_data'```

Note the model is not quantized - I probably should quantize it, but I'm not sure how to actually do that yet. :-P

If I have HA hit the 'default' detector which uses a quantized TFLite model, no error.

Width and height missing from detector list

I'm using this to calculate the aspect ratio.

curl 127.0.0.1:8080/detectors

doods1
"detectors": [
  {
    "name": "default",
    "type": "tflite",
    "model": "models/coco_ssd_mobilenet_v1_1.0_quant.tflite",
    "labels": [],
    "width": 300,
    "height": 300,
    "channels": 3
  }
]
doods2
"detectors": [
  {
    "name": "default",
    "type": "tensorflow2",
    "model": "models/coco_ssd_mobilenet_v1_1.0_quant.tflite",
    "labels": [],
    "width": 0,
    "height": 0
  }
]

Deepstack model error

Love the new rewrite! I'd been using v1 for some time and just moved over to v2 container recently. Great stuff!

The recent addition of the deepstack models does not seem to be working. I see in issue #28 after it was closed that there's a report that trying to get a deepstack model working resulted in a error. I'm getting the same error with two different .pt models

Error:

2022-03-12 21:30:35,452 - uvicorn.access - INFO - 172.17.0.1:36888 - "POST /detect HTTP/1.1" 500
2022-03-12 21:30:35,452 - uvicorn.error - ERROR - Exception in ASGI application
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/uvicorn/protocols/http/h11_impl.py", line 373, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "/usr/local/lib/python3.8/dist-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__
    return await self.app(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/fastapi/applications.py", line 208, in __call__
    await super().__call__(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/applications.py", line 112, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/errors.py", line 181, in __call__
    raise exc
  File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 57, in __call__
    task_group.cancel_scope.cancel()
  File "/usr/local/lib/python3.8/dist-packages/anyio/_backends/_asyncio.py", line 574, in __aexit__
    raise exceptions[0]
  File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 30, in coro
    await self.app(scope, request.receive, send_stream.send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/exceptions.py", line 82, in __call__
    raise exc
  File "/usr/local/lib/python3.8/dist-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 656, in __call__
    await route.handle(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 259, in handle
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 61, in app
    response = await func(request)
  File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 226, in app
    raw_response = await run_endpoint_function(
  File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 159, in run_endpoint_function
    return await dependant.call(**values)
  File "/opt/doods/api.py", line 40, in detect
    detect_response = self.doods.detect(detect_request)
  File "/opt/doods/doods.py", line 127, in detect
    ret = detector.detect(image)
  File "/opt/doods/detectors/deepstack.py", line 45, in detect
    results = self.torch_model(image, augment=False)[0]
  File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "/root/.cache/torch/hub/ultralytics_yolov5_master/models/yolo.py", line 126, in forward
    return self._forward_once(x, profile, visualize)  # single-scale inference, train
  File "/root/.cache/torch/hub/ultralytics_yolov5_master/models/yolo.py", line 149, in _forward_once
    x = m(x)  # run
  File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "/root/.cache/torch/hub/ultralytics_yolov5_master/models/yolo.py", line 61, in forward
    if self.inplace:
  File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1177, in __getattr__
    raise AttributeError("'{}' object has no attribute '{}'".format(
AttributeError: 'Detect' object has no attribute 'inplace'

Both of the models work with the deepstack service itself, and doods properly reports the labels embedded in the models

    {
      "name": "dark",
      "type": "deepstack",
      "model": "external/models/dark.pt",
      "labels": [
        "Bicycle",
        "Boat",
        "Bottle",
        "Bus",
        "Car",
        "Cat",
        "Chair",
        "Cup",
        "Dog",
        "Motorbike",
        "People",
        "Table"
      ],
      "width": 0,
      "height": 0
    },
    {
      "name": "combined",
      "type": "deepstack",
      "model": "external/models/combined.pt",
      "labels": [
        "person",
        "bicycle",
        "car",
        "motorcycle",
        "bus",
        "truck",
        "bird",
        "cat",
        "dog",
        "horse",
        "sheep",
        "cow",
        "bear",
        "deer",
        "rabbit",
        "raccoon",
        "fox",
        "coyote",
        "possum",
        "skunk",
        "squirrel",
        "pig",
        ""
      ],
      "width": 0,
      "height": 0
    }

so the models seem intact.

My config for the two models is minimal:

    - name: dark
      type: deepstack
      modelFile: external/models/dark.pt
    - name: combined
      type: deepstack
      modelFile: external/models/combined.pt

do I need more than that or is there some issue with the deepstack integration at the moment?

Crashes on Raspbian 10

Thanks for all your work!

I am running Doods on a Raspberry Pi 4B, running Raspbian 10, without problem. However, Doods2 crashes just after start, saying:

Fatal Python error: pyinit_main: can't initialize time
Python runtime state: core initialized
PermissionError: [Errno 1] Operation not permitted

If I start the container with this command it works:
docker --privileged run -it -p 8080:8080 snowzach/doods2:latest

So, just to let anyone else know, having that problem.

MQTT stop working

Hi,
doods2 works great :)
But after a few time/detections it do not send to the MQTT server.

Here my config file:

server:
  host: 0.0.0.0
  port: 8080
  metrics: true
doods:
  log: detections
  boxes:
    enabled: True
    boxColor: [0, 255, 0]
    boxThickness: 1
    fontScale: 1.2
    fontColor: [0, 255, 0]
    fontThickness: 1
  regions:
    enabled: True
    boxColor: [255, 0, 255]
    boxThickness: 1
    fontScale: 1.2
    fontColor: [255, 0, 255]
    fontThickness: 1
  globals:
    enabled: True
    fontScale: 1.2
    fontColor: [255, 255, 0]
    fontThickness: 1
  detectors:
    - name: default
      type: tflite
      modelFile: models/coco_ssd_mobilenet_v1_1.0_quant.tflite
      labelFile: models/coco_labels0.txt
mqtt:
  metrics: true
  broker: 
    host: "xxx.xxx.xxx.xxx"
    #port: 1883
    #user: "username"
    #password: "password"
  requests:
    - id: ipcam1
      detector_name: default
      preprocess: []
      data: b64
      image: jpeg
      throttle: 2
      separate_detections: true
      crop: false
      binary_images: false
      detect:
        "person": 50
      regions:
      - top: 0
        left: 0
        bottom: 0
        right: 0
        detect:
          "person": 50
        covers: false
      data: rtsp://xxx:xxx@cam:554/11

and the docker-compose file:

version: "3.6"
services:
  doods2:
    command:
      - mqtt
    container_name: doods2
    entrypoint:
      - python3
      - main.py
    environment:
      - CONFIG_FILE=xxx.yaml
      - PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
      - DEBIAN_FRONTEND=noninteractive
      - LANG=C.UTF-8
      - TF_CPP_MIN_LOG_LEVEL=3
      - TZ=Europe/Berlin
    image: snowzach/doods2:latest
    ports:
      - 8010:8080/tcp
    volumes:
      - ./xxx.yaml:/opt/doods/xxx.yaml

in the docker logs I can see the detections, so the detections are ok, only the mqtt connection is not functional.

Thanks!

yolov5s doesn't appear to be present

The documentation on the github readme says that yolov5s should be one of the built in models available, but the /detectors page doesn't list it as available.

I only see two detectors available -- "name":"default" and "name":"tensorflow"

Bird-Model with index-error. How to resolve?

Great Happiness for the new dood2!!
hoped that it solved my problem with the bird-model.

https://tfhub.dev/google/lite-model/aiy/vision/classifier/birds_V1/3

as is spent the whole day to get it succesfull running in a bad python script - the new doods2 arrived.
great. ๐ŸŒน

doods 2 loads the model and the label-file
(csv-format with comma, but also error without commas)
but throws an error on detections in the index

some googling said: convert the model to "newer" tf-lite ?

INFO:     Started server process [1]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)
INFO:     192.168.14.135:56005 - "GET / HTTP/1.1" 304 Not Modified
INFO:     192.168.14.135:56005 - "POST /image HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/uvicorn/protocols/http/h11_impl.py", line 373, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "/usr/local/lib/python3.8/dist-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__
    return await self.app(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/fastapi/applications.py", line 208, in __call__
    await super().__call__(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/applications.py", line 112, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/errors.py", line 181, in __call__
    raise exc
  File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/exceptions.py", line 82, in __call__
    raise exc
  File "/usr/local/lib/python3.8/dist-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 656, in __call__
    await route.handle(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 259, in handle
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 61, in app
    response = await func(request)
  File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 226, in app
    raw_response = await run_endpoint_function(
  File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 159, in run_endpoint_function
    return await dependant.call(**values)
  File "/opt/doods/api.py", line 38, in image
    detect_response = self.doods.detect(detect_request)
  File "/opt/doods/doods.py", line 108, in detect
    ret = detector.detect(image)
  File "/opt/doods/detectors/tflite.py", line 64, in detect
    classes = self.interpreter.get_tensor(self.output_details[1]['index'])[0] # Class index of detected objects
IndexError: list index out of range

image

both label-files dont work:
image

Doods2 still doesn't work after update (See latest #52)

Hey I've still got the same Problem. Using a Model which was trained on a recent yolov5 Docker Image I'm getting the following Error Messages:

2022-09-10 17:02:25,639 - uvicorn.error - ERROR - Exception in ASGI application
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/uvicorn/protocols/http/h11_impl.py", line 373, in run_asgi
result = await app(self.scope, self.receive, self.send)
File "/usr/local/lib/python3.8/dist-packages/uvicorn/middleware/proxy_headers.py", line 75, in call
return await self.app(scope, receive, send)
File "/usr/local/lib/python3.8/dist-packages/fastapi/applications.py", line 208, in call
await super().call(scope, receive, send)
File "/usr/local/lib/python3.8/dist-packages/starlette/applications.py", line 112, in call
await self.middleware_stack(scope, receive, send)
File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/errors.py", line 159, in call
await self.app(scope, receive, _send)
File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 57, in call
task_group.cancel_scope.cancel()
File "/usr/local/lib/python3.8/dist-packages/anyio/_backends/_asyncio.py", line 572, in aexit
raise ExceptionGroup(exceptions)
anyio._backends.asyncio.ExceptionGroup: 2 exceptions were raised in the task group:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 55, in call
response = await self.dispatch_func(request, call_next)
File "/usr/local/lib/python3.8/dist-packages/prometheus_fastapi_instrumentator/instrumentation.py", line 172, in dispatch_middleware
raise e from None
File "/usr/local/lib/python3.8/dist-packages/prometheus_fastapi_instrumentator/instrumentation.py", line 169, in dispatch_middleware
response = await call_next(request)
File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 37, in call_next
raise RuntimeError("No response returned.")
RuntimeError: No response returned.
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 30, in coro
await self.app(scope, request.receive, send_stream.send)
File "/usr/local/lib/python3.8/dist-packages/starlette/exceptions.py", line 82, in call
raise exc
File "/usr/local/lib/python3.8/dist-packages/starlette/exceptions.py", line 71, in call
await self.app(scope, receive, sender)
File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 656, in call
await route.handle(scope, receive, send)
File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 259, in handle
await self.app(scope, receive, send)
File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 61, in app
response = await func(request)
File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 234, in app
response_data = await serialize_response(
File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 137, in serialize_response
raise ValidationError(errors, field.type
)
pydantic.error_wrappers.ValidationError: 1 validation error for DetectorsResponse
response -> detectors -> 0 -> labels
value is not a valid list (type=type_error.list)

I've already raised an Issue on the Yolov5 github Page ultralytics/yolov5#9360
but it seems that there is still an issue on the doods side. In the github issue we discussed a recent change in the class names.
So maybe that's the Problem ?

[FR:] Facedetection models possible?

Using MQTT in DOODS

Hi,
I would like to know, how to use the MQTT Implementation in Doods. There is a mqtt section in the config.yaml file but no matter what I do I can't get Doods to connect to my broker.
Also I haven't found any documentation on that Subject. So do you have any suggestions what I'm doing wrong ?

Error installing on armv7l-based machine

After running (latest tag returns same error):

docker run -it -p 8080:8080 snowzach/doods2:armv7l

I get:

Unable to find image 'snowzach/doods2:armv7l' locally
armv7l: Pulling from snowzach/doods2
Digest: sha256:8393763dc3067984fd9f35e71571b9fadf14b515b2577cbd0da4358fc3f5268c
Status: Downloaded newer image for snowzach/doods2:armv7l
/usr/local/lib/python3.8/dist-packages/tensorflow_io/python/ops/init.py:98: UserWarning: unable to load libtensorflow_io_plugins.so: unable to open file: libtensorflow_io_plugins.so, from paths: ['/usr/local/lib/python3.8/dist-packages/tensorflow_io/python/ops/libtensorflow_io_plugins.so']
caused by: ["[Errno 2] The file to load file system plugin from does not exist.: '/usr/local/lib/python3.8/dist-packages/tensorflow_io/python/ops/libtensorflow_io_plugins.so'"]
warnings.warn(f"unable to load libtensorflow_io_plugins.so: {e}")
/usr/local/lib/python3.8/dist-packages/tensorflow_io/python/ops/init.py:104: UserWarning: file system plugins are not loaded: unable to open file: libtensorflow_io.so, from paths: ['/usr/local/lib/python3.8/dist-packages/tensorflow_io/python/ops/libtensorflow_io.so']
caused by: ['/usr/local/lib/python3.8/dist-packages/tensorflow_io/python/ops/libtensorflow_io.so: cannot open shared object file: No such file or directory']
warnings.warn(f"file system plugins are not loaded: {e}")
Traceback (most recent call last):
File "main.py", line 35, in
main()
File "main.py", line 30, in main
api.run()
File "/opt/doods/api.py", line 83, in run
uvicorn.run(self.api, host=self.config.host, port=self.config.port)
File "/usr/local/lib/python3.8/dist-packages/uvicorn/main.py", line 452, in run
server.run()
File "/usr/local/lib/python3.8/dist-packages/uvicorn/server.py", line 68, in run
return asyncio.run(self.serve(sockets=sockets))
File "/usr/lib/python3.8/asyncio/runners.py", line 39, in run
loop = events.new_event_loop()
File "/usr/lib/python3.8/asyncio/events.py", line 758, in new_event_loop
return get_event_loop_policy().new_event_loop()
File "/usr/lib/python3.8/asyncio/events.py", line 656, in new_event_loop
return self._loop_factory()
File "/usr/lib/python3.8/asyncio/unix_events.py", line 54, in init
super().init(selector)
File "/usr/lib/python3.8/asyncio/selector_events.py", line 55, in init
super().init()
File "/usr/lib/python3.8/asyncio/base_events.py", line 397, in init
self._clock_resolution = time.get_clock_info('monotonic').resolution
PermissionError: [Errno 1] Operation not permitted
Exception ignored in: <function BaseEventLoop.del at 0x767080b8>
Traceback (most recent call last):
File "/usr/lib/python3.8/asyncio/base_events.py", line 654, in del
_warn(f"unclosed event loop {self!r}", ResourceWarning, source=self)
File "/usr/lib/python3.8/asyncio/base_events.py", line 416, in repr
f'<{self.class.name} running={self.is_running()} '
File "/usr/lib/python3.8/asyncio/base_events.py", line 1878, in get_debug
return self._debug
AttributeError: '_UnixSelectorEventLoop' object has no attribute '_debug'
sys:1: RuntimeWarning: coroutine 'Server.serve' was never awaited

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.