Package: fcos
~Please note this is only abetarelease at this stage~FCOS: fully convolutional one-stage object detectionFully convolutional one-stage object detection (FCOS) is a framework for per-pixel prediction of objects in images. FCOS doesn't rely on expensive anchor box calculations and their hyper-parameters, which is in contrast to state-of-the-art object detectors like RetinaNet, YOLOv3, and Faster R-CNN.This repository contains an open-source implementation of FCOS in Python, with access to pre-trained weights for a number of different models. The package provides PyTorch implementations for using training, evaluation, and prediction in your own systems. The package is easily installable withconda, and can also be installed viapipif you'd prefer to manually manage dependencies.Our code is free to use, and licensed under BSD-3. We simply ask that youcite our workif you use FCOS in your own research.Related resourcesThis repository brings the work from a number of sources together. Please see the links below for further details:our original paper:"FCOS: Fully convolutional one-stage object detection"our latest paper:"FCOS: A Simple and Strong Anchor-free Object Detector"the original FCOS implementation:https://github.com/tianzhi0549/FCOSimplementation in the AdelaiDet toolbox:https://github.com/aim-uofa/AdelaiDet/blob/master/configs/FCOS-Detection/README.md#fcos-real-time-modelsInstalling FCOSWe offer three methods for installing FCOS:Through our Conda package: single command installs everything including system dependencies (recommended)Through our pip package: single command installs FCOS and Python dependences, you take care of system dependenciesDirectly from source: allows easy editing and extension of our code, but you take care of building and all dependenciesCondaThe only requirement is that you haveConda installedon your system, andNVIDIA drivers installedif you want CUDA acceleration. We provide Conda packages throughConda Forge, which recommends adding their channel globally with strict priority:conda config --add channels conda-forge
conda config --set channel_priority strictOnce you have access to theconda-forgechannel, FCOS is installed by running the following from inside aConda environment:conda install fcosWe don't explicitly lock the PyTorch installation to a CUDA-enabled version to maximise compatibility with our users' possible setups. If you wish to ensure a CUDA-enabled PyTorch is installed, please use the following installation line instead:conda install pytorch=*=*cuda* fcosYou can see a list of our Conda dependencies in theFCOS feedstock's recipe.PipBefore installing viapip, you must have the following system dependencies installed if you want CUDA acceleration:NVIDIA driversCUDAThen FCOS, its custom CUDA code, and all of its Python dependencies, can be installed via:pip install fcosFrom sourceInstalling from source is very similar to thepipmethod above, accept we install from a local copy. Simply clone the repository, enter the directory, and install viapip:pip install -e .Note: the editable mode flag (-e) is optional, but allows you to immediately use any changes you make to the code in your local Python ecosystem.We also include scripts in the./scriptsdirectory to support running FCOS without anypipinstallation, but this workflow means you need to handle all system and Python dependencies manually.Using FCOSFCOS can be used entirely from the command line, or through its Python API. Both call the same underlying implementation, and as such offer equivalent functionality. We provide both options to facilitate use across a wide range of applications. See below for details of each method.FCOS from the command lineWhen installed, either viapiporconda, afcosexecutable is made available on your systemPATH.Thefcosexecutable provides access to all functionality, including training, evaluation, and prediction. See the--helpflags for details on what the command line utility can do, and how it can be configured:fcos --helpfcos train --helpfcos evaluate --helpfcos predict --helpFCOS Python APIFCOS can also be used like any other Python package through its API. The API consists of aFcosclass with three main functions for training, evaluation, and prediction. Below are some examples to help get you started with FCOS:fromfcosimportFcos,fcos_config# Initialise a FCOS network using the default 'FCOS_imprv_R_50_FPN_1x' modelf=Fcos()# Initialise a FCOS network with the 'FCOS_imprv_dcnv2_X_101_64x4d_FPN_2x' modelf=Fcos(load_pretrained='FCOS_imprv_dcnv2_X_101_64x4d_FPN_2x')# Create an untrained model with the settings for 'FCOS_imprv_R_101_FPN_2x'f=Fcos(config_file=fcos_config('FCOS_imprv_R_101_FPN_2x'))# Train a new model on the dataset specified by the config file (DATASETS.TRAIN)f.train()# Train a new model on a custom dataset, with a custom checkpoint frequencyf.train(dataset_name='custom_dataset',checkpoint_period=10)# Get object detection boxes given an input NumPy imagedetection_boxes=f.predict(image=my_image)# Save an image with detection boxes overlaid  to file, given an image filef.predict(image_file='/my/detections.jpg',output_file='/my/image.jpg')# Evaluate your model's performance against the dataset specified by# DATASETS.TEST in the config file, and output the results to a specific# locationf.evaluate(output_directory='/my/eval/output/')Citing our workIf using FCOS in your work, please citeour original ICVV paper:@inproceedings{tian2019fcos,title={FCOS: Fully convolutional one-stage object detection},author={Tian, Zhi and Shen, Chunhua and Chen, Hao and He, Tong},booktitle={Proceedings of the IEEE/CVF International Conference on Computer Vision},pages={9627--9636},year={2019}}Or ourmore recent TPAMI journalwith further details of our work:@article{tian2021fcos,author={Tian, Zhi and Shen, Chunhua and Chen, Hao and He, Tong},journal={IEEE Transactions on Pattern Analysis and Machine Intelligence},title={FCOS: A Simple and Strong Anchor-free Object Detector},year={2020},volume={},number={},pages={1-1},doi={10.1109/TPAMI.2020.3032166}}