Skip to content

Commit

Permalink
Remove useless files
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasehuang committed Aug 3, 2023
1 parent 06e94fd commit 8ac553a
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 145 deletions.
7 changes: 2 additions & 5 deletions mmdet/models/backbones/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (c) OpenMMLab. All rights reserved.
from .convnext import ConvNeXt, ConvNeXtFlow
from .convnext import ConvNeXt
from .csp_darknet import CSPDarknet
from .darknet import Darknet
from .detectors_resnet import DetectoRS_ResNet
Expand All @@ -13,18 +13,15 @@
from .res2net import Res2Net
from .resnest import ResNeSt
from .resnet import ResNet, ResNetV1d
from .resnet_flow import ResNetFlow
from .resnext import ResNeXt
from .ssd_vgg import SSDVGG
from .swin import SwinTransformer
from .swin_flow import SwinTransformerFlow
from .trident_resnet import TridentResNet

__all__ = [
'RegNet', 'ResNet', 'ResNetV1d', 'ResNeXt', 'SSDVGG', 'HRNet',
'MobileNetV2', 'Res2Net', 'HourglassNet', 'DetectoRS_ResNet',
'DetectoRS_ResNeXt', 'Darknet', 'ResNeSt', 'TridentResNet', 'CSPDarknet',
'SwinTransformer', 'PyramidVisionTransformer',
'SwinTransformer', 'PyramidVisionTransformer', "ConvNeXt",
'PyramidVisionTransformerV2', 'EfficientNet',
'ResNetFlow', 'SwinTransformerFlow', 'ConvNeXt', 'ConvNeXtFlow',
]
40 changes: 0 additions & 40 deletions mmdet/models/backbones/convnext.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,43 +322,3 @@ def _freeze_stages(self):
def train(self, mode=True):
super(ConvNeXt, self).train(mode)
self._freeze_stages()


@BACKBONES.register_module()
class ConvNeXtFlow(ConvNeXt):
"""ConvNeXtFlow backbone."""

def __init__(self, extra_freeze=None, **kwargs):
self.extra_freeze = extra_freeze
super(ConvNeXtFlow, self).__init__(**kwargs)

def _freeze_stages(self):
super()._freeze_stages()
if self.extra_freeze is not None:
for i in self.extra_freeze:
downsample_layer = self.downsample_layers[i]
stage = self.stages[i]
downsample_layer.eval()
stage.eval()
for param in chain(downsample_layer.parameters(),
stage.parameters()):
param.requires_grad = False

def forward(self, x):
outs = []
for i, stage in enumerate(self.stages):
if i not in self.out_indices:
break
x = self.downsample_layers[i](x)
x = stage(x)
if i in self.out_indices:
norm_layer = getattr(self, f'norm{i}')
if self.gap_before_final_norm:
gap = x.mean([-2, -1], keepdim=True)
outs.append(norm_layer(gap).flatten(1))
else:
# The output of LayerNorm2d may be discontiguous, which
# may cause some problem in the downstream tasks
outs.append(norm_layer(x).contiguous())

return tuple(outs)
50 changes: 0 additions & 50 deletions mmdet/models/backbones/resnet_flow.py

This file was deleted.

50 changes: 0 additions & 50 deletions mmdet/models/backbones/swin_flow.py

This file was deleted.

0 comments on commit 8ac553a

Please sign in to comment.