YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
π Optimized Vehicle Detection using Ensemble YOLO + Weighted Boxes Fusion
M.Tech Thesis Project β Vehicle detection in adverse weather (fog, rain, snow, sand) using the DAWN dataset with a Self-Adaptive 3-Tier WBF ensemble of YOLO11m + YOLO26m.
π Repository Contents
| File | Description |
|---|---|
kaggle_notebook.py |
Complete Kaggle-ready pipeline β copy-paste into a Kaggle notebook with dual T4 GPUs and run. Includes all 7 phases: data prep β HP search β training β fine-tuning β WBF ensemble β evaluation β results export. |
prepare_data.py |
Standalone data preparation script β downloads DAWN from HuggingFace, converts to YOLO format, augments minority classes, creates 60/20/20 split |
train_pipeline.py |
Alternative pipeline for HuggingFace Jobs execution |
ποΈ Architecture
Models
- YOLO11m (20M params) β Ultralytics YOLO11 medium, COCO pretrained
- YOLO26m (20.4M params) β Ultralytics YOLO26 medium, COCO pretrained
Self-Adaptive 3-Tier WBF Ensemble
Input Image
ββββ YOLO11m βββ Detectionsβ
ββββ YOLO11m_ft βββ Detectionsβ
ββββ YOLO26m_ft βββ Detectionsβ
β
βββββββ΄ββββββ
β Tier 1 β Per-class F1-based weights (static)
β Tier 2 β Per-image confidence modulation (dynamic)
β Tier 3 β Log-dampened count normalization
βββββββ¬ββββββ
β
Weighted Boxes Fusion
β
Fused Detections
Tier 1 β Performance-Calibrated Base Weights: For each model mα΅’ and class cβ±Ό, compute F1 on validation set. Normalize so weights sum to 1 per class.
Tier 2 β Per-Image Confidence Modulation: Dynamically shift weights based on each model's average confidence on the current image.
Tier 3 β Box Count Normalization (Fixed): Log-dampened normalization prevents volume dominance without destroying score calibration.
π Dataset
- Source: DAWN Dataset (Kenk & Hassaballah, 2020)
- Weather: Fog (250), Rain (250), Snow (250), Sand (250) = 1000 base images
- Classes: Bicycle, Bus, Car, Motorcycle, Pedestrian, Truck
- Augmentation: Mirror + rotation for minority classes β ~1800+ total images
- Split: 60% train / 20% val / 20% test
Class Distribution (Original)
| Class | Count | % |
|---|---|---|
| Car | 6,454 | 82.2% |
| Truck | 646 | 8.2% |
| Person | 477 | 6.1% |
| Bus | 161 | 2.1% |
| Motorcycle | 81 | 1.0% |
| Bicycle | 26 | 0.3% |
π§ Bug Fixes Applied
This pipeline fixes all 3 known bugs from the original Kaggle execution:
1. NoneType HP Search Error
Problem: T01: failed β 'NoneType' object has no attribute 'results_dict'
Cause: model.train() returns None on silent crash (OOM, NaN loss)
Fix: Null-check before accessing results + bounded HP ranges + torch.cuda.empty_cache() between trials
2. _thread.lock Pickling Error
Problem: ensemble.pkl failed: cannot pickle '_thread.lock' object
Cause: YOLO objects contain CUDA contexts and thread locks
Fix: save_config() / load_config() using JSON β only serializes paths and weights, reconstructs YOLO objects on load
3. Ensemble Metric Drop
Problem: Ensemble P/R lower than individual models despite strong per-class scores Causes & Fixes:
sqrt(count)normalization too aggressive β changed tolog2(count)scores / scores.max()re-normalization destroyed weight signal β removed entirelyconf_alpha=0.3caused over-modulation β reduced to 0.1- Macro average included 0-support classes β now averages active classes only
conf_type='avg'ignored model weights β changed to'box_and_model_avg'
π Quick Start (Kaggle)
- Create a new Kaggle Notebook
- Select GPU T4 x2 accelerator
- Create a single code cell and paste the contents of
kaggle_notebook.py - Run β fully autonomous, ~4-6 hours
- Results in
/kaggle/working/results/
π Citation
@article{kenk2020dawn,
title={DAWN: Vehicle Detection in Adverse Weather Nature Dataset},
author={Kenk, Mourad Ambarka and Hassaballah, M.},
journal={arXiv preprint arXiv:2008.05402},
year={2020}
}
@article{solovyev2021wbf,
title={Weighted boxes fusion: Ensembling boxes from different object detection models},
author={Solovyev, Roman and Wang, Weimin and Gabruseva, Tatiana},
journal={Image and Vision Computing},
year={2021}
}