76 lines
1.7 KiB
Markdown
76 lines
1.7 KiB
Markdown
# 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:**
|
|
```bash
|
|
curl -X POST -F "image=@motherboard.jpg" http://localhost:5000/detect
|
|
```
|
|
- **Successful Response (200):**
|
|
```json
|
|
{
|
|
"detections": [
|
|
{
|
|
"box": [x1,y1,x2,y2],
|
|
"confidence": 0.95,
|
|
"class": 0
|
|
}
|
|
],
|
|
"result_image": "/results/filename.jpg"
|
|
}
|
|
```
|
|
- **Error Responses:**
|
|
- `400 Bad Request`: Missing/invalid image file
|
|
- `500 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:**
|
|
```python
|
|
import requests
|
|
response = requests.post(
|
|
'http://localhost:5000/detect',
|
|
files={'image': open('motherboard.jpg', 'rb')}
|
|
)
|
|
```
|
|
|
|
**Sample Response:**
|
|
```json
|
|
{
|
|
"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 |
|