Object detection
POST /api/v5/detect/yolo
Performs object detection with a YOLO model on an image and returns the detections, including bounding box coordinates, classes, and confidences. You can also configure the model weights, input size, confidence threshold, and IoU threshold.
Supported access tokens
- AtomGit user access tokens
Anonymous access allowed
This endpoint allows anonymous access.
Request parameters
Request Body:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"model": {
"description": "Name of the yolo11 model weight file; enum: `yolo11n.pt` / `yolo11s.pt` / `yolo11m.pt` / `yolo11l.pt` / `yolo11x.pt`",
"type": "string",
"enum": ["yolo11n.pt", "yolo11s.pt", "yolo11m.pt", "yolo11l.pt", "yolo11x.pt"],
"examples": ["yolo11n.pt"]
},
"source": {
"description": "Base64-encoded image to detect (Data URL)",
"type": "string",
"examples": ["data:image/jpeg;base64,/9j/4AAQSkZJRgABAQXXXXXXX"]
},
"imgsz": {
"description": "Input image size; valid range is 32 to 1280 pixels",
"type": "integer",
"minimum": 32,
"maximum": 1280,
"examples": [640]
},
"conf": {
"description": "Prediction confidence threshold; valid range is 0.01 to 1.0",
"type": "number",
"minimum": 0.01,
"maximum": 1,
"examples": [0.5]
},
"iou": {
"description": "Intersection-over-union (IoU) threshold; valid range is 0.0 to 0.95",
"type": "number",
"minimum": 0,
"maximum": 0.95,
"examples": [0.45]
}
},
"required": ["model", "source", "imgsz", "conf", "iou"]
}
Response parameters
images array item object
images[].results array item object
images[].results[].box object
images[].speed object
Error response
401 Unauthenticated
{
"error": "unauthorized",
"message": "Missing or invalid access token"
}
400 Invalid parameters
{
"error": "invalid_request",
"message": "Parameter model cannot be empty"
}
HTTP status codes
Request example
Parameter notes
Replace <token> with your AtomGit user access token (can be omitted for anonymous calls).
cURL
curl -X POST 'https://api.atomgit.com/api/v5/detect/yolo' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <token>' \
-d '{
"model": "yolo11n.pt",
"source": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQXXXXXXX",
"imgsz": 640,
"conf": 0.5,
"iou": 0.45
}'
JavaScript
// Native fetch (Node.js 18+ / browsers)
const response = await fetch("https://api.atomgit.com/api/v5/detect/yolo", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": "Bearer <YOUR-TOKEN>",
},
body: JSON.stringify({
model: "yolo11n.pt",
source: "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQXXXXXXX",
imgsz: 640,
conf: 0.5,
iou: 0.45,
}),
});
if (!response.ok) {
throw new Error(`Request failed: ${response.status}`);
}
const data = await response.json();
console.log(data);
Python
import requests
resp = requests.post(
"https://api.atomgit.com/api/v5/detect/yolo",
headers={
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": "Bearer <YOUR-TOKEN>",
},
json={
"model": "yolo11n.pt",
"source": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQXXXXXXX",
"imgsz": 640,
"conf": 0.5,
"iou": 0.45,
},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
Response example
Status code: 200
{
"images": [
{
"results": [
{
"box": {
"x1": 14.55554,
"x2": 72.45978,
"y1": 116.72369,
"y2": 268.92963
},
"class": 0,
"confidence": 0.83583,
"name": "person"
}
],
"shape": [203, 320],
"speed": {
"inference": 56.13449,
"postprocess": 0.05426,
"preprocess": 21.20275
}
}
],
"metadata": {
"functionTimeAlive": 163779.863,
"functionTimeCall": 0.57,
"imageCount": 1,
"model": "yolo11n-cls.pt",
"version": {
"python": "3.11.14",
"torch": "2.9.1+cpu",
"torchvision": "0.24.1+cpu",
"ultralytics": "8.3.228"
}
}
}
Error codes