RoadDamageDetection2020
repository contain codes for IEEE BigData Cup Challange 2020
Install / Use
/learn @mahdi65/RoadDamageDetection2020README
Road Crack Detection Challange 2020 - IEEE Bigdata Cup Challange
This repository contain codes for paper "An Efficient And Scalable Deep Learning Approach for Road Damage Detection"
The solution is based on EfficientDet paper by Tan et al.

<img src="doc/India_006794.jpg" width="350"> <img src="doc/Japan_000316.jpg" width="350"> <img src="doc/Japan_011814.jpg" width="350"> <img src="doc/Japan_012356.jpg" width="350"> <img src="doc/SETX_1.jpg" width="350"> <img src="doc/SETX_2.jpg" width="350"> <img src="doc/SETX_3.jpg" width="350"> <img src="doc/SETX_4.jpg" width="350">
Model checkpoints
| Model | Input Image Resolution | #params | Inf Time (Image/ms) b=16 | AP | AP50 | AP75 | F1 | |------------------------ |------------------------ |--------- |:-------------------------: |------ |------ |------ |------- | | D0 checkpoint | 512 | 3.9M | 178 | 19.1 | 47.2 | 11.5 | 54.04 | | D0-AUG checkpoint | 512 | 3.9M | 178 | 19.8 | 48.5 | 12.1 | 54.03 | | D1 checkpoint | 640 | 6.5M | 147 | 21.7 | 51.5 | 13.4 | 56.9 | | D1-AUG checkpoint | 640 | 6.5M | 147 | 22.0 | 51.7 | 13.1 | 56.5 | | D2 checkpoint | 768 | 8M | 100 | 22.9 | 53.5 | 14.9 | 56.7 | | D2-AUG checkpoint | 768 | 8M | 100 | 22.9 | 54.2 | 15.2 | 56.6 | | D3 checkpoint | 796 | 11.9M | 57 | 23.0 | 53.4 | 15.0 | 56.5 | | D3- AUG checkpoint | 796 | 11.9M | 57 | 22.6 | 53.4 | 14.7 | 56.8 | | D4 checkpoint | 1024 | 20.5M | 38 | 22.8 | 53.3 | 15.1 | 57.2 | | D7-AUG checkpoint | 1536 | 51M | 10 | 23.4 | 53.6 | 15.0 | 56.5 |
Usage
Consider unisng a workspace for cleaner
- install required Libraries : 1.1.
- python>= 3.6
- pytorch 1.4 or 1.6
- torchvision >= 0.5
- apex is also needed
- timm >= 1.28
pip install -r requirements.txt
1.2.
install apex (2020-10-26):
git clone https://github.com/NVIDIA/apex
pip install -r apex/requirements.txt
pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./apex
- download Dataset : for ease of use we have provided annotations and ... in coco format downloadable:
- train and validation sets
- test1 and test2 data(no annotation).
otherwise one can download original data from sekilab github repo and convert using tools provided in utils folder.
- for training :
- Train on single GPU :
python train.py ../data --model tf_efficientdet_d0 -b 40 --amp --lr .15 --sync-bn --opt fusedmomentum --warmup-epochs 3 --lr-noise 0.3 0.9 --model-ema --model-ema-decay 0.9998 -j 25 --epochs 300
- Distributed Training : (note you may need to make the file executable before training using
chmod +x distributed_train.sh)
./distributed_train.sh 3 ../data --model tf_efficientdet_d0 -b 40 --amp --lr .15 --sync-bn --opt fusedmomentum --warmup-epochs 3 --lr-noise 0.3 0.9 --model-ema --model-ema-decay 0.9998 -j 25 --epochs 300
- for inference on testset and generating submission file :
python infer.py ./data --model tf_efficientdet_d0 --checkpoint ./path/to/model/checkpoint --use-ema --anno test1 -b 17 --threshold 0.300
- Image Inference to generate detected images
- first create image_info_annotations(e.g. if image folder is in
../datapath. One should first create image info in json format usingpython utils/createimageinfo.pythen folder structure should be like )
..
├── data
│ └── annotations
| ├── image_info_test1.json
├── test1
│ ├── Japan_XXX.jpg
│ └── Czech_xxx.jpg
| └── ....
following command will create generated file with bounding boxes in ./predictions
python detector.py ../data --model tf_efficientdet_d0 --checkpoint path.to/modelfile.pth.tar --anno test1 -b 20 --use-ema --tosave ./predictions
for validation (AP scores) and benchmarking with cuda.Event() use the following command :
python validate.py ../data --model tf_efficientdet_d0 --checkpoint path/to/model/checkpoint.pth.tar --anno val -b 20 --use-ema
Utils
Some utils are provided in utils folder such as tools to calculate anchor boxes ratis mean and std of train set and validation set and ... .
cite
Please cite if you use paper or code : Paper is accepted at IEEE BigData 2020.
@misc{naddafsh2020efficient,
title={An Efficient and Scalable Deep Learning Approach for Road Damage Detection},
author={Sadra Naddaf-sh and M-Mahdi Naddaf-sh and Amir R. Kashani and Hassan Zargarzadeh},
year={2020},
eprint={2011.09577},
archivePrefix={arXiv},
primaryClass={cs.CV}
}
other repos used :
- a pytorch implementation of efficientDet by rwightman
- timm pytorch model tools
- apex.
- effientDet paper
- k-means anchor calculator.
