Home

Awesome

FreeAnchor

The Code for "FreeAnchor: Learning to Match Anchors for Visual Object Detection".

This repository is based on maskrcnn-benchmark, and FreeAnchor has also been implemented in mmdetection, thanks @yhcao6 and @hellock.

architecture

New performance on COCO

We added multi-scale testing support and updated experiments. The previous version is in this branch.

BackboneIterationTraining scalesMulti-scale<br>testingAP<br>(minival)AP<br>(test-dev)Model
ResNet-50-FPN90k800N38.738.7Link
ResNet-101-FPN90k800N40.540.9Link
ResNet-101-FPN180k[640, 800]N42.743.1Link
ResNet-101-FPN180k[480, 960]N43.243.9Link
ResNet-101-FPN180k[480, 960]Y44.745.2Link
ResNeXt-64x4d-101-FPN180k[640, 800]N44.544.9Link
ResNeXt-64x4d-101-FPN180k[480, 960]N45.646.0Link
ResNeXt-64x4d-101-FPN180k[480, 960]Y46.847.3Link

Notes:

Installation

Check INSTALL.md for installation instructions.

Usage

You will need to download the COCO dataset and configure your own paths to the datasets.

For that, all you need to do is to modify maskrcnn_benchmark/config/paths_catalog.py to point to the location where your dataset is stored.

Config Files

We provide four configuration files in the configs directory.

Config FileBackboneIterationTraining scales
configs/free_anchor_R-50-FPN_1x.yamlResNet-50-FPN90k800
configs/free_anchor_R-101-FPN_1x.yamlResNet-101-FPN90k800
configs/free_anchor_R-101-FPN_j2x.yamlResNet-101-FPN180k[640, 800]
configs/free_anchor_X-101-FPN_j2x.yamlResNeXt-64x4d-101-FPN180k[640, 800]
configs/free_anchor_R-101-FPN_e2x.yamlResNet-101-FPN180k[480, 960]
configs/free_anchor_X-101-FPN_e2x.yamlResNeXt-64x4d-101-FPN180k[480, 960]

Training with 8 GPUs

cd path_to_free_anchor
export NGPUS=8
python -m torch.distributed.launch --nproc_per_node=$NGPUS tools/train_net.py --config-file "path/to/config/file.yaml"

Test on COCO test-dev

cd path_to_free_anchor
python -m torch.distributed.launch --nproc_per_node=$NGPUS tools/test_net.py --config-file "path/to/config/file.yaml" MODEL.WEIGHT "path/to/.pth file" DATASETS.TEST "('coco_test-dev',)"

Multi-scale testing

cd path_to_free_anchor
python -m torch.distributed.launch --nproc_per_node=$NGPUS tools/multi_scale_test.py --config-file "path/to/config/file.yaml" MODEL.WEIGHT "path/to/.pth file" DATASETS.TEST "('coco_test-dev',)"

Evaluate NMS Recall

cd path_to_free_anchor
python -m torch.distributed.launch --nproc_per_node=$NGPUS tools/eval_NR.py --config-file "path/to/config/file.yaml" MODEL.WEIGHT "path/to/.pth file"

Citations

Please consider citing our paper in your publications if the project helps your research.

@inproceedings{zhang2019freeanchor,
  title   =  {{FreeAnchor}: Learning to Match Anchors for Visual Object Detection},
  author  =  {Zhang, Xiaosong and Wan, Fang and Liu, Chang and Ji, Rongrong and Ye, Qixiang},
  booktitle =  {Neural Information Processing Systems},
  year    =  {2019}
}