Upload folder using huggingface_hub
Browse files- README.md +70 -0
- config.txt +5 -0
- example.py +17 -0
- model.pt +3 -0
- requirements.txt +5 -0
README.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# YOLOv11 Tennis Detection Model
|
| 2 |
+
|
| 3 |
+
Fine-tuned YOLOv11 model for comprehensive tennis analysis with multi-class object detection.
|
| 4 |
+
|
| 5 |
+
## Model Performance
|
| 6 |
+
|
| 7 |
+
| Metric | Score |
|
| 8 |
+
|--------|-------|
|
| 9 |
+
| mAP@50 | **92.13%** |
|
| 10 |
+
| mAP@50-95 | **85.49%** |
|
| 11 |
+
| Precision | 92.9% |
|
| 12 |
+
| Recall | 92.0% |
|
| 13 |
+
|
| 14 |
+
## Classes Detected (10)
|
| 15 |
+
|
| 16 |
+
1. **racket** - Tennis rackets
|
| 17 |
+
2. **tennis_ball** - Tennis balls
|
| 18 |
+
3. **court** - Full court area
|
| 19 |
+
4. **net** - Tennis net
|
| 20 |
+
5. **left-service-box** - Left service box
|
| 21 |
+
6. **right-service-box** - Right service box
|
| 22 |
+
7. **left-doubles-alley** - Left doubles alley
|
| 23 |
+
8. **right-doubles-alley** - Right doubles alley
|
| 24 |
+
9. **top-dead-zone** - Top baseline area
|
| 25 |
+
10. **bottom-dead-zone** - Bottom baseline area
|
| 26 |
+
|
| 27 |
+
## Training Details
|
| 28 |
+
|
| 29 |
+
- **Base Model**: YOLOv11n
|
| 30 |
+
- **Epochs**: 150
|
| 31 |
+
- **Image Size**: 640x640
|
| 32 |
+
- **Optimizer**: AdamW
|
| 33 |
+
- **Learning Rate**: 0.001 (cosine decay to 0.01)
|
| 34 |
+
- **Device**: MPS (Apple Silicon)
|
| 35 |
+
|
| 36 |
+
## Usage
|
| 37 |
+
|
| 38 |
+
```python
|
| 39 |
+
from ultralytics import YOLO
|
| 40 |
+
|
| 41 |
+
# Load the model
|
| 42 |
+
model = YOLO('training/runs_combined/combined_final/weights/best.pt')
|
| 43 |
+
|
| 44 |
+
# Run inference
|
| 45 |
+
results = model.predict('tennis_match.jpg', conf=0.25)
|
| 46 |
+
|
| 47 |
+
# Process results
|
| 48 |
+
for r in results:
|
| 49 |
+
boxes = r.boxes
|
| 50 |
+
for box in boxes:
|
| 51 |
+
cls = int(box.cls[0])
|
| 52 |
+
conf = float(box.conf[0])
|
| 53 |
+
print(f"Detected: {model.names[cls]} ({conf:.2f})")
|
| 54 |
+
```
|
| 55 |
+
|
| 56 |
+
## Training Curves
|
| 57 |
+
|
| 58 |
+
The model converged smoothly over 150 epochs with consistent improvement in both precision and recall metrics.
|
| 59 |
+
|
| 60 |
+
## Applications
|
| 61 |
+
|
| 62 |
+
- Real-time tennis match analysis
|
| 63 |
+
- Player tracking and movement analysis
|
| 64 |
+
- Ball trajectory prediction
|
| 65 |
+
- Court zone occupancy analysis
|
| 66 |
+
- Automated highlight generation
|
| 67 |
+
|
| 68 |
+
## License
|
| 69 |
+
|
| 70 |
+
MIT License
|
config.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Configuration
|
| 2 |
+
model_name: tennis-detection-yolov11
|
| 3 |
+
framework: ultralytics
|
| 4 |
+
architecture: yolov11n
|
| 5 |
+
task: object-detection
|
example.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python
|
| 2 |
+
# Example usage for tennis-detection-yolov11
|
| 3 |
+
|
| 4 |
+
from ultralytics import YOLO
|
| 5 |
+
|
| 6 |
+
# Load model from local file
|
| 7 |
+
model = YOLO('model.pt')
|
| 8 |
+
|
| 9 |
+
# Or download from Hugging Face (after upload)
|
| 10 |
+
# model = YOLO('hf://YOUR_USERNAME/tennis-detection-yolov11/model.pt')
|
| 11 |
+
|
| 12 |
+
# Predict on image
|
| 13 |
+
results = model.predict('image.jpg', conf=0.3)
|
| 14 |
+
results[0].show()
|
| 15 |
+
|
| 16 |
+
# Predict on video
|
| 17 |
+
results = model.predict('video.mp4', conf=0.3, save=True)
|
model.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:be98152dc5ddcf5552d2b71ae6480d2c6bcf360a1f2369e21b4dc66da442dfcb
|
| 3 |
+
size 5488986
|
requirements.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
ultralytics>=8.0.0
|
| 2 |
+
torch>=2.0.0
|
| 3 |
+
opencv-python>=4.0.0
|
| 4 |
+
pillow>=9.0.0
|
| 5 |
+
numpy>=1.20.0
|