johnamit commited on
Commit
e8ab6a5
·
verified ·
1 Parent(s): 473c470

Upload folder using huggingface_hub

Browse files
README.md CHANGED
@@ -1,3 +1,162 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ tags:
4
+ - yolov8
5
+ - object-detection
6
+ - image-classification
7
+ - dinov2
8
+ - sports
9
+ - motogp
10
+ - motorcycle-racing
11
+ - computer-vision
12
+ - pytorch
13
+ datasets:
14
+ - custom
15
+ pipeline_tag: object-detection
16
+ library_name: ultralytics
17
+ ---
18
+
19
+ # 🏍️ MotoGP Team Detection & Re-ID Models
20
+
21
+ <div align="center">
22
+
23
+ **Fine-tuned weights for detecting and identifying MotoGP teams from race broadcast footage.**
24
+
25
+ [![GitHub](https://img.shields.io/badge/GitHub-Repository-181717?style=for-the-badge&logo=github)](https://github.com/johnamit/mgp-detect)
26
+
27
+ </div>
28
+
29
+ ## Model Overview
30
+
31
+ This repository contains trained model weights for the [MotoGP Team Detection](https://github.com/johnamit/mgp-detect) project — a deep learning pipeline for **real-time MotoGP team detection, tracking, and re-identification** from race broadcast footage.
32
+
33
+ ### Included Weights
34
+
35
+ | File | Description | Size |
36
+ |------|-------------|------|
37
+ | `motogp_yolov8m_detector.pt` | Fine-tuned YOLOv8m for motorcycle detection | ~50MB |
38
+ | `dinov3_team_classifier.pkl` | Logistic Regression classifier trained on DINOv3 embeddings | ~35KB |
39
+
40
+ ## Pipeline Architecture
41
+
42
+ ```
43
+ Video Frame → YOLOv8 Detector → Crop → DINOv3 Feature Extraction → Team Classifier → Re-ID Tracking
44
+ ```
45
+
46
+ 1. **Detection**: YOLOv8m (fine-tuned) localizes motorcycles in each frame
47
+ 2. **Feature Extraction**: DINOv3 ViT-S/16 extracts dense semantic features from detected regions
48
+ 3. **Classification**: Logistic Regression head predicts team identity from DINO embeddings
49
+ 4. **Re-ID & Tracking**: ByteTrack + Cosine Similarity Memory Bank for persistent tracking
50
+
51
+ ## Supported Teams (2025 Season)
52
+
53
+ | Manufacturer | Teams |
54
+ |--------------|-------|
55
+ | **Ducati** | Lenovo Team, Gresini Racing, VR46 Racing |
56
+ | **Aprilia** | Factory Racing, Trackhouse Racing |
57
+ | **KTM** | Factory Racing, Tech3 |
58
+ | **Honda** | Repsol HRC, LCR Honda |
59
+ | **Yamaha** | Monster Energy, Prima Pramac |
60
+
61
+ ## Usage
62
+
63
+ ### 1. Download Weights
64
+
65
+ ```python
66
+ from huggingface_hub import hf_hub_download
67
+
68
+ # Download YOLOv8 detector
69
+ detector_path = hf_hub_download(
70
+ repo_id="johnamit/motogp-team-detection",
71
+ filename="motogp_yolov8m_detector.pt"
72
+ )
73
+
74
+ # Download team classifier
75
+ classifier_path = hf_hub_download(
76
+ repo_id="johnamit/motogp-team-detection",
77
+ filename="dinov3_team_classifier.pkl"
78
+ )
79
+ ```
80
+
81
+ ### 2. Prerequisites (Base Models)
82
+
83
+ These weights require the following base models:
84
+
85
+ #### YOLOv8 (Ultralytics)
86
+ ```bash
87
+ pip install ultralytics
88
+ ```
89
+ [YOLOv8 Documentation](https://docs.ultralytics.com/models/yolov8/)
90
+
91
+ #### DINOv3 (Meta AI)
92
+ Clone the DINOv3 repository for feature extraction:
93
+ ```bash
94
+ git clone https://github.com/facebookresearch/dinov3.git
95
+ ```
96
+ Download the ViT-S/16 pretrained weights from the [DINOv3 repo](https://github.com/facebookresearch/dinov3).
97
+
98
+ ### 3. Inference Example
99
+
100
+ ```python
101
+ from ultralytics import YOLO
102
+ import torch
103
+ import joblib
104
+
105
+ # Load detector
106
+ detector = YOLO(detector_path)
107
+
108
+ # Load classifier
109
+ classifier = joblib.load(classifier_path)
110
+
111
+ # Run detection
112
+ results = detector.predict(source="race_frame.jpg", conf=0.5)
113
+
114
+ # For each detection, extract DINOv3 features and classify
115
+ # See full pipeline: https://github.com/johnamit/mgp-detect
116
+ ```
117
+
118
+ ## Training Details
119
+
120
+ ### YOLOv8 Detector
121
+ - **Base Model**: YOLOv8m
122
+ - **Dataset**: 501 annotated instances (404 motorcycles, 97 null/background)
123
+ - **Augmentation**: Rotations, exposure adjustments, noise injection
124
+ - **Platform**: [Roboflow](https://app.roboflow.com)
125
+
126
+ ### DINOv3 Team Classifier
127
+ - **Backbone**: DINOv3 ViT-S/16 (frozen, pretrained on LVD-142M)
128
+ - **Head**: Scikit-learn Logistic Regression
129
+ - **Dataset**: ~700 high-quality crops across 11 teams
130
+ - **Features**: 384-dimensional embeddings
131
+
132
+ ## Performance
133
+
134
+ The system is optimized for broadcast footage with:
135
+ - High-speed motion blur handling
136
+ - Rapid camera cut recovery
137
+ - Persistent identity tracking across occlusions
138
+ - Label locking after high-confidence agreement
139
+
140
+ ## Citation
141
+
142
+ If you use these weights in your research, please cite:
143
+
144
+ ```bibtex
145
+ @software{motogp_team_detection_2025,
146
+ author = {Amit John},
147
+ title = {MotoGP Team Detection and Re-Identification},
148
+ year = {2025},
149
+ publisher = {GitHub},
150
+ url = {https://github.com/johnamit/mgp-detect}
151
+ }
152
+ ```
153
+
154
+ ## License
155
+
156
+ MIT License - See the [GitHub repository](https://github.com/johnamit/mgp-detect) for full details.
157
+
158
+ ## Acknowledgments
159
+
160
+ - [Ultralytics](https://ultralytics.com/) for YOLOv8
161
+ - [Meta AI](https://github.com/facebookresearch/dinov3) for DINOv3
162
+ - [Roboflow](https://roboflow.com/) for annotation tools
dinov3_team_classifier.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:be39b1d411cd99a60ad78f19d31eb70a5bba1d59b9d79232b9de36d1911337c5
3
+ size 35063
motogp_yolov8m_detector.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c315f1711280cf24907935f08589c2504ef6f858e9ec4e815a7c4ed44160dd0d
3
+ size 52038354