Object Detection
Comprehensive guide for using SegVision API for object detection
Object Detection API
Request
- Method: POST
- URL: /api/qwen-open-ai
- Headers:
Content-Type: application/json
- Body:
{ "imageBase64": "base64-encoded image data", "prompt": "optional custom instruction, uses default if not provided" }
Response
-
Success Response:
{ "bbox_2d": [[x1, y1, x2, y2]], "label": ["detected object labels"], "description": "object description" } -
Error Response:
{ "error": "error message", "code": error status code }
Error Codes
401: User not logged in403: Insufficient credits400: Image data is empty500: Server internal error
Example
// Example request
const response = await fetch('/api/qwen-open-ai', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
imageBase64: "data:image/jpeg;base64,/9j/4AAQSkZJRg...",
prompt: "Detect all vehicle positions in the image"
})
});
// Example response
{
"bbox_2d": [[100, 150, 300, 350], [400, 200, 600, 400]],
"label": ["car", "truck"],
"description": "The image contains two motor vehicles"
}Notes
- User login and sufficient credits are required
- Image base64 data should not exceed 10MB
- Default prompt: "Outline the positions of traffic accidents in the image and output all coordinates in JSON format"
- The returned bbox_2d format is a 2D array of [x1,y1,x2,y2]
Code Examples
curl -X POST "http://segvision.satxspace.org/api/qwen-open-ai" \
-H "Content-Type: application/json" \
-d '{
"imageBase64": "data:image/jpeg;base64,your-image-base64-data",
"prompt": "Detect traffic accidents in the image"
}'