Spaces:
Configuration error
YOLOv8-MPEB Kaggle Training Guide
Quick Start for Kaggle
1. Upload Files to Kaggle Dataset
Create a new Kaggle dataset and upload these files:
yolov8_mpeb.yaml- Model architectureyolov8_mpeb_modules.py- Custom modulesdataset_example.yaml- Dataset configurationtrain_kaggle.py- Kaggle training script
2. Create a New Kaggle Notebook
- Go to Kaggle Notebooks
- Create a new notebook
- Add your dataset as input (e.g.,
yolo-mpeb-training-code) - Enable GPU (Settings → Accelerator → GPU P100)
3. Run Training in Kaggle Notebook
# Cell 1: Copy training script to working directory
import shutil
from pathlib import Path
CODE_DIR = Path('/kaggle/input/yolo-mpeb-training-code/code')
shutil.copy(CODE_DIR / 'train_kaggle.py', '/kaggle/working/train_kaggle.py')
print("✓ Training script copied to working directory")
# Cell 2: Install Ultralytics (if needed)
!pip install ultralytics -q
# Cell 3: Run training
!python /kaggle/working/train_kaggle.py
Important Notes
Kaggle File System Structure
/kaggle/input/- READ-ONLY directory containing your input datasets/kaggle/working/- WRITABLE directory for outputs, models, and temporary files/kaggle/temp/- WRITABLE temporary directory
Path Configuration
The dataset_example.yaml has been configured to use /kaggle/working/VisDrone as the dataset root. This ensures:
- Dataset downloads go to a writable location
- Training outputs are saved correctly
- No "Read-only file system" errors
Dataset Download
The VisDrone dataset will be automatically downloaded to /kaggle/working/VisDrone on first run. This is approximately 2.3 GB and may take a few minutes.
Training Duration
- Estimated time: 6-8 hours on Tesla P100
- Epochs: 200
- Batch size: 32
- Image size: 640x640
Output Files
After training completes, you'll find:
- Best weights:
/kaggle/working/runs/train/yolov8_mpeb/weights/best.pt - Last weights:
/kaggle/working/runs/train/yolov8_mpeb/weights/last.pt - Training plots:
/kaggle/working/runs/train/yolov8_mpeb/ - Validation results: In the training output
Saving Your Results
Since Kaggle notebooks reset after session ends, make sure to:
- Save output - Click "Save Version" to preserve your notebook with outputs
- Download weights - Download the
.ptfiles before closing - Commit notebook - Commit your notebook to save training logs
Troubleshooting
Error: "Read-only file system"
Solution: Make sure dataset_example.yaml uses /kaggle/working/VisDrone as the path, not a relative path.
Error: "Module not found"
Solution: Ensure all files are in your Kaggle dataset and the path in train_kaggle.py matches your dataset name.
Error: "CUDA out of memory"
Solution: Reduce batch size in train_kaggle.py:
'batch': 16, # Reduced from 32
Dataset not downloading
Solution: Check your internet connection in Kaggle. The dataset downloads from Ultralytics servers.
Model Specifications
Based on the paper: "YOLOv8-MPEB small target detection algorithm based on UAV images"
- Model: YOLOv8s-MPEB
- Parameters: 7.39M
- Model Size: 14.5 MB
- GFLOPs: 27.4
- Target mAP50: 91.9%
Custom Architecture Components
- MobileNetV3 Backbone - Lightweight feature extraction
- EMA Attention - Efficient Multi-scale Attention in C2f modules
- BiFPN Fusion - Bidirectional Feature Pyramid Network
- P2 Detection Head - Enhanced small object detection
After Training
Validate Your Model
from ultralytics import YOLO
model = YOLO('/kaggle/working/runs/train/yolov8_mpeb/weights/best.pt')
results = model.val(data='/kaggle/working/code/dataset_example.yaml')
print(f"mAP50: {results.box.map50:.4f}")
print(f"mAP50-95: {results.box.map:.4f}")
Run Inference
from ultralytics import YOLO
model = YOLO('/kaggle/working/runs/train/yolov8_mpeb/weights/best.pt')
results = model.predict('path/to/image.jpg', save=True, conf=0.25)
Support
For issues or questions:
- Check the error message carefully
- Verify all paths are correct
- Ensure GPU is enabled in Kaggle settings
- Check that all required files are in your dataset
License
This implementation is based on the YOLOv8-MPEB paper and uses the Ultralytics framework (AGPL-3.0 License).