Skip to content

OpenMind/om-yolo-ws

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

om-yolo-ws

A plug-and-play setup for remote YOLO detection via WebSockets. Testers run two Docker containers on their machine:

  1. a local YOLO HTTP service (does the actual detection on images)
  2. 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.

What you’ll run on the tester machine

Start the local YOLO HTTP service

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.0

Start the YOLO Worker

Replace 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>

macOS / Windows (Docker Desktop)
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
Linux
# 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

Sending jobs (coordinator side)

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.

Rendered image result (PNG)

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 ACK from a worker, then a RESULT.

  • If --render is used, the client will save result.png locally.

  • 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

About

A plug-and-play setup for remote YOLO detection via WebSockets.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •