tianzhi0549 / FCOS

FCOS: Fully Convolutional One-Stage Object Detection (ICCV'19)
https://arxiv.org/abs/1904.01355
Other
3.28k stars 630 forks source link

More pre-trained models for testing-only #151

Closed leesunfreshing closed 5 years ago

leesunfreshing commented 5 years ago

Hi, I understand only 'fcos_R_50_FPN_1x' and 'fcos_syncbn_bs32_c128_MNV2_FPN_1x' are available for testing-only version. Could you also provide other models as well? I have attempted to download the 'FCOS_imprv_dcnv2_X_101_32x8d_FPN_2x' model and merge it to focs.py, howeve r error occurs as following. So I guess more modifications are required?

Downloading: "https://cloudstor.aarnet.edu.au/plus/s/jdtVmG7MlugEXB7/download" to /home/lyk/.torch/models/download 100%|██████████| 391092279/391092279 [00:44<00:00, 8728700.35it/s] Traceback (most recent call last): File "/home/lyk/Downloads/pycharm-community-2019.2/helpers/pydev/pydevd.py", line 2060, in main() File "/home/lyk/Downloads/pycharm-community-2019.2/helpers/pydev/pydevd.py", line 2054, in main globals = debugger.run(setup['file'], None, None, is_module) File "/home/lyk/Downloads/pycharm-community-2019.2/helpers/pydev/pydevd.py", line 1405, in run return self._exec(is_module, entry_point_fn, module_name, file, globals, locals) File "/home/lyk/Downloads/pycharm-community-2019.2/helpers/pydev/pydevd.py", line 1412, in _exec pydev_imports.execfile(file, globals, locals) # execute the script File "/home/lyk/Downloads/pycharm-community-2019.2/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "/home/lyk/Documents/Experiments/GNN/bbx.py", line 35, in cpu_only=not torch.cuda.is_available() # if you do not have GPUs, please set cpuonly as True File "/usr/local/lib/python3.6/dist-packages/fcos/fcos.py", line 196, in init = checkpointer.load(cfg.MODEL.WEIGHT) File "/usr/local/lib/python3.6/dist-packages/fcos_core/utils/checkpoint.py", line 62, in load self._load_model(checkpoint) File "/usr/local/lib/python3.6/dist-packages/fcos_core/utils/checkpoint.py", line 98, in _load_model load_state_dict(self.model, checkpoint.pop("model")) File "/usr/local/lib/python3.6/dist-packages/fcos_core/utils/model_serialization.py", line 80, in load_state_dict model.load_state_dict(model_state_dict) File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 777, in load_state_dict self.class.name, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for GeneralizedRCNN: size mismatch for backbone.fpn.fpn_inner2.weight: copying a param with shape torch.Size([256, 512, 1, 1]) from checkpoint, the shape in current model is torch.Size([128, 32, 1, 1]). size mismatch for backbone.fpn.fpn_inner2.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for backbone.fpn.fpn_layer2.weight: copying a param with shape torch.Size([256, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([128, 128, 3, 3]). size mismatch for backbone.fpn.fpn_layer2.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for backbone.fpn.fpn_inner3.weight: copying a param with shape torch.Size([256, 1024, 1, 1]) from checkpoint, the shape in current model is torch.Size([128, 96, 1, 1]). size mismatch for backbone.fpn.fpn_inner3.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for backbone.fpn.fpn_layer3.weight: copying a param with shape torch.Size([256, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([128, 128, 3, 3]). size mismatch for backbone.fpn.fpn_layer3.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for backbone.fpn.fpn_inner4.weight: copying a param with shape torch.Size([256, 2048, 1, 1]) from checkpoint, the shape in current model is torch.Size([128, 320, 1, 1]). size mismatch for backbone.fpn.fpn_inner4.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for backbone.fpn.fpn_layer4.weight: copying a param with shape torch.Size([256, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([128, 128, 3, 3]). size mismatch for backbone.fpn.fpn_layer4.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for backbone.fpn.top_blocks.p6.weight: copying a param with shape torch.Size([256, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([128, 128, 3, 3]). size mismatch for backbone.fpn.top_blocks.p6.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for backbone.fpn.top_blocks.p7.weight: copying a param with shape torch.Size([256, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([128, 128, 3, 3]). size mismatch for backbone.fpn.top_blocks.p7.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for rpn.head.cls_tower.0.weight: copying a param with shape torch.Size([256, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([128, 128, 3, 3]). size mismatch for rpn.head.cls_tower.0.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for rpn.head.cls_tower.1.weight: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for rpn.head.cls_tower.1.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for rpn.head.cls_tower.3.weight: copying a param with shape torch.Size([256, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([128, 128, 3, 3]). size mismatch for rpn.head.cls_tower.3.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for rpn.head.cls_tower.4.weight: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for rpn.head.cls_tower.4.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for rpn.head.cls_tower.6.weight: copying a param with shape torch.Size([256, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([128, 128, 3, 3]). size mismatch for rpn.head.cls_tower.6.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for rpn.head.cls_tower.7.weight: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for rpn.head.cls_tower.7.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for rpn.head.cls_tower.10.weight: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for rpn.head.cls_tower.10.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for rpn.head.bbox_tower.0.weight: copying a param with shape torch.Size([256, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([128, 128, 3, 3]). size mismatch for rpn.head.bbox_tower.0.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for rpn.head.bbox_tower.1.weight: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for rpn.head.bbox_tower.1.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for rpn.head.bbox_tower.3.weight: copying a param with shape torch.Size([256, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([128, 128, 3, 3]). size mismatch for rpn.head.bbox_tower.3.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for rpn.head.bbox_tower.4.weight: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for rpn.head.bbox_tower.4.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for rpn.head.bbox_tower.6.weight: copying a param with shape torch.Size([256, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([128, 128, 3, 3]). size mismatch for rpn.head.bbox_tower.6.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for rpn.head.bbox_tower.7.weight: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for rpn.head.bbox_tower.7.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for rpn.head.bbox_tower.10.weight: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for rpn.head.bbox_tower.10.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for rpn.head.cls_logits.weight: copying a param with shape torch.Size([80, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([80, 128, 3, 3]). size mismatch for rpn.head.bbox_pred.weight: copying a param with shape torch.Size([4, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([4, 128, 3, 3]). size mismatch for rpn.head.centerness.weight: copying a param with shape torch.Size([1, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([1, 128, 3, 3]).

tianzhi0549 commented 5 years ago

@leesunfreshing you can add other models by adding items to https://github.com/tianzhi0549/FCOS/blob/c73a58140d1e11e23fd4c3a762d036874cd6bbe3/fcos/fcos.py#L11.

leesunfreshing commented 5 years ago

It is what I have done. However the error feedback was to ask for either "best_min_confidence" or config files. When I had the downloaded .yaml file for FCOS_imprv_dcnv2_X_101_32x8d_FPN_2x, it cannot be imported for some reason... Moreover, it seems only the original files placed in /configs folder are available for use (which exclude all the imprv models anyway), still the best_min_confidence is missing...

leesunfreshing commented 5 years ago

The log is as follows:

Traceback (most recent call last): File "/home/lyk/Downloads/pycharm-community-2019.2/helpers/pydev/pydevd.py", line 2060, in main() File "/home/lyk/Downloads/pycharm-community-2019.2/helpers/pydev/pydevd.py", line 2054, in main globals = debugger.run(setup['file'], None, None, is_module) File "/home/lyk/Downloads/pycharm-community-2019.2/helpers/pydev/pydevd.py", line 1405, in run return self._exec(is_module, entry_point_fn, module_name, file, globals, locals) File "/home/lyk/Downloads/pycharm-community-2019.2/helpers/pydev/pydevd.py", line 1412, in _exec pydev_imports.execfile(file, globals, locals) # execute the script File "/home/lyk/Downloads/pycharm-community-2019.2/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "/home/lyk/Documents/Experiments/GNN/bbx.py", line 35, in cpu_only=not torch.cuda.is_available() # if you do not have GPUs, please set cpu_only as True File "/usr/local/lib/python3.6/dist-packages/fcos/fcos.py", line 271, in init cfg.merge_from_file(os.path.join(self.config_files_dir, self.cfg_name)) File "/home/lyk/.local/lib/python3.6/site-packages/yacs/config.py", line 213, in merge_from_file self.merge_from_other_cfg(cfg) File "/home/lyk/.local/lib/python3.6/site-packages/yacs/config.py", line 217, in merge_from_other_cfg _merge_a_into_b(cfg_other, self, self, []) File "/home/lyk/.local/lib/python3.6/site-packages/yacs/config.py", line 460, in _merge_a_into_b _merge_a_into_b(v, b[k], root, key_list + [k]) File "/home/lyk/.local/lib/python3.6/site-packages/yacs/config.py", line 460, in _merge_a_into_b _merge_a_into_b(v, b[k], root, key_list + [k]) File "/home/lyk/.local/lib/python3.6/site-packages/yacs/config.py", line 473, in _merge_a_into_b raise KeyError("Non-existent config key: {}".format(full_key)) KeyError: 'Non-existent config key: MODEL.RESNETS.STAGE_WITH_DCN'

tianzhi0549 commented 5 years ago

@leesunfreshing sorry, the package on pip is a little out-of-date. Could you please install the version in this repositories?

tianzhi0549 commented 5 years ago

@leesunfreshing you can use pip install git+https://github.com/tianzhi0549/FCOS.git.

leesunfreshing commented 5 years ago

Could you also provide the corresponding best_min_confidence as well? Seemingly not having it would somehow effect the performance... Thanks

tianzhi0549 commented 5 years ago

@leesunfreshing these thresholds are not sensitive. Please use the ones for ResNet-50.

leesunfreshing commented 5 years ago

It works now. Appreciate your help