A plug-and-play setup for remote YOLO detection via WebSockets. Testers run two Docker containers on their machine:
- a local YOLO HTTP service (does the actual detection on images)
- a YOLO Worker (connects out to our public WS endpoint, receives jobs, runs local YOLO, sends results back)
The coordinator sends jobs over the public WebSocket endpoint. Results (JSON or rendered PNG) come back over the same WS connection.
Pull and run the YOLO HTTP container. It exposes a simple /detect endpoint.
Window & Mac:
docker run --rm -p 8000:8000 openmindagi/yolo-detect:v0.1.0
Linux:
docker run --rm --network host --name yolo-api openmindagi/yolo-detect:v0.1.0Replace the host, API key, and client id (optional) as needed.
The worker connects to:
wss://api-dev.openmind.org/api/core/pi?api_key=<YOUR_API_KEY>&name=worker&client_id=<CLIENT_ID>
docker run --rm --name yolo-worker \
-e YOLO_HOST=api.openmind.org \
-e YOLO_SCHEME=wss \
-e YOLO_API_KEY=<YOUR_API_KEY> \
-e YOLO_API_URL=http://host.docker.internal:8000/detect \
-e CLIENT_NAME=worker \
-e CLIENT_ID=node_runner \
openmindagi/yolo-ws-worker:v0.1.0# Start worker on host network; point to 127.0.0.1:8000
# If your YOLO HTTP used --network host above:
docker run --rm --name yolo-worker \
-e YOLO_HOST=api.openmind.org \
-e YOLO_SCHEME=wss \
-e YOLO_API_KEY=<YOUR_API_KEY> \
-e YOLO_API_URL=http://127.0.0.1:8000/detect \
-e CLIENT_ID=node_runner \
-e CLIENT_NAME=worker \
openmindagi/yolo-ws-worker:v0.1.0
You will need the send_yolo_job.py downloaded from this github repo to send job requests to worker
The coordinator/script can be run from anywhere that can reach the public WS endpoint.
Saves an annotated image locally as result.png.
python send_yolo_job.py \
--host api.openmind.org \
--scheme wss \
--api-key <YOUR_API_KEY> \
--client-name coordinator \
--client-id sender1 \
--image-url https://ultralytics.com/images/bus.jpg \
--render \
--out result.png
-
You should see an
ACKfrom a worker, then aRESULT. -
If
--renderis used, the client will saveresult.pnglocally. -
For JSON-only detections, omit
--render:
python send_yolo_job.py \
--host api.openmind.org \
--scheme wss \
--api-key <YOUR_API_KEY> \
--client-name coordinator \
--client-id sender1 \
--image-url https://ultralytics.com/images/bus.jpg