The implementation of “Towards accurate one-stage object detection with AP-loss” and its journal version.
- Python 2.7
- PyTorch 1.3+
- Cuda
- Clone this repo
git clone https://github.com/cccorn/AP-loss.git
cd AP-loss
- Install the python packages:
pip install pycocotools
pip install opencv-python
- Create directories:
mkdir data models results
- Prepare Data. You can use
ln -s $YOUR_PATH_TO_coco data/coco
ln -s $YOUR_PATH_TO_VOCdevkit data/voc
The directories should be arranged like:
├── data
│ ├── coco
│ │ ├── annotations
│ │ ├── images
│ │ │ ├── train2017
│ │ │ ├── val2017
│ │ │ ├── test-dev2017
│ ├── voc
│ │ ├── VOC2007
│ │ ├── VOC2012
- Prepare the pre-trained models and put them in
models
like:
├── models
│ ├── resnet50-pytorch.pth
| ├── resnet101-pytorch.pth
We use the ResNet-50 and ResNet-101 pre-trained models which are converted from here. We also provide the converted pre-trained models at this link.
bash train.sh
You can modify the configurations in lib/config.py
to change the gpu_ids, network depth, image size, etc.
bash test.sh
We release the AP-loss implementation in PyTorch instead of in MXNet due to an engineering issue: the python custom operator in MXNet does not run in parrallel when using multi-gpus. It is more practical to implement AP-loss in PyTorch, for faster training speed.
- Many thanks to the pytorch implementation of RetinaNet at pytorch-retinanet.
If you find this repository useful in your research, please consider citing:
@article{chen2020ap,
title={AP-Loss for Accurate One-Stage Object Detection},
author={Chen, Kean and Lin, Weiyao and Li, Jianguo and See, John and Wang, Ji and Zou, Junni},
journal={IEEE Transactions on Pattern Analysis and Machine Intelligence},
doi={10.1109/TPAMI.2020.2991457}
}