Skip to content

Object Detection

Finds objects in an image and returns each one's label + bounding box (x, y, w, h) + confidence score.

Available models

ModelNote
spook-detect (recommended)YOLO-style, real-time, 80+ COCO classes

Two paths

New alias path (v2.0.0+, preferred)

bash
curl https://app.qevron.ai/v1/vision/detect \
  -H "Authorization: Bearer sk-..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "spook-detect",
    "image": "data:image/jpeg;base64,...",
    "threshold": 0.5
  }'

Legacy (custom_test)

bash
curl https://app.qevron.ai/api/channel/85/custom_test \
  -H "Authorization: Bearer sk-..." \
  -d '{"model": "spook-detect", "image": "data:image/jpeg;base64,..."}'

Python

python
import base64, requests

with open("street.jpg", "rb") as f:
    b64 = base64.b64encode(f.read()).decode()

resp = requests.post(
    "https://app.qevron.ai/v1/vision/detect",
    headers={"Authorization": "Bearer sk-..."},
    json={
        "model": "spook-detect",
        "image": f"data:image/jpeg;base64,{b64}",
        "threshold": 0.4,
    },
)
detections = resp.json().get("detections", [])
for d in detections:
    print(f"{d['label']:10s} score={d['score']:.2f}  bbox={d['bbox']}")

Response shape

json
{
  "detections": [
    {"label": "person",  "score": 0.92, "bbox": [120, 80, 240, 480]},
    {"label": "car",     "score": 0.88, "bbox": [600, 200, 320, 180]},
    {"label": "bicycle", "score": 0.71, "bbox": [50, 300, 90, 140]}
  ]
}

bbox is [x, y, width, height] (top-left corner + size, in pixels).

threshold

Up to what confidence score to include. Default 0.5:

  • 0.3 — more candidates, more false positives
  • 0.5 — balanced (default)
  • 0.7 — only very confident ones

A low threshold + client-side filter is the most flexible pattern.

Drawing boxes

python
from PIL import Image, ImageDraw

img = Image.open("street.jpg")
draw = ImageDraw.Draw(img)
for d in detections:
    x, y, w, h = d["bbox"]
    draw.rectangle([x, y, x+w, y+h], outline="red", width=3)
    draw.text((x, y-10), f"{d['label']} {d['score']:.2f}", fill="red")
img.save("annotated.jpg")

Troubleshooting

  • Nothing detected → lower the threshold (0.3) or check image quality.
  • Wrong class → spook-detect is trained on COCO 80 classes; medical / industrial niches need a custom model.
  • Slow → downscale to 1280 px. Detect models prefer square input; the server resizes but large inputs travel slowly over the wire.

Next: OCR · Image generation

Qevron — AI gateway. Arpanet / OpenAI / Anthropic / Gemini compatible.