提交 fbf97972 编写于 作者: Z Zhi Tian

updated readme and change thresholds in fcos_demo.py

上级 f507fbe1
...@@ -13,9 +13,12 @@ The full paper is available at: [https://arxiv.org/abs/1904.01355](https://arxiv ...@@ -13,9 +13,12 @@ The full paper is available at: [https://arxiv.org/abs/1904.01355](https://arxiv
- **Totally anchor-free:** FCOS completely avoids the complicated computation related to anchor boxes and all hyper-parameters of anchor boxes. - **Totally anchor-free:** FCOS completely avoids the complicated computation related to anchor boxes and all hyper-parameters of anchor boxes.
- **Better performance:** The very simple one-stage detector achieves much better performance (38.7 vs. 36.8 in AP with ResNet-50) than Faster R-CNN. - **Better performance:** The very simple one-stage detector achieves much better performance (38.7 vs. 36.8 in AP with ResNet-50) than Faster R-CNN.
- **Faster training:** With the same hardwares, FCOS also requires less training hours (6.5h vs. 8.8h) than Faster R-CNN. - **Faster training:** With the same hardwares, FCOS also requires less training hours (6.5h vs. 8.8h) than Faster R-CNN.
- **State-of-the-art performance:** Our best model based on ResNeXt-64x4d-101 and deformable convolutions achieves **49.0%** in AP on coco test-dev (with multi-scale testing). - **State-of-the-art performance:** Our best model based on ResNeXt-64x4d-101 and deformable convolutions achieves **49.0%** in AP on COCO test-dev (with multi-scale testing).
## Updates ## Updates
### 11 September 2019
- New models are released. The best model achieves **49%** in AP on COCO test-dev with multi-scale testing.
### 8 August 2019 ### 8 August 2019
- FCOS with VoVNet backbones is available at [VoVNet-FCOS](https://github.com/vov-net/VoVNet-FCOS). - FCOS with VoVNet backbones is available at [VoVNet-FCOS](https://github.com/vov-net/VoVNet-FCOS).
...@@ -57,7 +60,7 @@ Once the installation is done, you can follow the below steps to run a quick dem ...@@ -57,7 +60,7 @@ Once the installation is done, you can follow the below steps to run a quick dem
# assume that you are under the root directory of this project, # assume that you are under the root directory of this project,
# and you have activated your virtual environment if needed. # and you have activated your virtual environment if needed.
wget https://cloudstor.aarnet.edu.au/plus/s/dDeDPBLEAt19Xrl/download -O FCOS_R_50_FPN_1x.pth wget https://cloudstor.aarnet.edu.au/plus/s/ZSAqNJB96hA71Yf/download -O FCOS_imprv_R_50_FPN_1x.pth
python demo/fcos_demo.py python demo/fcos_demo.py
...@@ -83,18 +86,27 @@ For your convenience, we provide the following trained models (more models are c ...@@ -83,18 +86,27 @@ For your convenience, we provide the following trained models (more models are c
Model | Multi-scale training | Testing time / im | AP (minival) | Link Model | Multi-scale training | Testing time / im | AP (minival) | Link
--- |:---:|:---:|:---:|:---: --- |:---:|:---:|:---:|:---:
FCOS_R_50_FPN_1x | No | 71ms | 37.1 | [download](https://cloudstor.aarnet.edu.au/plus/s/dDeDPBLEAt19Xrl/download) FCOS_imprv_R_50_FPN_1x | No | 62ms | 38.7 | [download](https://cloudstor.aarnet.edu.au/plus/s/ZSAqNJB96hA71Yf/download)
FCOS_imprv_R_50_FPN_1x | No | 71ms | 38.7 | [download](https://cloudstor.aarnet.edu.au/plus/s/ZSAqNJB96hA71Yf/download) FCOS_imprv_R_101_FPN_2x | Yes | 76ms | 43.0 | [download](https://cloudstor.aarnet.edu.au/plus/s/hTeMuRa4pwtCemq/download)
FCOS_imprv_dcnv2_R_50_FPN_1x | No | - | 42.3 | [download](https://cloudstor.aarnet.edu.au/plus/s/plKgHuykjiilzWr/download) FCOS_imprv_X_101_32x8d_FPN_2x | Yes | 130ms | 44.0 | [download](https://cloudstor.aarnet.edu.au/plus/s/WZ0i7RZW5BRpJu6/download)
FCOS_R_101_FPN_2x | Yes | 74ms | 41.4 | [download](https://cloudstor.aarnet.edu.au/plus/s/vjL3L0AW7vnhRTo/download) FCOS_imprv_X_101_64x4d_FPN_2x | Yes | 133ms | 44.7 | [download](https://cloudstor.aarnet.edu.au/plus/s/rKOJtwvJwcKVOz8/download)
FCOS_imprv_R_101_FPN_2x | Yes | 74ms | 42.9 | [download](https://cloudstor.aarnet.edu.au/plus/s/hTeMuRa4pwtCemq/download)
FCOS_imprv_dcnv2_R_101_FPN_2x | Yes | - | 45.6 | [download](https://cloudstor.aarnet.edu.au/plus/s/xq2Ll7s0hpaQycO/download) *The following models are with deformable convolutions (v2). Note that for ResNet based models, we apply deformable convolutions from stage c3 to c5 in backbones. For ResNeXt based models, only stage c4 and c5 use deformable convolutions. All models use deformable convolutions in the last layer of detector towers.*
FCOS_X_101_32x8d_FPN_2x | Yes | 122ms | 42.5 | [download](https://cloudstor.aarnet.edu.au/plus/s/U5myBfGF7MviZ97/download) Model | Multi-scale training | Testing time / im | AP (minival) | Link
FCOS_imprv_X_101_32x8d_FPN_2x | Yes | 122ms | 44.0 | [download](https://cloudstor.aarnet.edu.au/plus/s/WZ0i7RZW5BRpJu6/download) --- |:---:|:---:|:---:|:---:
FCOS_imprv_dcnv2_X_101_32x8d_FPN_2x | Yes | - | 46.4 | [download](https://cloudstor.aarnet.edu.au/plus/s/08UK0OP67TogLCU/download) FCOS_imprv_dcnv2_R_50_FPN_1x | No | 70ms | 42.3 | [download](https://cloudstor.aarnet.edu.au/plus/s/plKgHuykjiilzWr/download)
FCOS_X_101_64x4d_FPN_2x | Yes | 140ms | 43.0 | [download](https://cloudstor.aarnet.edu.au/plus/s/wpwoCi4S8iajFi9/download) FCOS_imprv_dcnv2_R_101_FPN_2x | Yes | 89ms | 45.6 | [download](https://cloudstor.aarnet.edu.au/plus/s/xq2Ll7s0hpaQycO/download)
FCOS_imprv_X_101_64x4d_FPN_2x | Yes | 140ms | 44.7 | [download](https://cloudstor.aarnet.edu.au/plus/s/rKOJtwvJwcKVOz8/download) FCOS_imprv_dcnv2_X_101_32x8d_FPN_2x | Yes | 157ms | 46.4 | [download](https://cloudstor.aarnet.edu.au/plus/s/08UK0OP67TogLCU/download)
FCOS_imprv_dcnv2_X_101_64x4d_FPN_2x | Yes | - | 46.6 | [download](https://cloudstor.aarnet.edu.au/plus/s/jdtVmG7MlugEXB7/download) FCOS_imprv_dcnv2_X_101_64x4d_FPN_2x | Yes | 160ms | 46.6 | [download](https://cloudstor.aarnet.edu.au/plus/s/jdtVmG7MlugEXB7/download)
*Note that `imprv` denotes `improvements` in our paper Table 3. These almost cost-free changes improve the performance by ~1.5% in total. Thus, we highly recommend to use them. The following are original models presented in our initial paper.*
Model | Multi-scale training | Testing time / im | AP (minival) | Link
--- |:---:|:---:|:---:|:---:
FCOS_R_50_FPN_1x | No | 64ms | 37.0 | [download](https://cloudstor.aarnet.edu.au/plus/s/dDeDPBLEAt19Xrl/download)
FCOS_R_101_FPN_2x | Yes | 78ms | 41.3 | [download](https://cloudstor.aarnet.edu.au/plus/s/vjL3L0AW7vnhRTo/download)
FCOS_X_101_32x8d_FPN_2x | Yes | 132ms | 42.5 | [download](https://cloudstor.aarnet.edu.au/plus/s/U5myBfGF7MviZ97/download)
FCOS_X_101_64x4d_FPN_2x | Yes | 135ms | 43.0 | [download](https://cloudstor.aarnet.edu.au/plus/s/wpwoCi4S8iajFi9/download)
**MobileNets:** **MobileNets:**
...@@ -109,7 +121,8 @@ FCOS_bn_bs16_MNV2_FPN_1x | 16 | No | 59ms | 31.0 | [download](https://cloudstor. ...@@ -109,7 +121,8 @@ FCOS_bn_bs16_MNV2_FPN_1x | 16 | No | 59ms | 31.0 | [download](https://cloudstor.
[1] *1x and 2x mean the model is trained for 90K and 180K iterations, respectively.* \ [1] *1x and 2x mean the model is trained for 90K and 180K iterations, respectively.* \
[2] *All results are obtained with a single model and without any test time data augmentation such as multi-scale, flipping and etc..* \ [2] *All results are obtained with a single model and without any test time data augmentation such as multi-scale, flipping and etc..* \
[3] *`c128` denotes the model has 128 (instead of 256) channels in towers (i.e., `MODEL.RESNETS.BACKBONE_OUT_CHANNELS` in [config](https://github.com/tianzhi0549/FCOS/blob/master/configs/fcos/fcos_syncbn_bs32_c128_MNV2_FPN_1x.yaml#L10)).* \ [3] *`c128` denotes the model has 128 (instead of 256) channels in towers (i.e., `MODEL.RESNETS.BACKBONE_OUT_CHANNELS` in [config](https://github.com/tianzhi0549/FCOS/blob/master/configs/fcos/fcos_syncbn_bs32_c128_MNV2_FPN_1x.yaml#L10)).* \
[4] *The model `FCOS_imprv_dcnv2_X_101_64x4d_FPN_2x` with multi-scale testing achieves 49.0% in AP on COCO test-dev.* Please use `TEST.BBOX_AUG.ENABLED True` to enable multi-scale testing. [4] *The model `FCOS_imprv_dcnv2_X_101_64x4d_FPN_2x` with multi-scale testing achieves 49.0% in AP on COCO test-dev.* Please use `TEST.BBOX_AUG.ENABLED True` to enable multi-scale testing.
## Training ## Training
The following command line will train FCOS_imprv_R_50_FPN_1x on 8 GPUs with Synchronous Stochastic Gradient Descent (SGD): The following command line will train FCOS_imprv_R_50_FPN_1x on 8 GPUs with Synchronous Stochastic Gradient Descent (SGD):
...@@ -126,11 +139,10 @@ Note that: ...@@ -126,11 +139,10 @@ Note that:
1) If you want to use fewer GPUs, please change `--nproc_per_node` to the number of GPUs. No other settings need to be changed. 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](configs/fcos/fcos_R_50_FPN_1x.yaml). 1) If you want to use fewer GPUs, please change `--nproc_per_node` to the number of GPUs. No other settings need to be changed. 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](configs/fcos/fcos_R_50_FPN_1x.yaml).
2) The models will be saved into `OUTPUT_DIR`. 2) The models will be saved into `OUTPUT_DIR`.
3) If you want to train FCOS with other backbones, please change `--config-file`. 3) If you want to train FCOS with other backbones, please change `--config-file`.
4) The link of ImageNet pre-training X-101-64x4d in the code is invalid. Please download the model [here](https://cloudstor.aarnet.edu.au/plus/s/k3ys35075jmU1RP/download). 4) If you want to train FCOS on your own dataset, please follow this instruction [#54](https://github.com/tianzhi0549/FCOS/issues/54#issuecomment-497558687).
5) If you want to train FCOS on your own dataset, please follow this instruction [#54](https://github.com/tianzhi0549/FCOS/issues/54#issuecomment-497558687). 5) Now, training with 8 GPUs and 4 GPUs can have the same performance. Previous performance gap was because we did not synchronize `num_pos` between GPUs when computing loss.
6) Now, training with 8 GPUs and 4 GPUs can have the same performance. Previous performance gap was because we did not synchronize `num_pos` between GPUs when computing loss.
## Contributing to the project
## Contributing to the project
Any pull requests or issues are welcome. Any pull requests or issues are welcome.
## Citations ## Citations
......
...@@ -12,13 +12,13 @@ def main(): ...@@ -12,13 +12,13 @@ def main():
parser = argparse.ArgumentParser(description="PyTorch Object Detection Webcam Demo") parser = argparse.ArgumentParser(description="PyTorch Object Detection Webcam Demo")
parser.add_argument( parser.add_argument(
"--config-file", "--config-file",
default="configs/fcos/fcos_R_50_FPN_1x.yaml", default="configs/fcos/fcos_imprv_R_50_FPN_1x.yaml",
metavar="FILE", metavar="FILE",
help="path to config file", help="path to config file",
) )
parser.add_argument( parser.add_argument(
"--weights", "--weights",
default="FCOS_R_50_FPN_1x.pth", default="FCOS_imprv_R_50_FPN_1x.pth",
metavar="FILE", metavar="FILE",
help="path to the trained model", help="path to the trained model",
) )
...@@ -55,33 +55,33 @@ def main(): ...@@ -55,33 +55,33 @@ def main():
# per-class f-measure in their precision-recall curve. # per-class f-measure in their precision-recall curve.
# Please see compute_thresholds_for_classes() in coco_eval.py for details. # Please see compute_thresholds_for_classes() in coco_eval.py for details.
thresholds_for_classes = [ thresholds_for_classes = [
0.49211737513542175, 0.49340692162513733, 0.510103702545166, 0.4923645853996277, 0.4928510785102844, 0.5040897727012634,
0.4707475006580353, 0.5197340250015259, 0.5007652044296265, 0.4912887513637543, 0.5016880631446838, 0.5278812646865845,
0.5611110329627991, 0.4639902412891388, 0.4778415560722351, 0.5351834893226624, 0.5003424882888794, 0.4955945909023285,
0.43332818150520325, 0.6180170178413391, 0.5248752236366272, 0.43564629554748535, 0.6089804172515869, 0.666087806224823,
0.5437473654747009, 0.5153843760490417, 0.4194680452346802, 0.5932040214538574, 0.48406165838241577, 0.4062422513961792,
0.5640717148780823, 0.5087228417396545, 0.5021755695343018, 0.5571075081825256, 0.5671307444572449, 0.5268378257751465,
0.5307778716087341, 0.4920770823955536, 0.5202335119247437, 0.5112953186035156, 0.4647842049598694, 0.5324517488479614,
0.5715234279632568, 0.5089765191078186, 0.5422378778457642, 0.5795850157737732, 0.5152440071105957, 0.5280804634094238,
0.45138806104660034, 0.49631351232528687, 0.4388565421104431, 0.4791383445262909, 0.5261335372924805, 0.4906163215637207,
0.47193753719329834, 0.47037890553474426, 0.4791252017021179, 0.523737907409668, 0.47027698159217834, 0.5103300213813782,
0.45699411630630493, 0.48658522963523865, 0.4580649137496948, 0.4645252823829651, 0.5384289026260376, 0.47796186804771423,
0.4603237509727478, 0.5243804454803467, 0.5235602855682373, 0.4403403103351593, 0.5101461410522461, 0.5535093545913696,
0.48501554131507874, 0.5173789858818054, 0.4978085160255432, 0.48472103476524353, 0.5006796717643738, 0.5485560894012451,
0.4626562297344208, 0.48144686222076416, 0.4889853894710541, 0.4863888621330261, 0.5061569809913635, 0.5235867500305176,
0.4749937951564789, 0.42273756861686707, 0.47836390137672424, 0.4745445251464844, 0.4652363359928131, 0.4162440598011017,
0.48752328753471375, 0.44069987535476685, 0.4241463541984558, 0.5252017974853516, 0.42710989713668823, 0.4550687372684479,
0.5228247046470642, 0.4834112524986267, 0.4538525640964508, 0.4943239390850067, 0.4810051918029785, 0.47629663348197937,
0.4730372428894043, 0.471712201833725, 0.5180512070655823, 0.46629616618156433, 0.4662836790084839, 0.4854755401611328,
0.4671719968318939, 0.46602892875671387, 0.47536996006965637, 0.4156557023525238, 0.4763634502887726, 0.4724511504173279,
0.487352192401886, 0.4771934747695923, 0.45533207058906555, 0.4915047585964203, 0.5006274580955505, 0.5124194622039795,
0.43941256403923035, 0.5910647511482239, 0.554875910282135, 0.47004589438438416, 0.5374764204025269, 0.5876904129981995,
0.49752360582351685, 0.6263655424118042, 0.4964958727359772, 0.49395060539245605, 0.5102297067642212, 0.46571290493011475,
0.5542593002319336, 0.5049241185188293, 0.5306999087333679, 0.5164387822151184, 0.540651798248291, 0.5323763489723206,
0.5279538035392761, 0.5708096623420715, 0.524990975856781, 0.5048757195472717, 0.5302401781082153, 0.48333442211151123,
0.5187852382659912, 0.41242220997810364, 0.5409807562828064, 0.5109739303588867, 0.4077408015727997, 0.5764586925506592,
0.48504579067230225, 0.47305455803871155, 0.4814004898071289, 0.5109297037124634, 0.4685552418231964, 0.5148998498916626,
0.42680642008781433, 0.4143834114074707 0.4224434792995453, 0.4998510777950287
] ]
demo_im_names = os.listdir(args.images_dir) demo_im_names = os.listdir(args.images_dir)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册