Davidsv/CourtSide-Computer-Vision-v0.1
347
1---2language: en3license: mit4tags:5 - yolo6 - yolov117 - object-detection8 - tennis9 - sports10 - computer-vision11 - pytorch12 - ultralytics13 - courtside14datasets:15 - tennis-ball-detection16metrics:17 - precision18 - recall19 - mAP20library_name: ultralytics21pipeline_tag: object-detection22---23 24# CourtSide Computer Vision v0.1 ๐พ25 26Fine-tuned YOLOv11n model for detecting tennis balls in images and videos. Part of the CourtSide Computer Vision suite for comprehensive tennis match analysis.27 2829 30## Model Details31 32- **Model Name**: CourtSide Computer Vision v0.133- **Model Type**: Object Detection34- **Architecture**: YOLOv11 Nano (n)35- **Framework**: Ultralytics YOLOv1136- **Parameters**: 2.6M37- **Input Size**: 640x64038- **Classes**: 1 (`tennis_ball`)39 40## Performance Metrics41 42Evaluated on validation set (62 images):43 44| Metric | Value |45|--------|-------|46| **mAP@50** | **67.87%** |47| **mAP@50-95** | 24.93% |48| **Precision** | 84.3% |49| **Recall** | 59.5% |50| **Inference Speed** (M4 Pro) | 10.3ms |51 52## Training Details53 54### Dataset55 56This model was trained on the **Tennis Ball Detection Dataset** by Viren Dhanwani, available on Roboflow Universe.57 58- **Training images**: 40859- **Validation images**: 6260- **Test images**: 5061- **Total**: 520 annotated images62- **Annotation format**: YOLO format (bounding boxes)63- **Source**: [Roboflow Universe - Tennis Ball Detection](https://universe.roboflow.com/viren-dhanwani/tennis-ball-detection)64 65### Training Configuration66```yaml67Model: YOLOv11n (nano)68Epochs: 10069Batch size: 1670Image size: 640x64071Device: Apple M4 Pro (MPS)72Optimizer: AdamW73Learning rate: 0.001 โ 0.0174Training time: ~23 minutes75```76 77### Augmentation78- HSV color jitter (h=0.015, s=0.7, v=0.4)79- Random horizontal flip (p=0.5)80- Translation (ยฑ10%)81- Scaling (ยฑ50%)82- Mosaic augmentation83 84### Loss Weights85- Box loss: 7.586- Class loss: 0.587- DFL loss: 1.588 89## Usage90 91### Installation92```bash93pip install ultralytics94```95 96### Python API97```python98from ultralytics import YOLO99from PIL import Image100 101# Load CourtSide Computer Vision model102model = YOLO('courtsidecv_v0.1.pt')103 104# Predict on image105results = model.predict('tennis_match.jpg', conf=0.3)106 107# Display results108results[0].show()109 110# Get bounding boxes111for box in results[0].boxes:112 x1, y1, x2, y2 = box.xyxy[0]113 confidence = box.conf[0]114 print(f"Ball detected at [{x1:.0f}, {y1:.0f}, {x2:.0f}, {y2:.0f}] with {confidence:.2%} confidence")115```116 117### Video Processing118```python119from ultralytics import YOLO120 121model = YOLO('courtsidecv_v0.1.pt')122 123# Process video124results = model.predict(125 source='tennis_match.mp4',126 conf=0.3,127 save=True,128 save_txt=True129)130```131 132### Command Line133```bash134# Predict on image135yolo detect predict model=courtsidecv_v0.1.pt source=image.jpg conf=0.3136 137# Predict on video138yolo detect predict model=courtsidecv_v0.1.pt source=video.mp4 conf=0.3 save=True139 140# Validate model141yolo detect val model=courtsidecv_v0.1.pt data=dataset.yaml142```143 144## Recommended Hyperparameters145 146### Inference Settings147```python148# Balanced (recommended)149conf_threshold = 0.30 # Confidence threshold150iou_threshold = 0.45 # NMS IoU threshold151max_det = 50 # Maximum detections per image152 153# High precision (fewer false positives)154conf_threshold = 0.50155iou_threshold = 0.45156max_det = 30157 158# High recall (detect more balls, more false positives)159conf_threshold = 0.20160iou_threshold = 0.40161max_det = 100162```163 164## Limitations165 166- **Small objects**: Performance may degrade for tennis balls that are very far from the camera (< 20px)167- **Motion blur**: Fast-moving balls may be harder to detect168- **Occlusion**: Partially hidden balls may not be detected169- **Similar objects**: May occasionally detect other small round objects170- **Lighting**: Optimized for outdoor tennis lighting conditions171 172## Model Biases173 174- Trained primarily on standard yellow tennis balls175- Dataset includes various court types but may have dataset-specific biases176- Better performance on professional match footage vs amateur recordings177 178## Use Cases179 180โ
**Recommended:**181- Tennis match analysis and statistics182- Automated highlight generation183- Player training and coaching tools184- Ball trajectory tracking185- Sports analytics dashboards186- Action recognition pipelines187 188โ ๏ธ **Not Recommended:**189- Real-time umpiring decisions (use as assistance only)190- Safety-critical applications191- Detection of non-yellow tennis balls without fine-tuning192 193## Example Results194 195### Sample Detections196 197**Precision: 84.3%** - When the model detects a ball, it's correct 84% of the time198**Recall: 59.5%** - The model detects approximately 6 out of 10 tennis balls199 200### Confidence Interpretation201 202| Confidence Range | Interpretation |203|------------------|----------------|204| > 0.7 | High confidence - very likely a tennis ball |205| 0.5 - 0.7 | Medium confidence - probably a tennis ball |206| 0.3 - 0.5 | Low confidence - possible tennis ball |207| < 0.3 | Very low confidence - likely false positive |208 209## CourtSide Computer Vision Suite210 211This model is part of the **CourtSide Computer Vision** project, a comprehensive tennis analysis system featuring:212- ๐พ Ball detection (this model)213- ๐ค Player detection and tracking214- ๐ฏ Action recognition (forehand, backhand, serve, etc.)215- ๐ Match statistics generation216 217## Model Card Authors218 219- **Developed by**: Vuong220- **Model date**: November 2024221- **Model version**: v0.1222- **Model type**: Object Detection (YOLOv11)223 224## Citations225 226### This Model227 228If you use this model, please cite:229```bibtex230@misc{courtsidecv_v0.1_2024,231 title={CourtSide Computer Vision v0.1: Tennis Ball Detection with YOLOv11},232 author={Vuong},233 year={2024},234 publisher={Hugging Face},235 howpublished={\url{https://huggingface.co/...}}236}237```238 239### Dataset240 241This model was trained using the Tennis Ball Detection dataset. Please cite:242```bibtex243@misc{tennis-ball-detection_dataset,244 title = {tennis ball detection Dataset},245 type = {Open Source Dataset},246 author = {Viren Dhanwani},247 howpublished = {\url{https://universe.roboflow.com/viren-dhanwani/tennis-ball-detection}},248 url = {https://universe.roboflow.com/viren-dhanwani/tennis-ball-detection},249 journal = {Roboflow Universe},250 publisher = {Roboflow},251 year = {2023},252 month = {feb},253 note = {visited on 2024-11-20}254}255```256 257## License258 259MIT License - Free for commercial and academic use.260 261## Acknowledgments262 263- Built with [Ultralytics YOLOv11](https://github.com/ultralytics/ultralytics)264- Dataset by Viren Dhanwani via [Roboflow Universe](https://universe.roboflow.com/viren-dhanwani/tennis-ball-detection)265- Part of the CourtSide Computer Vision project for tennis analysis266 267## Contact & Support268 269For questions, issues, or collaboration:270- GitHub Issues: [tennis_analysis/issues](https://github.com/...)271- Model Updates: Check for newer versions on Hugging Face272 273## Related Models274 275Coming soon in the CourtSide Computer Vision suite:276- CourtSide CV - Player Detection277- CourtSide CV - Racket Detection278- CourtSide CV - Court Segmentation279 280## Model Changelog281 282### v0.1 (2024-11-20)283- Initial release284- YOLOv11n architecture285- mAP@50: 67.87%286- 520 training images from Roboflow dataset287- Optimized for tennis ball detection in match footage288 289---290 291**Model Size**: 5.4 MB 292**Inference Speed**: 10-65ms (device dependent) 293**Supported Formats**: PyTorch (.pt), ONNX, TensorRT, CoreML294 295๐พ Ready for production use in tennis analysis applications!