1.7 KiB
1.7 KiB
Memory Module Detection API Documentation
Overview
Flask API for detecting memory modules on motherboard images using YOLOv8. Processes uploaded images and returns bounding box coordinates with confidence scores.
Base URL
http://localhost:5000
Endpoints
1. Root Endpoint
GET /
- Returns the test interface HTML page
- Response:
test.html
2. Image Detection
POST /detect
- Accepts image uploads for processing
- Request:
curl -X POST -F "image=@motherboard.jpg" http://localhost:5000/detect - Successful Response (200):
{ "detections": [ { "box": [x1,y1,x2,y2], "confidence": 0.95, "class": 0 } ], "result_image": "/results/filename.jpg" } - Error Responses:
400 Bad Request: Missing/invalid image file500 Server Error: Processing failure
3. Result Retrieval
GET /results/<filename>
- Returns annotated image with bounding boxes
- Example:
http://localhost:5000/results/out1.jpg
Request/Response Examples
Sample Request:
import requests
response = requests.post(
'http://localhost:5000/detect',
files={'image': open('motherboard.jpg', 'rb')}
)
Sample Response:
{
"detections": [
{
"box": [541,567,661,265],
"confidence": 0.98,
"class": 0
}
],
"result_image": "/results/out1.jpg"
}
Technical Specifications
| Parameter | Value |
|---|---|
| Model | YOLOv8n (custom-trained) |
| Input Formats | JPG/PNG |
| Recommended Resolution | 416px |
| Processing Time (CPU) | 200-500ms per image |