snowzach / doods2

API for detecting objects in images and video streams using Tensorflow
MIT License
221 stars 28 forks source link

Could the documentation include a simple example? #72

Closed tokenwizard closed 1 year ago

tokenwizard commented 1 year ago

I am trying to write a bash script to take an image in the current directory "index.jpg" and pass the base64 value of that file to the DOODS2 server via POST.

The response i am getting is: {"detail":[{"loc":["body"],"msg":"instance of DetectRequest, tuple or dict expected","type":"type_error.dataclass","ctx":{"class_name":"DetectRequest"}}]}%

Here is my current script:

!/bin/bash

image=./index.jpg content=$(base64 $image) body='{ "id": "test", "detector_name": "mobiledet_320x320_edgetpu", "data": "$content", "image": "jpeg", "throttle": 5, "preprocess": [ "grayscale" ], "detect": { "person": 50 }, "regions": [ {"id": "someregion", "top": 0.1, "left": 0.1, "bottom": 0.9, "right": 0.9, "detect": {"*":50}, "covers": false} ], "separate_detections" : false, "crop": false, "binary_images" : false, }'

url="http://192.168.7.26:8081/detect"

curl -X POST -d "$body" "$url"

(Not sure why wrapping that in code tags did not work like it did on the response.)

snowzach commented 1 year ago

Sure... I added an example I had in the original DOODS repo: https://github.com/snowzach/doods2#cli-example

tokenwizard commented 1 year ago

That was enough to help me get my script working.

Thanks!