Sign inSign up

cpcontainer/image-detect-api

By cpcontainer

Updated 12 months ago

Image
0

855

cpcontainer/image-detect-api repository overview

YOLOv5n Image Detection API

Simple Flask API that accepts images and returns YOLOv5n object detections as JSON.

Endpoints
  • GET /health – readiness/liveness check
  • POST /detect – submit an image via multipart upload or via URL in JSON
Run on Ericsson Routers:

Navigate to System > Containers > Projects in your group or device configuration.
Click Add.
Give the project a name ("API"), then click the Compose tab.
Paste the following into the compose area:

version: '2.4'
services:
  api:
    image: cpcontainer/image-detect-api
    container_name: api
    ports:
      - '5000:5000'

The service will listen on http://{router_ip}:5000.

Usage

File upload:

curl -s -X POST http://localhost:5000/detect \
  -F image=@/path/to/image.jpg

Image URL:

curl -s -X POST http://localhost:5000/detect \
  -H 'Content-Type: application/json' \
  -d '{"url":"https://example.com/image.jpg"}'

Health check:

curl -s http://localhost:5000/health
Response format
{
  "num_detections": 2,
  "detections": [
    {
      "class": "person",
      "class_id": 0,
      "confidence": 0.87,
      "box": { "x1": 12, "y1": 34, "x2": 123, "y2": 210 }
    }
  ]
}
Notes
  • The model (yolov5n) is loaded once at startup via torch.hub.
  • Base image: ultralytics/yolov5:latest-arm64. For non-arm64 hosts, switch the base image accordingly.

Tag summary

Content type

Image

Digest

sha256:c7448b507

Size

605.8 MB

Last updated

12 months ago

docker pull cpcontainer/image-detect-api