GithubHelp home page GithubHelp logo

rodrigogantier / fcos Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tianzhi0549/fcos

0.0 2.0 0.0 6.35 MB

FCOS: Fully Convolutional One-Stage Object Detection

Home Page: https://arxiv.org/abs/1904.01355

License: Other

Dockerfile 0.70% Python 89.45% C++ 3.81% Cuda 6.04%

fcos's Introduction

FCOS: Fully Convolutional One-Stage Object Detection

This project hosts the code for implementing the FCOS algorithm for object detection, as presented in our paper:

FCOS: Fully Convolutional One-Stage Object Detection,
Tian, Zhi, Chunhua Shen, Hao Chen, and Tong He,
arXiv preprint arXiv:1904.01355 (2019).

The full paper is available at: https://arxiv.org/abs/1904.01355.

Highlights

  • Totally anchor-free: FCOS completely avoids the complicated computation related to anchor boxes and all hyper-parameters of anchor boxes.
  • Memory-efficient: FCOS uses 2x less training memory footprint than its anchor-based counterpart RetinaNet.
  • Better performance: The very simple detector achieves better performance (37.1 vs. 36.8) than Faster R-CNN.
  • Faster training and inference: With the same hardwares, FCOS also requires less training hours (6.5h vs. 8.8h) and faster inference speed (71ms vs. 126 ms per im) than Faster R-CNN.
  • State-of-the-art performance: Without bells and whistles, FCOS achieves state-of-the-art performances. It achieves 41.5% (ResNet-101-FPN) and 43.2% (ResNeXt-64x4d-101) in AP on coco test-dev.

Required hardware

We use 8 Nvidia V100 GPUs.
But 4 1080Ti GPUs can also train a fully-fledged ResNet-50-FPN based FCOS since FCOS is memory-efficient.

Installation

This FCOS implementation is based on maskrcnn-benchmark. Therefore the installation is the same as original maskrcnn-benchmark.

Please check INSTALL.md for installation instructions. You may also want to see the original README.md of maskrcnn-benchmark.

Inference

The inference command line on coco minival split:

python tools/test_net.py \
    --config-file configs/fcos/fcos_R_50_FPN_1x.yaml \
    MODEL.WEIGHT models/FCOS_R_50_FPN_1x.pth \
    TEST.IMS_PER_BATCH 4    

Please note that:

  1. If your model's name is different, please replace models/FCOS_R_50_FPN_1x.pth with your own.
  2. If you enounter out-of-memory error, please try to reduce TEST.IMS_PER_BATCH to 1.
  3. If you want to evaluate a different model, please change --config-file to its config file (in configs/fcos) and MODEL.WEIGHT to its weights file.

For your convenience, we provide the following trained models (more models are coming soon).

Model Total training mem (GB) Multi-scale training Testing time / im AP (minival) AP (test-dev) Link
FCOS_R_50_FPN_1x 29.3 No 71ms 37.1 37.4 download
FCOS_R_101_FPN_2x 44.1 Yes 74ms 41.4 41.5 download
FCOS_X_101_32x8d_FPN_2x 72.9 Yes 122ms 42.5 42.7 download
FCOS_X_101_64x4d_FPN_2x 77.7 Yes 140ms 43.0 43.2 download

[1] 1x means the model is trained for 90K iterations.
[2] 2x means the model is trained for 180K iterations.
[3] We report total training memory footprint on all GPUs instead of the memory footprint per GPU as in maskrcnn-benchmark.
[4] All results are obtained with a single model and without any test time data augmentation such as multi-scale, flipping and etc..
[5] Our results have been improved since our initial release. If you want to check out our original results, please checkout commit f4fd589.

Training

The following command line will train FCOS_R_50_FPN_1x on 8 GPUs with Synchronous Stochastic Gradient Descent (SGD):

python -m torch.distributed.launch \
    --nproc_per_node=8 \
    --master_port=$((RANDOM + 10000)) \
    tools/train_net.py \
    --skip-test \
    --config-file configs/fcos/fcos_R_50_FPN_1x.yaml \
    DATALOADER.NUM_WORKERS 2 \
    OUTPUT_DIR training_dir/fcos_R_50_FPN_1x

Note that:

  1. If you want to use fewer GPUs, please reduce --nproc_per_node. The total batch size does not depends on nproc_per_node. If you want to change the total batch size, please change SOLVER.IMS_PER_BATCH in configs/fcos/fcos_R_50_FPN_1x.yaml.
  2. The models will be saved into OUTPUT_DIR.
  3. If you want to train FCOS with other backbones, please change --config-file.
  4. Sometimes you may encounter a deadlock with 100% GPUs' usage, which might be a problem of NCCL. Please try export NCCL_P2P_DISABLE=1 before running the training command line.

Contributing to the project

Any pull requests or issues are welcome.

Citations

Please consider citing our paper in your publications if the project helps your research. BibTeX reference is as follows.

@article{tian2019fcos,
  title   =  {{FCOS}: Fully Convolutional One-Stage Object Detection},
  author  =  {Tian, Zhi and Shen, Chunhua and Chen, Hao and He, Tong},
  journal =  {arXiv preprint arXiv:1904.01355},
  year    =  {2019}
}

License

For academic use, this project is licensed under the 2-clause BSD License - see the LICENSE file for details. For commercial use, please contact the authors.

fcos's People

Contributors

103yiran avatar apacha avatar ausk avatar belowmit avatar bernhardschaefer avatar botcs avatar chhshen avatar climbsrocks avatar coincheung avatar fmassa avatar godricly avatar henrywang1 avatar jario-jin avatar jiayuan-gu avatar keineahnung2345 avatar killthekitten avatar leviviana avatar newstzpz avatar rodrigoberriel avatar soumith avatar sundrops avatar tianzhi0549 avatar vfdev-5 avatar vishwakftw avatar wat3rbro avatar xelmirage avatar yelantf avatar ywlng avatar zhangliliang avatar zimenglan-sysu-512 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.