Spaces:
Sleeping
Sleeping
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -11,25 +11,30 @@ app_port: 7860
|
|
| 11 |
|
| 12 |
# Teknova AI Animal Tracking π
|
| 13 |
|
| 14 |
-
AI-powered animal detection and re-identification system.
|
| 15 |
|
| 16 |
-
## Features
|
| 17 |
-
- π Real-time animal detection
|
| 18 |
-
- π Automatic individual
|
| 19 |
-
- π
|
| 20 |
-
-
|
|
|
|
|
|
|
| 21 |
|
| 22 |
-
## API Endpoints
|
| 23 |
|
| 24 |
| Endpoint | Method | Description |
|
| 25 |
|----------|--------|-------------|
|
|
|
|
| 26 |
| `/health` | GET | Health check |
|
| 27 |
-
| `/api/v1/detection/process-frame` | POST | Process image
|
| 28 |
-
| `/api/v1/detection/gallery` | GET | Get
|
| 29 |
-
| `/api/v1/detection/reset` | POST | Reset gallery |
|
|
|
|
| 30 |
|
| 31 |
-
##
|
| 32 |
|
|
|
|
| 33 |
```python
|
| 34 |
import requests
|
| 35 |
|
|
@@ -43,8 +48,60 @@ with open("cow.jpg", "rb") as f:
|
|
| 43 |
result = response.json()
|
| 44 |
print(f"Detected {result['animal_count']} animals")
|
| 45 |
for animal in result['animals']:
|
| 46 |
-
print(f" - {animal['animal_id']}: {animal['class_name']}")
|
| 47 |
```
|
| 48 |
|
| 49 |
-
##
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
# Teknova AI Animal Tracking π
|
| 13 |
|
| 14 |
+
AI-powered animal detection, tracking and re-identification system for smart farming.
|
| 15 |
|
| 16 |
+
## π Features
|
| 17 |
+
- π **Real-time Detection**: YOLOv8-based animal detection
|
| 18 |
+
- π **Re-Identification**: Automatic individual animal recognition
|
| 19 |
+
- π **Gallery Management**: Track and manage animal database
|
| 20 |
+
- π **Behavior Analysis**: Activity and movement tracking
|
| 21 |
+
- π₯ **Health Monitoring**: Health status indicators
|
| 22 |
+
- π **Multi-species Support**: Cow, Sheep, Horse, Dog, Cat, Bird, etc.
|
| 23 |
|
| 24 |
+
## π‘ API Endpoints
|
| 25 |
|
| 26 |
| Endpoint | Method | Description |
|
| 27 |
|----------|--------|-------------|
|
| 28 |
+
| `/` | GET | API documentation |
|
| 29 |
| `/health` | GET | Health check |
|
| 30 |
+
| `/api/v1/detection/process-frame` | POST | Process image for detection |
|
| 31 |
+
| `/api/v1/detection/gallery` | GET | Get registered animals |
|
| 32 |
+
| `/api/v1/detection/reset` | POST | Reset animal gallery |
|
| 33 |
+
| `/api/v1/detection/stats` | GET | Get detection statistics |
|
| 34 |
|
| 35 |
+
## π Quick Start
|
| 36 |
|
| 37 |
+
### Python Example
|
| 38 |
```python
|
| 39 |
import requests
|
| 40 |
|
|
|
|
| 48 |
result = response.json()
|
| 49 |
print(f"Detected {result['animal_count']} animals")
|
| 50 |
for animal in result['animals']:
|
| 51 |
+
print(f" - {animal['animal_id']}: {animal['class_name']} ({animal['confidence']:.2%})")
|
| 52 |
```
|
| 53 |
|
| 54 |
+
### JavaScript Example
|
| 55 |
+
```javascript
|
| 56 |
+
const formData = new FormData();
|
| 57 |
+
formData.append('file', imageFile);
|
| 58 |
+
|
| 59 |
+
const response = await fetch('https://your-space.hf.space/api/v1/detection/process-frame', {
|
| 60 |
+
method: 'POST',
|
| 61 |
+
body: formData
|
| 62 |
+
});
|
| 63 |
+
|
| 64 |
+
const result = await response.json();
|
| 65 |
+
console.log(`Detected ${result.animal_count} animals`);
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
## π§ Configuration
|
| 69 |
+
|
| 70 |
+
| Parameter | Default | Description |
|
| 71 |
+
|-----------|---------|-------------|
|
| 72 |
+
| `CONFIDENCE_THRESHOLD` | 0.4 | Minimum detection confidence |
|
| 73 |
+
| `SIMILARITY_THRESHOLD` | 0.92 | Re-ID similarity threshold |
|
| 74 |
+
| `MAX_GALLERY_SIZE` | 500 | Maximum animals in gallery |
|
| 75 |
+
|
| 76 |
+
## π¦ Deployment
|
| 77 |
+
|
| 78 |
+
### HuggingFace Spaces
|
| 79 |
+
1. Fork this repository
|
| 80 |
+
2. Create a new Space with Docker SDK
|
| 81 |
+
3. Upload the `huggingface/` directory
|
| 82 |
+
4. Wait for build to complete
|
| 83 |
+
|
| 84 |
+
### Local Docker
|
| 85 |
+
```bash
|
| 86 |
+
cd huggingface
|
| 87 |
+
docker build -t animal-tracking .
|
| 88 |
+
docker run -p 7860:7860 animal-tracking
|
| 89 |
+
```
|
| 90 |
+
|
| 91 |
+
## π Related Projects
|
| 92 |
+
- **Frontend**: Next.js dashboard for visualization
|
| 93 |
+
- **Backend**: FastAPI server with full API
|
| 94 |
+
- **Mobile**: React Native mobile app
|
| 95 |
+
|
| 96 |
+
## π Performance
|
| 97 |
+
- Detection: ~15 FPS on CPU, ~30+ FPS on GPU
|
| 98 |
+
- Re-ID Accuracy: >85%
|
| 99 |
+
- Supported formats: JPG, PNG, BMP, WebP
|
| 100 |
+
|
| 101 |
+
## π·οΈ License
|
| 102 |
+
MIT License - See LICENSE file
|
| 103 |
+
|
| 104 |
+
## π¨βπ» Developed by
|
| 105 |
+
**Teknova** - AI Solutions for Smart Farming
|
| 106 |
+
|
| 107 |
+
π [GitHub](https://github.com/veteroner/ai-animal-tracking) | π§ Contact: teknova@example.com
|