Technical Documentation

Complete technical reference for the RF-DETR shuttle detection system

Overview

This system uses a custom-trained RF-DETR (Real-Time Detection Transformer) model to detect badminton shuttlecocks in video footage with high precision. The solution leverages transformer-based object detection for accurate and reliable shuttle tracking across varying lighting conditions and camera angles.

Unlike traditional CNN-based detectors, RF-DETR uses attention mechanisms to capture long-range dependencies and spatial relationships, resulting in superior performance for small object detection tasks like shuttle tracking.

Demo Note: This web application displays pre-processed videos with RF-DETR annotations. The model inference was performed offline on high-performance hardware. The Flask app serves the annotated videos and detection statistics without running real-time inference.

Model Details

Architecture

The model is based on RT-DETR (Real-Time Detection Transformer) with a ResNet-50 backbone, specifically fine-tuned for badminton shuttle detection.

Parameter Value Notes
Model Name RF-DETR Medium Detection Transformer architecture
Base Architecture RT-DETR ResNet-50 backbone
Framework PyTorch + Supervision Modern CV stack
Input Resolution 1920×1080 px Full HD processing
Model Size 515 MB Full precision checkpoint
Inference Device CUDA (GPU) NVIDIA GPU required

Performance Metrics

Metric Value Description
Precision 85.7% Proportion of correct detections (minimizes false positives)
Recall 75.0% Proportion of shuttles detected (minimizes false negatives)
F1-Score 80.0% Harmonic mean of precision and recall
True Positives 18 Correctly identified shuttles on validation set
False Positives 3 Incorrect detections (e.g., rackets misclassified)
False Negatives 6 Missed shuttle instances
IoU Threshold 0.5 Intersection over Union for evaluation
Confidence Threshold 0.50 Optimized for precision (production setting)

Why 0.5 Confidence Threshold?

After extensive evaluation across thresholds from 0.10 to 0.90, we selected 0.50 for production deployment. While 0.35 gives the best F1-score (80.0%), the 0.50 threshold prioritizes precision (85.7%) to minimize false positives—critical for avoiding rackets or other objects being detected as shuttles in real-world scenarios.

Dataset

Dataset Composition

The model was trained on a custom-labeled dataset specifically curated for badminton shuttle detection:

Split Images Percentage
Training 195 80%
Validation 24 10%
Test 25 10%
Total 244 100%

Dataset Characteristics

Training Process

Training Configuration

The model was trained using standard PyTorch and RF-DETR frameworks on a custom badminton shuttle dataset.

# Model initialization and training
# RF-DETR Medium with ResNet-50 backbone
# Custom dataset: 244 images (195 train, 24 val, 25 test)
# Training: 200 epochs with AdamW optimizer
# Confidence threshold: 0.5 (production setting)

Training Details

Parameter Value
Training Epochs 200
Training Images 195
Validation Images 24
Test Images 25
Total Dataset 244 annotated images
Optimizer AdamW
Backbone ResNet-50

Inference

Video Processing

The system processes video files frame-by-frame, applying the RF-DETR model to detect shuttles. All demo videos have been pre-processed with shuttle detection annotations.

# Video processing pipeline (conceptual)
# 1. Load RF-DETR model with trained weights
# 2. Process each frame with confidence threshold 0.5
# 3. Apply bounding box annotations
# 4. Generate annotated video output
# 5. Calculate detection statistics (coverage, quality)

Detection Statistics (6 Rally Videos)

Metric Value
Total Detections 2,862
Average Coverage 66.4%
Best Coverage 87.9% (Rally 6)
Detection Quality Excellent to Good

Performance Analysis

Threshold Evaluation

We evaluated the model across 9 different confidence thresholds to determine the optimal production setting:

Threshold Precision Recall F1-Score
0.30 81.8% 75.0% 78.3%
0.35 85.7% 75.0% 80.0% (Best F1)
0.50 85.7% 75.0% 80.0% (Production)
0.60 85.7% 70.8% 77.6%
0.70 85.0% 70.8% 77.3%

API Reference

GET /api/videos

Returns list of available rally videos with metadata.

{
  "videos": [
    {
      "id": "rally_08",
      "title": "Rally 1 - Technical Rally",
      "description": "Rally with deceptive shots and pace changes",
      "date": "Aug 28, 2023",
      "duration_formatted": "15s",
      "total_frames": 456,
      "total_detections": 350,
      "detection_rate": "76.8%",
      ...
    }
  ]
}

GET /api/video/{video_id}/stats

Returns detailed statistics for a specific video including RF-DETR model metrics.

{
  "title": "Rally 1 - Technical Rally",
  "total_frames": 456,
  "total_detections": 350,
  "frames_with_detections": 350,
  "detection_rate": "76.8%",
  "avg_detections_per_frame": 0.768,
  "model_name": "RF-DETR Medium",
  "model_architecture": "RT-DETR (Real-Time Detection Transformer)",
  "model_precision": 85.7,
  "model_recall": 75.0,
  "model_f1_score": 80.0,
  "confidence_threshold": 0.5,
  ...
}

GET /api/health

Health check endpoint for monitoring.

{
  "status": "healthy",
  "service": "badminton-detection-demo",
  "model": "RF-DETR Medium",
  "architecture": "RT-DETR",
  "version": "2.0.0"
}

Deployment

System Requirements

Local Development Setup

# Clone repository
git clone [email protected]:shon-1210/badminton-shuttle-detection.git
cd badminton-shuttle-detection

# Checkout production branch
git checkout ec2-stable

# Create virtual environment
python3 -m venv venv
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

# Run development server
python3 app/main.py

# Access at http://127.0.0.1:5001

Production Deployment Stack

The application can be deployed with the following recommended stack:

Learn More

For more information about the project: