Spaces:
Paused
Paused
Shorter container name
Browse files
README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
---
|
| 2 |
-
title: "KYB YOLO-E
|
| 3 |
emoji: "π"
|
| 4 |
colorFrom: "blue"
|
| 5 |
colorTo: "purple"
|
|
@@ -19,18 +19,21 @@ This Hugging Face Space provides a production-ready API for detecting and classi
|
|
| 19 |
## β¨ Features
|
| 20 |
|
| 21 |
### π― European Document Detection
|
|
|
|
| 22 |
- **Document Types**: Identity cards, passports, driver's licenses, residence permits
|
| 23 |
- **Front/Back Classification**: ML-based orientation detection using multiple methods
|
| 24 |
- **Precise Coordinates**: Accurate bounding box coordinates for all detections
|
| 25 |
- **Quality Assessment**: Comprehensive quality metrics (sharpness, glare, coverage, brightness, contrast)
|
| 26 |
|
| 27 |
### π₯ Video Processing
|
|
|
|
| 28 |
- **Frame Extraction**: Intelligent frame sampling at configurable FPS
|
| 29 |
- **Quality-Based Selection**: Automatic selection of best quality frames
|
| 30 |
- **Multi-Frame Analysis**: Track documents across video frames
|
| 31 |
- **Performance Optimized**: Efficient processing for real-time applications
|
| 32 |
|
| 33 |
### π§ Technical Capabilities
|
|
|
|
| 34 |
- **YOLO-E Integration**: Latest Ultralytics YOLO-E for object detection
|
| 35 |
- **ML-Based Classification**: Advanced orientation detection using multiple algorithms
|
| 36 |
- **European Focus**: Optimized for European document standards and formats
|
|
@@ -39,6 +42,7 @@ This Hugging Face Space provides a production-ready API for detecting and classi
|
|
| 39 |
## π Quick Start
|
| 40 |
|
| 41 |
### Image Detection
|
|
|
|
| 42 |
```bash
|
| 43 |
curl -X POST "https://your-hf-space-url/v1/id/detect" \
|
| 44 |
-F "file=@document.jpg" \
|
|
@@ -47,6 +51,7 @@ curl -X POST "https://your-hf-space-url/v1/id/detect" \
|
|
| 47 |
```
|
| 48 |
|
| 49 |
### Video Detection
|
|
|
|
| 50 |
```bash
|
| 51 |
curl -X POST "https://your-hf-space-url/v1/id/detect-video" \
|
| 52 |
-F "file=@document_video.mp4" \
|
|
@@ -59,14 +64,17 @@ curl -X POST "https://your-hf-space-url/v1/id/detect-video" \
|
|
| 59 |
## π API Endpoints
|
| 60 |
|
| 61 |
### POST `/v1/id/detect`
|
|
|
|
| 62 |
Detect European identity documents in uploaded images.
|
| 63 |
|
| 64 |
**Parameters:**
|
|
|
|
| 65 |
- `file` (required): Image file (JPEG, PNG, etc.)
|
| 66 |
- `min_confidence` (optional): Minimum confidence threshold (0.0-1.0, default: 0.25)
|
| 67 |
- `return_crops` (optional): Return cropped document images (default: false)
|
| 68 |
|
| 69 |
**Response:**
|
|
|
|
| 70 |
```json
|
| 71 |
{
|
| 72 |
"request_id": "uuid",
|
|
@@ -102,9 +110,11 @@ Detect European identity documents in uploaded images.
|
|
| 102 |
```
|
| 103 |
|
| 104 |
### POST `/v1/id/detect-video`
|
|
|
|
| 105 |
Detect European identity documents in uploaded videos with quality-based frame selection.
|
| 106 |
|
| 107 |
**Parameters:**
|
|
|
|
| 108 |
- `file` (required): Video file (MP4, AVI, etc.)
|
| 109 |
- `min_confidence` (optional): Minimum confidence threshold (0.0-1.0, default: 0.25)
|
| 110 |
- `sample_fps` (optional): Video sampling rate (0.1-30.0, default: 2.0)
|
|
@@ -112,6 +122,7 @@ Detect European identity documents in uploaded videos with quality-based frame s
|
|
| 112 |
- `max_detections` (optional): Maximum detections to return (1-100, default: 10)
|
| 113 |
|
| 114 |
**Response:**
|
|
|
|
| 115 |
```json
|
| 116 |
{
|
| 117 |
"request_id": "uuid",
|
|
@@ -125,9 +136,11 @@ Detect European identity documents in uploaded videos with quality-based frame s
|
|
| 125 |
```
|
| 126 |
|
| 127 |
### GET `/health`
|
|
|
|
| 128 |
Health check endpoint.
|
| 129 |
|
| 130 |
**Response:**
|
|
|
|
| 131 |
```json
|
| 132 |
{
|
| 133 |
"status": "healthy",
|
|
@@ -174,6 +187,7 @@ Each detection includes comprehensive quality assessment:
|
|
| 174 |
## π οΈ Configuration
|
| 175 |
|
| 176 |
### Class Mapping
|
|
|
|
| 177 |
The system uses `config/labels.json` for class mapping:
|
| 178 |
|
| 179 |
```json
|
|
@@ -189,18 +203,21 @@ The system uses `config/labels.json` for class mapping:
|
|
| 189 |
```
|
| 190 |
|
| 191 |
### Model Weights
|
|
|
|
| 192 |
- **YOLO-E**: `yolo11n.pt` (nano variant for faster inference)
|
| 193 |
- **Orientation Classifier**: Integrated ML-based classification
|
| 194 |
|
| 195 |
## π§ Deployment
|
| 196 |
|
| 197 |
### Hugging Face Spaces
|
|
|
|
| 198 |
1. Upload the code to a new Hugging Face Space
|
| 199 |
2. Set the hardware to GPU for optimal performance
|
| 200 |
3. Configure environment variables if needed
|
| 201 |
4. Deploy and test the endpoints
|
| 202 |
|
| 203 |
### Local Development
|
|
|
|
| 204 |
```bash
|
| 205 |
# Install dependencies
|
| 206 |
pip install -r requirements.txt
|
|
@@ -212,6 +229,7 @@ python app.py
|
|
| 212 |
## π Example Usage
|
| 213 |
|
| 214 |
### Python Client
|
|
|
|
| 215 |
```python
|
| 216 |
import requests
|
| 217 |
|
|
@@ -231,6 +249,7 @@ for detection in result['detections']:
|
|
| 231 |
```
|
| 232 |
|
| 233 |
### JavaScript Client
|
|
|
|
| 234 |
```javascript
|
| 235 |
const formData = new FormData();
|
| 236 |
formData.append('file', fileInput.files[0]);
|
|
|
|
| 1 |
---
|
| 2 |
+
title: "KYB YOLO-E"
|
| 3 |
emoji: "π"
|
| 4 |
colorFrom: "blue"
|
| 5 |
colorTo: "purple"
|
|
|
|
| 19 |
## β¨ Features
|
| 20 |
|
| 21 |
### π― European Document Detection
|
| 22 |
+
|
| 23 |
- **Document Types**: Identity cards, passports, driver's licenses, residence permits
|
| 24 |
- **Front/Back Classification**: ML-based orientation detection using multiple methods
|
| 25 |
- **Precise Coordinates**: Accurate bounding box coordinates for all detections
|
| 26 |
- **Quality Assessment**: Comprehensive quality metrics (sharpness, glare, coverage, brightness, contrast)
|
| 27 |
|
| 28 |
### π₯ Video Processing
|
| 29 |
+
|
| 30 |
- **Frame Extraction**: Intelligent frame sampling at configurable FPS
|
| 31 |
- **Quality-Based Selection**: Automatic selection of best quality frames
|
| 32 |
- **Multi-Frame Analysis**: Track documents across video frames
|
| 33 |
- **Performance Optimized**: Efficient processing for real-time applications
|
| 34 |
|
| 35 |
### π§ Technical Capabilities
|
| 36 |
+
|
| 37 |
- **YOLO-E Integration**: Latest Ultralytics YOLO-E for object detection
|
| 38 |
- **ML-Based Classification**: Advanced orientation detection using multiple algorithms
|
| 39 |
- **European Focus**: Optimized for European document standards and formats
|
|
|
|
| 42 |
## π Quick Start
|
| 43 |
|
| 44 |
### Image Detection
|
| 45 |
+
|
| 46 |
```bash
|
| 47 |
curl -X POST "https://your-hf-space-url/v1/id/detect" \
|
| 48 |
-F "file=@document.jpg" \
|
|
|
|
| 51 |
```
|
| 52 |
|
| 53 |
### Video Detection
|
| 54 |
+
|
| 55 |
```bash
|
| 56 |
curl -X POST "https://your-hf-space-url/v1/id/detect-video" \
|
| 57 |
-F "file=@document_video.mp4" \
|
|
|
|
| 64 |
## π API Endpoints
|
| 65 |
|
| 66 |
### POST `/v1/id/detect`
|
| 67 |
+
|
| 68 |
Detect European identity documents in uploaded images.
|
| 69 |
|
| 70 |
**Parameters:**
|
| 71 |
+
|
| 72 |
- `file` (required): Image file (JPEG, PNG, etc.)
|
| 73 |
- `min_confidence` (optional): Minimum confidence threshold (0.0-1.0, default: 0.25)
|
| 74 |
- `return_crops` (optional): Return cropped document images (default: false)
|
| 75 |
|
| 76 |
**Response:**
|
| 77 |
+
|
| 78 |
```json
|
| 79 |
{
|
| 80 |
"request_id": "uuid",
|
|
|
|
| 110 |
```
|
| 111 |
|
| 112 |
### POST `/v1/id/detect-video`
|
| 113 |
+
|
| 114 |
Detect European identity documents in uploaded videos with quality-based frame selection.
|
| 115 |
|
| 116 |
**Parameters:**
|
| 117 |
+
|
| 118 |
- `file` (required): Video file (MP4, AVI, etc.)
|
| 119 |
- `min_confidence` (optional): Minimum confidence threshold (0.0-1.0, default: 0.25)
|
| 120 |
- `sample_fps` (optional): Video sampling rate (0.1-30.0, default: 2.0)
|
|
|
|
| 122 |
- `max_detections` (optional): Maximum detections to return (1-100, default: 10)
|
| 123 |
|
| 124 |
**Response:**
|
| 125 |
+
|
| 126 |
```json
|
| 127 |
{
|
| 128 |
"request_id": "uuid",
|
|
|
|
| 136 |
```
|
| 137 |
|
| 138 |
### GET `/health`
|
| 139 |
+
|
| 140 |
Health check endpoint.
|
| 141 |
|
| 142 |
**Response:**
|
| 143 |
+
|
| 144 |
```json
|
| 145 |
{
|
| 146 |
"status": "healthy",
|
|
|
|
| 187 |
## π οΈ Configuration
|
| 188 |
|
| 189 |
### Class Mapping
|
| 190 |
+
|
| 191 |
The system uses `config/labels.json` for class mapping:
|
| 192 |
|
| 193 |
```json
|
|
|
|
| 203 |
```
|
| 204 |
|
| 205 |
### Model Weights
|
| 206 |
+
|
| 207 |
- **YOLO-E**: `yolo11n.pt` (nano variant for faster inference)
|
| 208 |
- **Orientation Classifier**: Integrated ML-based classification
|
| 209 |
|
| 210 |
## π§ Deployment
|
| 211 |
|
| 212 |
### Hugging Face Spaces
|
| 213 |
+
|
| 214 |
1. Upload the code to a new Hugging Face Space
|
| 215 |
2. Set the hardware to GPU for optimal performance
|
| 216 |
3. Configure environment variables if needed
|
| 217 |
4. Deploy and test the endpoints
|
| 218 |
|
| 219 |
### Local Development
|
| 220 |
+
|
| 221 |
```bash
|
| 222 |
# Install dependencies
|
| 223 |
pip install -r requirements.txt
|
|
|
|
| 229 |
## π Example Usage
|
| 230 |
|
| 231 |
### Python Client
|
| 232 |
+
|
| 233 |
```python
|
| 234 |
import requests
|
| 235 |
|
|
|
|
| 249 |
```
|
| 250 |
|
| 251 |
### JavaScript Client
|
| 252 |
+
|
| 253 |
```javascript
|
| 254 |
const formData = new FormData();
|
| 255 |
formData.append('file', fileInput.files[0]);
|