Unverified Commit b87e774f authored by lizz's avatar lizz Committed by GitHub
Browse files

Remove more unused things (#338)



* Remove more unused things
Signed-off-by: default avatarlizz <lizz@sensetime.com>

* panic
Signed-off-by: default avatarlizz <lizz@sensetime.com>
parent 5a98f7e4
...@@ -32,6 +32,7 @@ class BasicBlock(nn.Module): ...@@ -32,6 +32,7 @@ class BasicBlock(nn.Module):
style='pytorch', style='pytorch',
with_cp=False): with_cp=False):
super(BasicBlock, self).__init__() super(BasicBlock, self).__init__()
assert style in ['pytorch', 'caffe']
self.conv1 = conv3x3(inplanes, planes, stride, dilation) self.conv1 = conv3x3(inplanes, planes, stride, dilation)
self.bn1 = nn.BatchNorm2d(planes) self.bn1 = nn.BatchNorm2d(planes)
self.relu = nn.ReLU(inplace=True) self.relu = nn.ReLU(inplace=True)
...@@ -171,7 +172,7 @@ def make_res_layer(block, ...@@ -171,7 +172,7 @@ def make_res_layer(block,
style=style, style=style,
with_cp=with_cp)) with_cp=with_cp))
inplanes = planes * block.expansion inplanes = planes * block.expansion
for i in range(1, blocks): for _ in range(1, blocks):
layers.append( layers.append(
block(inplanes, planes, 1, dilation, style=style, with_cp=with_cp)) block(inplanes, planes, 1, dilation, style=style, with_cp=with_cp))
......
...@@ -141,7 +141,7 @@ class VGG(nn.Module): ...@@ -141,7 +141,7 @@ class VGG(nn.Module):
def forward(self, x): def forward(self, x):
outs = [] outs = []
vgg_layers = getattr(self, self.module_name) vgg_layers = getattr(self, self.module_name)
for i, num_blocks in enumerate(self.stage_blocks): for i in range(len(self.stage_blocks)):
for j in range(*self.range_sub_modules[i]): for j in range(*self.range_sub_modules[i]):
vgg_layer = vgg_layers[j] vgg_layer = vgg_layers[j]
x = vgg_layer(x) x = vgg_layer(x)
......
...@@ -33,7 +33,7 @@ def _init_dist_mpi(backend, **kwargs): ...@@ -33,7 +33,7 @@ def _init_dist_mpi(backend, **kwargs):
raise NotImplementedError raise NotImplementedError
def _init_dist_slurm(backend, port=29500, **kwargs): def _init_dist_slurm(backend, port=29500):
proc_id = int(os.environ['SLURM_PROCID']) proc_id = int(os.environ['SLURM_PROCID'])
ntasks = int(os.environ['SLURM_NTASKS']) ntasks = int(os.environ['SLURM_NTASKS'])
node_list = os.environ['SLURM_NODELIST'] node_list = os.environ['SLURM_NODELIST']
......
...@@ -8,8 +8,7 @@ class MomentumUpdaterHook(Hook): ...@@ -8,8 +8,7 @@ class MomentumUpdaterHook(Hook):
by_epoch=True, by_epoch=True,
warmup=None, warmup=None,
warmup_iters=0, warmup_iters=0,
warmup_ratio=0.9, warmup_ratio=0.9):
**kwargs):
# validate the "warmup" argument # validate the "warmup" argument
if warmup is not None: if warmup is not None:
if warmup not in ['constant', 'linear', 'exp']: if warmup not in ['constant', 'linear', 'exp']:
......
...@@ -175,7 +175,7 @@ def track_parallel_progress(func, ...@@ -175,7 +175,7 @@ def track_parallel_progress(func,
return results return results
def track_iter_progress(tasks, bar_width=50, file=sys.stdout, **kwargs): def track_iter_progress(tasks, bar_width=50, file=sys.stdout):
"""Track the progress of tasks iteration or enumeration with a progress bar. """Track the progress of tasks iteration or enumeration with a progress bar.
Tasks are yielded with a simple for-loop. Tasks are yielded with a simple for-loop.
......
...@@ -58,8 +58,7 @@ def resize_video(in_file, ...@@ -58,8 +58,7 @@ def resize_video(in_file,
ratio=None, ratio=None,
keep_ar=False, keep_ar=False,
log_level='info', log_level='info',
print_cmd=False, print_cmd=False):
**kwargs):
"""Resize a video. """Resize a video.
Args: Args:
...@@ -98,8 +97,7 @@ def cut_video(in_file, ...@@ -98,8 +97,7 @@ def cut_video(in_file,
vcodec=None, vcodec=None,
acodec=None, acodec=None,
log_level='info', log_level='info',
print_cmd=False, print_cmd=False):
**kwargs):
"""Cut a clip from a video. """Cut a clip from a video.
Args: Args:
...@@ -132,8 +130,7 @@ def concat_video(video_list, ...@@ -132,8 +130,7 @@ def concat_video(video_list,
vcodec=None, vcodec=None,
acodec=None, acodec=None,
log_level='info', log_level='info',
print_cmd=False, print_cmd=False):
**kwargs):
"""Concatenate multiple videos into a single one. """Concatenate multiple videos into a single one.
Args: Args:
......
...@@ -33,7 +33,8 @@ class TestVideoEditor: ...@@ -33,7 +33,8 @@ class TestVideoEditor:
def test_resize_video(self): def test_resize_video(self):
out_file = osp.join(tempfile.gettempdir(), '.mmcv_test.mp4') out_file = osp.join(tempfile.gettempdir(), '.mmcv_test.mp4')
mmcv.resize_video(self.video_path, out_file, (200, 100), quiet=True) mmcv.resize_video(
self.video_path, out_file, (200, 100), log_level='panic')
v = mmcv.VideoReader(out_file) v = mmcv.VideoReader(out_file)
assert v.resolution == (200, 100) assert v.resolution == (200, 100)
os.remove(out_file) os.remove(out_file)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment