Trinh Le Ba Khanh, Huy-Hung Nguyen, Long Hoang Pham, Duong Nguyen-Ngoc Tran and Jae Wook Jeon
Official Pytorch implementation of Dynamic Retraining-Updating Mean Teacher for Source-Free Object Detection, ECCV 2024
paper.
The overview of our DRU method is presented in the following figure. For more details, please refer to the paper.
-
Linux, CUDA >= 11.1, GCC >= 8.4
-
Python >= 3.8
-
torch >= 1.10.1, torchvision >= 0.11.2
-
Other requirements
pip install -r requirements.txt
cd ./models/ops
sh ./make.sh
# unit test (should see all checking is True)
python test.py
Our method used 3 popular SFOD benchmarks:
- city2foggy: Cityscapes (source domain) → FoggyCityscapes with foggy level 0.02 (target domain).
- sim2city: Sim10k (source domain) → Cityscapes with
car
class (target domain). - city2bdd: Cityscapes (source domain) → Bdd100k-daytime (target domain).
You can download the raw data from the official websites: Cityscapes, FoggyCityscapes, Sim10k, Bdd100k. The annotations are converted into COCO style, can download from here (provided by MRT-release). The datasets and annotations are organized as:
[data_root]
└─ cityscapes
└─ annotations
└─ cityscapes_train_cocostyle.json
└─ cityscapes_train_caronly_cocostyle.json
└─ cityscapes_val_cocostyle.json
└─ cityscapes_val_caronly_cocostyle.json
└─ leftImg8bit
└─ train
└─ val
└─ foggy_cityscapes
└─ annotations
└─ foggy_cityscapes_train_cocostyle.json
└─ foggy_cityscapes_val_cocostyle.json
└─ leftImg8bit_foggy
└─ train
└─ val
└─ sim10k
└─ annotations
└─ sim10k_train_cocostyle.json
└─ JPEGImages
└─ bdd10k
└─ annotations
└─ bdd100k_daytime_train_cocostyle.json
└─ bdd100k_daytime_val_cocostyle.json
└─ images
First, run source_only
to pretrain the Source-only model. Then, run teaching_standard
to train the conventional Mean-Teacher framework OR teaching_mask
to train the proposed DRU.
For example in city2foggy
benchmark, first edit the files in configs/def-detr-base/city2foggy/
to specify your own DATA_ROOT
and OUTPUT_DIR
, then run:
sh configs/def-detr-base/city2foggy/source_only.sh
sh configs/def-detr-base/city2foggy/teaching_standard.sh
sh configs/def-detr-base/city2foggy/teaching_mask.sh
To evaluate the trained model and get the predicted results, run:
sh configs/def-detr-base/city2foggy/evaluation_source_only.sh
sh configs/def-detr-base/city2foggy/evaluation_teaching_standard.sh
sh configs/def-detr-base/city2foggy/evaluation_teaching_mask.sh
All experiments are conducted with batch size 8 (for source_only
: 8 labeled samples; for teaching_standard
or teaching_mask
: 8 unlabeled samples), on an NVIDIA Quadro RTX 8000 GPU (48GB).
city2foggy: Cityscapes → FoggyCityscapes(level 0.02)
Training stage | AP@50 | logs & weights |
---|---|---|
source_only |
29.5 | Source-only |
teaching_standard |
37.4 | MT |
teaching_mask |
43.6 | DRU |
city2bdd: Cityscapes → Bdd100k(daytime)
Training stage | AP@50 | logs & weights |
---|---|---|
source_only |
29.1 | Source-only |
teaching_standard |
32.6 | MT |
teaching_mask |
36.6 | DRU |
sim2city: Sim10k → Cityscapes(car only)
Training stage | AP@50 | logs & weights |
---|---|---|
source_only |
48.9 | Source-only |
teaching_standard |
56.2 | MT |
teaching_mask |
58.7 | DRU |
If you find our paper or code useful, please cite our work:
@inproceedings{trinh2024dru,
title={Dynamic Retraining-Updating Mean Teacher for Source-Free Object Detection},
author={Trinh Le Ba Khanh, Huy-Hung Nguyen, Long Hoang Pham, Duong Nguyen-Ngoc Tran and Jae Wook Jeon},
booktitle={ECCV},
pages={https://arxiv.org/pdf/2407.16497},
year={2024}
}
This project is built upon MRT-release, Deformable DETR, DT-ST and MIC, and we'd like to appreciate for their excellent works.
If you have any issue with code or paper, feel free to contact trinhlbk@skku.edu
.