File size: 3,106 Bytes
ce81055
95db528
 
 
 
ce81055
 
95db528
 
ce81055
 
95db528
 
f8d9498
95db528
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f8d9498
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
---
title: Gesture Detection & Identity Validation API
emoji: πŸ‘‹
colorFrom: blue
colorTo: purple
sdk: docker
pinned: false
license: mit
app_port: 7860
---

# πŸ‘‹ Gesture Detection & Identity Validation API


A unified API for gesture detection in videos and identity validation using facial recognition and gesture verification.

## πŸš€ Features

- **Gesture Detection**: Detect and track hand gestures in video files
- **Identity Validation**: Validate user identity using facial recognition and required gestures
- **Real-time Processing**: Efficient video processing with configurable frame skip
- **RESTful API**: Clean, documented API endpoints

## πŸ“‹ API Endpoints

### `GET /`
Get API information and available endpoints

### `GET /health`
Health check endpoint showing service status

### `POST /gestures`
Detect gestures in an uploaded video file

**Parameters:**
- `video` (file): Video file to process
- `frame_skip` (int, optional): Number of frames to skip (default: 1)

**Response:**
```json
{
  "gestures": [
    {
      "gesture": "thumbs_up",
      "duration": 45,
      "confidence": 0.92
    }
  ]
}
```

### `POST /validate`
Validate user identity using facial recognition and gesture verification

**Parameters:**
- `photo` (file): ID document photo
- `video` (file): User video containing face and gestures
- `gestures` (JSON array): Required gestures (e.g., `["thumbs_up","peace"]`)
- `error_margin` (float, optional): Error margin for validation (default: 0.33)
- `require_all_gestures` (bool, optional): Whether all gestures must be present
- `similarity_threshold` (float, optional): Facial similarity threshold
- `include_details` (bool, optional): Include detailed validation results

**Response:**
```json
{
  "face": true,
  "gestures": true,
  "overall": true,
  "status": "success",
  "processing_time_ms": 6925,
  "timestamp": "2025-09-30T08:30:22Z"
}
```

## 🎯 Supported Gestures

- `thumbs_up` (πŸ‘)
- `peace` (✌️)
- `ok_sign` (πŸ‘Œ)
- `open_palm` (πŸ‘‹)
- `call_me` (πŸ€™)
- `grabbing` (✊)

## πŸ“– Documentation

Interactive API documentation is available at:
- **Swagger UI**: `/docs`
- **ReDoc**: `/redoc`

## πŸ”§ Usage Example

```bash
# Detect gestures in a video
curl -X POST http://localhost:7860/gestures \
  -F "video=@my_video.mp4" \
  -F "frame_skip=3"

# Validate identity
curl -X POST http://localhost:7860/validate \
  -F "photo=@id_photo.jpg" \
  -F "video=@user_video.mp4" \
  -F 'gestures=["thumbs_up","peace"]' \
  -F "include_details=true"
```

## πŸ—οΈ Technology Stack

- **Framework**: FastAPI
- **ML Models**: ONNX Runtime
- **Computer Vision**: OpenCV
- **Tracking**: OCSort with Kalman filters
- **Facial Recognition**: Custom embeddings module

## πŸ“ Note

Facial validation is currently in placeholder mode and always returns success. Gesture validation is fully functional.

## πŸ“„ License

MIT License - See LICENSE file for details

## πŸ”— Links

- [GitHub Repository](https://github.com/kybtech/gesture-detection)
- [API Documentation](/docs)
- [Hugging Face Space](https://huggingface.co/spaces/algoryn/validation)