CoolFace
Modelpublic

Davidsv/CourtSide-Computer-Vision-v0.1

sourceHugging Facemitupdated 10mo agoView on Hugging Face
3likes44downloads
Model Card

CourtSide Computer Vision v0.1 ๐ŸŽพ

Fine-tuned YOLOv11n model for detecting tennis balls in images and videos. Part of the CourtSide Computer Vision suite for comprehensive tennis match analysis.

[image]

Model Details

  • โ€”Model Name: CourtSide Computer Vision v0.1
  • โ€”Model Type: Object Detection
  • โ€”Architecture: YOLOv11 Nano (n)
  • โ€”Framework: Ultralytics YOLOv11
  • โ€”Parameters: 2.6M
  • โ€”Input Size: 640x640
  • โ€”Classes: 1 (tennis_ball)

Performance Metrics

Evaluated on validation set (62 images):

MetricValue
mAP@5067.87%
mAP@50-9524.93%
Precision84.3%
Recall59.5%
Inference Speed (M4 Pro)10.3ms

Training Details

Dataset

This model was trained on the Tennis Ball Detection Dataset by Viren Dhanwani, available on Roboflow Universe.

  • โ€”Training images: 408
  • โ€”Validation images: 62
  • โ€”Test images: 50
  • โ€”Total: 520 annotated images
  • โ€”Annotation format: YOLO format (bounding boxes)
  • โ€”Source: Roboflow Universe - Tennis Ball Detection

Training Configuration

yaml
Model: YOLOv11n (nano)
Epochs: 100
Batch size: 16
Image size: 640x640
Device: Apple M4 Pro (MPS)
Optimizer: AdamW
Learning rate: 0.001 โ†’ 0.01
Training time: ~23 minutes

Augmentation

  • โ€”HSV color jitter (h=0.015, s=0.7, v=0.4)
  • โ€”Random horizontal flip (p=0.5)
  • โ€”Translation (ยฑ10%)
  • โ€”Scaling (ยฑ50%)
  • โ€”Mosaic augmentation

Loss Weights

  • โ€”Box loss: 7.5
  • โ€”Class loss: 0.5
  • โ€”DFL loss: 1.5

Usage

Installation

bash
pip install ultralytics

Python API

python
from ultralytics import YOLO
from PIL import Image

# Load CourtSide Computer Vision model
model = YOLO('courtsidecv_v0.1.pt')

# Predict on image
results = model.predict('tennis_match.jpg', conf=0.3)

# Display results
results[0].show()

# Get bounding boxes
for box in results[0].boxes:
    x1, y1, x2, y2 = box.xyxy[0]
    confidence = box.conf[0]
    print(f"Ball detected at [{x1:.0f}, {y1:.0f}, {x2:.0f}, {y2:.0f}] with {confidence:.2%} confidence")

Video Processing

python
from ultralytics import YOLO

model = YOLO('courtsidecv_v0.1.pt')

# Process video
results = model.predict(
    source='tennis_match.mp4',
    conf=0.3,
    save=True,
    save_txt=True
)

Command Line

bash
# Predict on image
yolo detect predict model=courtsidecv_v0.1.pt source=image.jpg conf=0.3

# Predict on video
yolo detect predict model=courtsidecv_v0.1.pt source=video.mp4 conf=0.3 save=True

# Validate model
yolo detect val model=courtsidecv_v0.1.pt data=dataset.yaml

Recommended Hyperparameters

Inference Settings

python
# Balanced (recommended)
conf_threshold = 0.30  # Confidence threshold
iou_threshold = 0.45   # NMS IoU threshold
max_det = 50           # Maximum detections per image

# High precision (fewer false positives)
conf_threshold = 0.50
iou_threshold = 0.45
max_det = 30

# High recall (detect more balls, more false positives)
conf_threshold = 0.20
iou_threshold = 0.40
max_det = 100

