-
Notifications
You must be signed in to change notification settings - Fork 431
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Refactor] Move res-layer to models.utils (#537)
* move reslayer to utils * update configs
- Loading branch information
1 parent
ed9d4a7
commit 560446a
Showing
6 changed files
with
47 additions
and
40 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright (c) OpenMMLab. All rights reserved. | ||
from mmcv.cnn import build_norm_layer | ||
from mmcv.runner import auto_fp16 | ||
|
||
try: | ||
from mmdet.models.backbones import ResNet | ||
from mmdet.models.builder import SHARED_HEADS | ||
from mmdet.models.roi_heads.shared_heads.res_layer import ResLayer | ||
|
||
@SHARED_HEADS.register_module() | ||
class ResLayerExtraNorm(ResLayer): | ||
|
||
def __init__(self, *args, **kwargs): | ||
super(ResLayerExtraNorm, self).__init__(*args, **kwargs) | ||
|
||
block = ResNet.arch_settings[kwargs['depth']][0] | ||
self.add_module( | ||
'norm', | ||
build_norm_layer(self.norm_cfg, | ||
64 * 2**self.stage * block.expansion)[1]) | ||
|
||
@auto_fp16() | ||
def forward(self, x): | ||
res_layer = getattr(self, f'layer{self.stage + 1}') | ||
norm = getattr(self, 'norm') | ||
x = res_layer(x) | ||
out = norm(x) | ||
return out | ||
|
||
except ImportError: | ||
pass |
This file was deleted.
Oops, something went wrong.