-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[Refactor]: Unified parameter initialization #622
Merged
Merged
Changes from 55 commits
Commits
Show all changes
61 commits
Select commit
Hold shift + click to select a range
b896597
support 3dssd
xiliu8006 010024e
support one-stage method
xiliu8006 d52c837
for lint
xiliu8006 d317b7c
support two_stage
xiliu8006 d42898e
Merge branch 'master' into add_initializer
xiliu8006 be73dd2
Support all methods
xiliu8006 f1838d7
remove init_cfg=[] in configs
xiliu8006 e2c74a2
test
xiliu8006 1781db5
Merge branch 'master' into add_initializer
xiliu8006 a649d1a
support h3dnet
xiliu8006 487823d
fix lint error
xiliu8006 2fa3dd6
fix isort
xiliu8006 69c6ce6
fix code style error
xiliu8006 7ba358f
fix imvotenet bug
xiliu8006 9301014
fix configs conflict
xiliu8006 953a4b7
rename init_weight->init_weights
xiliu8006 b824fcb
clean comma
xiliu8006 30e8195
Merge branch 'master' into add_initializer
xiliu8006 613f503
fix test_apis does not init weights
xiliu8006 46afb23
Merge branch 'master' into add_initializer
xiliu8006 458ec22
support newest mmdet and mmcv
xiliu8006 e9f6630
fix test_heads h3dnet bug
xiliu8006 af9524f
rm *.swp
xiliu8006 87b04f6
remove the wrong code in build.yml
xiliu8006 3f99ed3
fix ssn low map
xiliu8006 94924ad
modify docs
xiliu8006 188da1e
modified ssn init_config
xiliu8006 33292c0
modify params in backbone pointnet2_sa_ssg
xiliu8006 2f5382c
fix segmentor build
xiliu8006 455d2de
add ssn direction init_cfg
xiliu8006 d443ad4
support segmentor
xiliu8006 7f391e1
fix conflict
xiliu8006 6f926d7
add conv a=sqrt(5)
xiliu8006 3fad6aa
Merge branch 'add_initializer' of https://github.com/xiliu8006/mmdete…
xiliu8006 15d9188
Convmodule uses kaiming_init
xiliu8006 1eb9274
fix centerpointhead init bug
xiliu8006 a0eecb9
add second conv2d init cfg
xiliu8006 dc3f2fb
add unittest to confirm the input is not be modified
xiliu8006 6439d61
assert gt_bboxes_3d
xiliu8006 20dfaba
add compatibility
xiliu8006 4a5857c
rm .swag
xiliu8006 ff56ae9
modify docs mmdet version
xiliu8006 8830d63
Merge branch 'master' into add_initializer
xiliu8006 1082498
Merge branch 'bg_filter_unittest' into add_initializer
xiliu8006 d91e120
adopt fcosmono3d
xiliu8006 ca6e908
add fcos 3d original init method
xiliu8006 68eec71
fix mmseg version
xiliu8006 37f4aee
add init cfg in fcos_mono3d.py
xiliu8006 e2dc867
merge newest master
xiliu8006 17c2485
merge newest master
xiliu8006 d24204e
remove unused code
xiliu8006 b5f2da2
modify focs config due to changes of resnet
xiliu8006 0e43d8d
support imvoxelnet pointnet2
xiliu8006 19c2ef3
modified the dependencies version
xiliu8006 245aea0
support decode head
xiliu8006 85a2fbe
fix inference bug
xiliu8006 8315abe
modify the useless init_cfg
xiliu8006 e9aaeec
merge newest master
xiliu8006 6156cf9
fix multi_modality BC-breaking
xiliu8006 2d3a88b
fix error blank
xiliu8006 e142171
modify docs error
xiliu8006 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
import warnings | ||
from mmcv.cnn import build_conv_layer, build_norm_layer | ||
from mmcv.runner import load_checkpoint | ||
from mmcv.runner import BaseModule | ||
from torch import nn as nn | ||
|
||
from mmdet.models import BACKBONES | ||
|
||
|
||
@BACKBONES.register_module() | ||
class SECOND(nn.Module): | ||
class SECOND(BaseModule): | ||
"""Backbone network for SECOND/PointPillars/PartA2/MVXNet. | ||
|
||
Args: | ||
|
@@ -24,8 +25,10 @@ def __init__(self, | |
layer_nums=[3, 5, 5], | ||
layer_strides=[2, 2, 2], | ||
norm_cfg=dict(type='BN', eps=1e-3, momentum=0.01), | ||
conv_cfg=dict(type='Conv2d', bias=False)): | ||
super(SECOND, self).__init__() | ||
conv_cfg=dict(type='Conv2d', bias=False), | ||
init_cfg=None, | ||
pretrained=None): | ||
super(SECOND, self).__init__(init_cfg=init_cfg) | ||
assert len(layer_strides) == len(layer_nums) | ||
assert len(out_channels) == len(layer_nums) | ||
|
||
|
@@ -61,14 +64,14 @@ def __init__(self, | |
|
||
self.blocks = nn.ModuleList(blocks) | ||
|
||
def init_weights(self, pretrained=None): | ||
"""Initialize weights of the 2D backbone.""" | ||
# Do not initialize the conv layers | ||
# to follow the original implementation | ||
assert not (init_cfg and pretrained), \ | ||
'init_cfg and pretrained cannot be setting at the same time' | ||
if isinstance(pretrained, str): | ||
from mmdet3d.utils import get_root_logger | ||
logger = get_root_logger() | ||
load_checkpoint(self, pretrained, strict=False, logger=logger) | ||
warnings.warn('DeprecationWarning: pretrained is a deprecated, ' | ||
'please use "init_cfg" instead') | ||
self.init_cfg = dict(type='Pretrained', checkpoint=pretrained) | ||
else: | ||
self.init_cfg = dict(type='Kaiming', layer='Conv2d') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. According to L66-67, why use Kaiming init here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if we dont use the pretrained model, we want to use kaiming_init to init all Conv2d layer. |
||
|
||
def forward(self, x): | ||
"""Forward function. | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
change #378 to #622