-
Notifications
You must be signed in to change notification settings - Fork 9.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement FCOS training tricks #2935
Conversation
Train FCOS with four tricks (including center_sampling) arrording to official repo (https://github.com/tianzhi0549/FCOS). without DCN: mAP=38.6 (0.1 lower than official repo) with DCN : mAP=42.5 (0.2 higher than official repo)
configs/fcos/fcos_center-normbbox-centeronreg-giou_r50_caffe_fpn_gn-head_4x4_1x_coco.py
Outdated
Show resolved
Hide resolved
configs/fcos/fcos_center-normbbox-centeronreg-giou_r50_caffe_fpn_gn-head_4x4_1x_coco.py
Outdated
Show resolved
Hide resolved
norm_cfg=self.norm_cfg, | ||
bias=self.norm_cfg is None)) | ||
bias=True)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Originally most of the time bias
will be False since FCOS uses GN
in the head. Could I ask if bias
has a great effect on the performance?
Thanks for your contribution, please check the comments! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also load the original checkpoint to see if it is compatible.
configs/fcos/fcos_center-normbbox-centeronreg-giou_r50_caffe_fpn_gn-head_4x4_1x_coco.py
Outdated
Show resolved
Hide resolved
configs/fcos/fcos_center-normbbox-centeronreg-giou_r50_caffe_fpn_gn-head_dcn_4x4_1x_coco.py
Outdated
Show resolved
Hide resolved
norm_cfg=self.norm_cfg, | ||
bias=self.norm_cfg is None)) | ||
bias=True)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is bias=True used in the original implementation? Actually, using bias before a normalization layer is not so standard, it's better to enable users to specify it.
Hi @yhcao6 and @Johnson-Wang , thanks for your comments! The origin setting and implementation of FCOS in mmdetection are slightly different from official repo. For example, the author set I implement and train this model by following the author, which may lead to differences from the previous implementation in mmdetection. I suggest to keep the |
Please check your ci test. |
cls_scores = [] | ||
bbox_preds = [] | ||
centernesses = [] | ||
for i, x in enumerate(feats): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since there is no special operation on a specific fpn layer, is it possible to revert to forward_single
implementation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Except that there would be another argument (stride) to be passed to forward_single
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea! Already updated in the latest commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main implementation seems fine to me now. There is another work to do here. The unittest of fcos head was missing. It would be better to add unittest gradually in the future. Could you please add the unittest of fcos? (Special attention should be paid to corner cases such as bbox_ignore, empty gt_bbox et al. )
Get mAP=39.9 without using DCN in backbone. |
Amazing. Thanks a lot. |
# random inputs | ||
gt_bboxes = [ | ||
torch.Tensor([[23.6667, 23.8757, 238.6326, 151.8874]]), | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it support gt_bboxes_ignore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unit test doesn't include gt_bboxes_ignore test, since the implemenration of FCOS doesn't support gt_bboxes_ignore (passed as argument but not actually used).
Still, please have a check on the ci. |
@@ -80,26 +126,31 @@ def _init_layers(self): | |||
self.reg_convs = nn.ModuleList() | |||
for i in range(self.stacked_convs): | |||
chn = self.in_channels if i == 0 else self.feat_channels | |||
if self.dcn_on_last_conv and \ | |||
i == self.stacked_convs - 1: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use parentheses instead of backslashes.
if (self.dcn_on_last_conv and i == self.stacked_convs - 1)
and let yapf to format it.
centerness_on_reg (bool): If true, position centerness on the | ||
regress branch. Please refer to https://github.com/tianzhi0549/FCOS/issues/89#issuecomment-516877042. | ||
dcn_on_last_conv (bool): If true, use dcn in the last layer of | ||
towers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default values of several arguments are not described.
Hi @hellock , thanks for the comments! |
* 123 * implement FCOS with tricks (FCOS_plus) Train FCOS with four tricks (including center_sampling) arrording to official repo (https://github.com/tianzhi0549/FCOS). without DCN: mAP=38.6 (0.1 lower than official repo) with DCN : mAP=42.5 (0.2 higher than official repo) * fix * fix * reformatted * fix configs & reformat * add docstring * Update fcos_center-normbbox-centeronreg-giou_r50_caffe_fpn_gn-head_dcn_4x4_1x_coco.py * add noqa: E501 since the url is too long * fix flake * fix flake * fix yapf * fix * rewrite forward & reformat * reformat & add docstring * reformat * reformat * update docstring * TODO: add unit test Should be finished tomorrow * add unit test * fix * fix docstring * reformat * add docstring * reformat * Update fcos_head.py * Update fcos_head.py * Update fcos_head.py * Update fcos_head.py * Update fcos_head.py * Update test_heads.py * Update fcos_head.py * Update README.md
Hello, |
Co-authored-by: Tony Hu <tonyhu@amazon.com>
Implement another three training tricks (except for center_sampling) used in the official repo (https://github.com/tianzhi0549/FCOS). By jointly using them, mAP gains of up to 4.9 (with DCN) and 1.3 (without DCN) will be brought.
In this implementation, the following results are achieved:
without DCN: mAP=38.6 (0.1 lower than the official repo)
with DCN: mAP=42.5 (0.2 higher than the official repo)