Limitations

  • โ€”Small objects: Performance may degrade for tennis balls that are very far from the camera (< 20px)
  • โ€”Motion blur: Fast-moving balls may be harder to detect
  • โ€”Occlusion: Partially hidden balls may not be detected
  • โ€”Similar objects: May occasionally detect other small round objects
  • โ€”Lighting: Optimized for outdoor tennis lighting conditions

Model Biases

  • โ€”Trained primarily on standard yellow tennis balls
  • โ€”Dataset includes various court types but may have dataset-specific biases
  • โ€”Better performance on professional match footage vs amateur recordings

Use Cases

โœ… Recommended:

  • โ€”Tennis match analysis and statistics
  • โ€”Automated highlight generation
  • โ€”Player training and coaching tools
  • โ€”Ball trajectory tracking
  • โ€”Sports analytics dashboards
  • โ€”Action recognition pipelines

โš ๏ธ Not Recommended:

  • โ€”Real-time umpiring decisions (use as assistance only)
  • โ€”Safety-critical applications
  • โ€”Detection of non-yellow tennis balls without fine-tuning

Example Results

Sample Detections

Precision: 84.3% - When the model detects a ball, it's correct 84% of the time Recall: 59.5% - The model detects approximately 6 out of 10 tennis balls

Confidence Interpretation

Confidence RangeInterpretation
> 0.7High confidence - very likely a tennis ball
0.5 - 0.7Medium confidence - probably a tennis ball
0.3 - 0.5Low confidence - possible tennis ball
< 0.3Very low confidence - likely false positive

CourtSide Computer Vision Suite

This model is part of the CourtSide Computer Vision project, a comprehensive tennis analysis system featuring:

  • โ€”๐ŸŽพ Ball detection (this model)
  • โ€”๐Ÿ‘ค Player detection and tracking
  • โ€”๐ŸŽฏ Action recognition (forehand, backhand, serve, etc.)
  • โ€”๐Ÿ“Š Match statistics generation

Model Card Authors

  • โ€”Developed by: Vuong
  • โ€”Model date: November 2024
  • โ€”Model version: v0.1
  • โ€”Model type: Object Detection (YOLOv11)

Citations

This Model

If you use this model, please cite:

bibtex
@misc{courtsidecv_v0.1_2024,
  title={CourtSide Computer Vision v0.1: Tennis Ball Detection with YOLOv11},
  author={Vuong},
  year={2024},
  publisher={Hugging Face},
  howpublished={\url{https://huggingface.co/...}}
}

Dataset

This model was trained using the Tennis Ball Detection dataset. Please cite:

bibtex
@misc{tennis-ball-detection_dataset,
  title = {tennis ball detection Dataset},
  type = {Open Source Dataset},
  author = {Viren Dhanwani},
  howpublished = {\url{https://universe.roboflow.com/viren-dhanwani/tennis-ball-detection}},
  url = {https://universe.roboflow.com/viren-dhanwani/tennis-ball-detection},
  journal = {Roboflow Universe},
  publisher = {Roboflow},
  year = {2023},
  month = {feb},
  note = {visited on 2024-11-20}
}

License

MIT License - Free for commercial and academic use.

Acknowledgments

Contact & Support

For questions, issues, or collaboration:

Related Models

Coming soon in the CourtSide Computer Vision suite:

  • โ€”CourtSide CV - Player Detection
  • โ€”CourtSide CV - Racket Detection
  • โ€”CourtSide CV - Court Segmentation

Model Changelog

v0.1 (2024-11-20)

  • โ€”Initial release
  • โ€”YOLOv11n architecture
  • โ€”mAP@50: 67.87%
  • โ€”520 training images from Roboflow dataset
  • โ€”Optimized for tennis ball detection in match footage

Model Size: 5.4 MB Inference Speed: 10-65ms (device dependent) Supported Formats: PyTorch (.pt), ONNX, TensorRT, CoreML

๐ŸŽพ Ready for production use in tennis analysis applications!