Davidsv/CourtSide-Computer-Vision-v0.2
151
1---2language: en3license: mit4tags:5 - yolo6 - yolov117 - object-detection8 - tennis9 - racket10 - sports11 - computer-vision12 - pytorch13 - ultralytics14 - courtside15datasets:16 - dataset1-yx5qr17metrics:18 - precision19 - recall20 - mAP21library_name: ultralytics22pipeline_tag: object-detection23model-index:24- name: CourtSide Computer Vision v0.225 results:26 - task:27 type: object-detection28 metrics:29 - type: mAP@5030 value: 66.6731 - type: precision32 value: 7133 - type: recall34 value: 4435---36 37# CourtSide Computer Vision v0.2 - Racket Detection 🎾38 39Fine-tuned YOLOv11n model for detecting tennis rackets in images and videos. Part of the CourtSide Computer Vision suite for comprehensive tennis match analysis.40 41 4243 44## Model Details45 46- **Model Name**: CourtSide Computer Vision v0.247- **Model ID**: `Davidsv/CourtSide-Computer-Vision-v0.2`48- **Model Type**: Object Detection49- **Architecture**: YOLOv11 Nano (n)50- **Framework**: Ultralytics YOLOv1151- **Parameters**: 2.6M52- **Input Size**: 640x64053- **Classes**: 1 (`racket`)54 55## Performance Metrics56 57Evaluated on validation set (66 images):58 59| Metric | Value |60|--------|-------|61| **mAP@50** | **66.67%** |62| **mAP@50-95** | 33.33% |63| **Precision** | ~71% |64| **Recall** | ~44% |65| **Inference Speed** (M4 Pro) | ~10ms |66 67## Training Details68 69### Dataset70 71This model was trained on the **dataset1** by Tesi, available on Roboflow Universe.72 73- **Training images**: 58274- **Validation images**: 6675- **Test images**: 5576- **Total**: 703 annotated images77- **Annotation format**: YOLO format (bounding boxes)78- **Source**: [Roboflow Universe - Dataset1](https://universe.roboflow.com/tesi-mpvmr/dataset1-yx5qr)79 80### Training Configuration81```yaml82Model: YOLOv11n (nano)83Epochs: 10084Batch size: 1685Image size: 640x64086Device: Apple M4 Pro (MPS)87Optimizer: AdamW88Learning rate: 0.001 → 0.0189Training time: ~26 minutes90```91 92### Augmentation93- HSV color jitter (h=0.015, s=0.7, v=0.4)94- Random horizontal flip (p=0.5)95- Translation (±10%)96- Scaling (±50%)97- Mosaic augmentation98 99### Loss Weights100- Box loss: 7.5101- Class loss: 0.5102- DFL loss: 1.5103 104## Usage105 106### Installation107```bash108pip install ultralytics109```110 111### Python API112```python113from ultralytics import YOLO114 115# Load CourtSide Computer Vision v0.2 model116model = YOLO('Davidsv/CourtSide-Computer-Vision-v0.2')117 118# Predict on image119results = model.predict('tennis_match.jpg', conf=0.4)120 121# Display results122results[0].show()123 124# Get bounding boxes125for box in results[0].boxes:126 x1, y1, x2, y2 = box.xyxy[0]127 confidence = box.conf[0]128 print(f"Racket detected at [{x1:.0f}, {y1:.0f}, {x2:.0f}, {y2:.0f}] with {confidence:.2%} confidence")129```130 131### Video Processing132```python133from ultralytics import YOLO134 135model = YOLO('Davidsv/CourtSide-Computer-Vision-v0.2')136 137# Process video138results = model.predict(139 source='tennis_match.mp4',140 conf=0.4,141 save=True,142 save_txt=True143)144 145# Track rackets across frames146results = model.track(147 source='tennis_match.mp4',148 conf=0.4,149 tracker='bytetrack.yaml'150)151```152 153### Command Line154```bash155# Predict on image156yolo detect predict model=Davidsv/CourtSide-Computer-Vision-v0.2 source=image.jpg conf=0.4157 158# Predict on video159yolo detect predict model=Davidsv/CourtSide-Computer-Vision-v0.2 source=video.mp4 conf=0.4 save=True160 161# Track rackets in video162yolo detect track model=Davidsv/CourtSide-Computer-Vision-v0.2 source=video.mp4 conf=0.4163 164# Validate model165yolo detect val model=Davidsv/CourtSide-Computer-Vision-v0.2 data=dataset.yaml166```167 168## Recommended Hyperparameters169 170### Inference Settings171```python172# Balanced (recommended)173conf_threshold = 0.40 # Confidence threshold174iou_threshold = 0.45 # NMS IoU threshold175max_det = 10 # Maximum detections per image (usually 2-4 rackets)176 177# High precision (fewer false positives)178conf_threshold = 0.55179iou_threshold = 0.45180max_det = 8181 182# High recall (detect more rackets, more false positives)183conf_threshold = 0.30184iou_threshold = 0.40185max_det = 15186```187 188## Limitations189 190- **Motion blur**: Rackets in very fast motion may be harder to detect191- **Occlusion**: Partially hidden rackets (behind player, net, etc.) may not be detected192- **Angles**: Extreme viewing angles may reduce detection accuracy193- **Racket types**: Trained on standard tennis rackets, may not generalize to unusual designs194- **Similar objects**: May occasionally detect similar elongated objects195 196## Model Biases197 198- Trained on professional and amateur match footage199- Better performance on standard racket designs and colors200- Dataset may have court-type or player-level biases201- Optimized for typical tennis camera angles202 203## Use Cases204 205✅ **Recommended:**206- Tennis match analysis and statistics207- Player technique analysis208- Swing detection and tracking209- Automated coaching feedback210- Sports analytics dashboards211- Training video analysis212- Action recognition pipelines (combined with ball detection)213 214⚠️ **Not Recommended:**215- Real-time officiating decisions216- Safety-critical applications217- Detection of non-tennis rackets without fine-tuning218 219## Example Results220 221### Sample Detections222 223**mAP@50: 66.67%** - Good detection performance on typical tennis scenes 224**Precision: ~71%** - When detected, about 7 out of 10 detections are correct 225**Recall: ~44%** - Detects approximately 4-5 out of 10 rackets226 227### Confidence Interpretation228 229| Confidence Range | Interpretation |230|------------------|----------------|231| > 0.7 | High confidence - very likely a tennis racket |232| 0.5 - 0.7 | Medium confidence - probably a tennis racket |233| 0.4 - 0.5 | Low confidence - possible tennis racket |234| < 0.4 | Very low confidence - likely false positive |235 236## CourtSide Computer Vision Suite237 238This model is part of the **CourtSide Computer Vision** project for comprehensive tennis analysis:239 240### Available Models241 242- **v0.1** - Tennis Ball Detection ([Davidsv/CourtSide-Computer-Vision-v0.1](https://huggingface.co/Davidsv/CourtSide-Computer-Vision-v0.1))243- **v0.2** - Tennis Racket Detection (this model)244 245### Combined Usage Example246```python247from ultralytics import YOLO248 249# Load both CourtSide CV models250model_ball = YOLO('Davidsv/CourtSide-Computer-Vision-v0.1') # Ball detection251model_racket = YOLO('Davidsv/CourtSide-Computer-Vision-v0.2') # Racket detection252 253# Detect both in same image254ball_results = model_ball.predict('match.jpg', conf=0.3)255racket_results = model_racket.predict('match.jpg', conf=0.4)256 257# Combine detections for comprehensive analysis258print(f"Balls detected: {len(ball_results[0].boxes)}")259print(f"Rackets detected: {len(racket_results[0].boxes)}")260```261 262## Advanced Usage263 264### Detect and Track Swing Actions265```python266from ultralytics import YOLO267import cv2268 269model = YOLO('Davidsv/CourtSide-Computer-Vision-v0.2')270video = cv2.VideoCapture('match.mp4')271 272frame_count = 0273racket_positions = []274 275while True:276 ret, frame = video.read()277 if not ret:278 break279 280 # Detect rackets281 results = model.predict(frame, conf=0.4, verbose=False)282 283 # Track racket movement for swing analysis284 for box in results[0].boxes:285 x1, y1, x2, y2 = box.xyxy[0]286 center_x = (x1 + x2) / 2287 center_y = (y1 + y2) / 2288 racket_positions.append((frame_count, center_x, center_y))289 290 frame_count += 1291 292# Analyze swing patterns293print(f"Total racket detections: {len(racket_positions)}")294```295 296### Full Tennis Analysis Pipeline297```python298from ultralytics import YOLO299 300# Load all CourtSide models301ball_model = YOLO('Davidsv/CourtSide-Computer-Vision-v0.1')302racket_model = YOLO('Davidsv/CourtSide-Computer-Vision-v0.2')303 304# Process video with both models305ball_results = ball_model.track('match.mp4', conf=0.3)306racket_results = racket_model.track('match.mp4', conf=0.4)307 308# Combine for action recognition and analytics309```310 311## Model Card Authors312 313- **Developed by**: Davidsv (Vuong)314- **Model date**: November 2024315- **Model version**: v0.2316- **Model type**: Object Detection (YOLOv11)317- **Part of**: CourtSide Computer Vision Suite318 319## Citations320 321### This Model322 323If you use this model, please cite:324```bibtex325@misc{courtsidecv_v0.2_2024,326 title={CourtSide Computer Vision v0.2: Tennis Racket Detection with YOLOv11},327 author={Vuong},328 year={2024},329 publisher={Hugging Face},330 howpublished={\url{https://huggingface.co/Davidsv/CourtSide-Computer-Vision-v0.2}}331}332```333 334### Dataset335 336This model was trained using the dataset1 dataset. Please cite:337```bibtex338@misc{dataset1-yx5qr_dataset,339 title = {dataset1 Dataset},340 type = {Open Source Dataset},341 author = {Tesi},342 howpublished = {\url{https://universe.roboflow.com/tesi-mpvmr/dataset1-yx5qr}},343 url = {https://universe.roboflow.com/tesi-mpvmr/dataset1-yx5qr},344 journal = {Roboflow Universe},345 publisher = {Roboflow},346 year = {2023},347 month = {mar},348 note = {visited on 2024-11-20}349}350```351 352## License353 354MIT License - Free for commercial and academic use.355 356## Acknowledgments357 358- Built with [Ultralytics YOLOv11](https://github.com/ultralytics/ultralytics)359- Dataset by Tesi via [Roboflow Universe](https://universe.roboflow.com/tesi-mpvmr/dataset1-yx5qr)360- Part of the CourtSide Computer Vision project for tennis analysis361 362## Contact & Support363 364For questions, issues, or collaboration:365- Hugging Face: [@Davidsv](https://huggingface.co/Davidsv)366- Model Updates: Check for newer versions in the CourtSide CV series367 368## Common Issues & Solutions369 370### Issue: Low Recall (Missing Rackets)371**Solution**: Lower confidence threshold to 0.30-0.35372 373### Issue: Too Many False Positives374**Solution**: Increase confidence threshold to 0.50-0.55375 376### Issue: Missed Rackets in Fast Motion377**Solution**: Use `model.track()` instead of `model.predict()` for better temporal consistency378 379### Issue: Multiple Detections per Racket380**Solution**: Increase NMS IoU threshold to 0.50-0.55381 382### Issue: Poor Performance on Unusual Angles383**Solution**: Consider fine-tuning on your specific camera setup or use data augmentation384 385## Model Changelog386 387### v0.2 (2024-11-20)388- Initial release of racket detection model389- YOLOv11n architecture390- mAP@50: 66.67%391- 703 training images from Roboflow dataset392- Optimized for standard tennis racket detection393- Part of CourtSide Computer Vision suite394 395---396 397**Model Size**: 5.4 MB 398**Inference Speed**: 10-65ms (device dependent) 399**Supported Formats**: PyTorch (.pt), ONNX, TensorRT, CoreML 400**Model Hub**: [Davidsv/CourtSide-Computer-Vision-v0.2](https://huggingface.co/Davidsv/CourtSide-Computer-Vision-v0.2)401 402🎾 Ready for production use in tennis analysis applications!