Unverified Commit 0eef3757 authored by Kai Chen's avatar Kai Chen Committed by GitHub
Browse files

fix the code style of yapf 0.29 (#150)

* fix the code style of yapf 0.29

* fix flake8
parent 56971278
...@@ -153,8 +153,8 @@ def imcrop(img, bboxes, scale=1.0, pad_fill=None): ...@@ -153,8 +153,8 @@ def imcrop(img, bboxes, scale=1.0, pad_fill=None):
y_start = 0 if _y1 >= 0 else -_y1 y_start = 0 if _y1 >= 0 else -_y1
w = x2 - x1 + 1 w = x2 - x1 + 1
h = y2 - y1 + 1 h = y2 - y1 + 1
patch[y_start:y_start + h, x_start:x_start + patch[y_start:y_start + h, x_start:x_start + w,
w, ...] = img[y1:y1 + h, x1:x1 + w, ...] ...] = img[y1:y1 + h, x1:x1 + w, ...]
patches.append(patch) patches.append(patch)
if bboxes.ndim == 1: if bboxes.ndim == 1:
......
...@@ -9,7 +9,10 @@ from .scatter_gather import scatter_kwargs ...@@ -9,7 +9,10 @@ from .scatter_gather import scatter_kwargs
class MMDistributedDataParallel(nn.Module): class MMDistributedDataParallel(nn.Module):
def __init__(self, module, dim=0, broadcast_buffers=True, def __init__(self,
module,
dim=0,
broadcast_buffers=True,
bucket_cap_mb=25): bucket_cap_mb=25):
super(MMDistributedDataParallel, self).__init__() super(MMDistributedDataParallel, self).__init__()
self.module = module self.module = module
......
...@@ -296,7 +296,9 @@ class Runner(object): ...@@ -296,7 +296,9 @@ class Runner(object):
self.call_hook('after_val_epoch') self.call_hook('after_val_epoch')
def resume(self, checkpoint, resume_optimizer=True, def resume(self,
checkpoint,
resume_optimizer=True,
map_location='default'): map_location='default'):
if map_location == 'default': if map_location == 'default':
device_id = torch.cuda.current_device() device_id = torch.cuda.current_device()
......
...@@ -140,7 +140,7 @@ def check_prerequisites( ...@@ -140,7 +140,7 @@ def check_prerequisites(
prerequisites, prerequisites,
checker, checker,
msg_tmpl='Prerequisites "{}" are required in method "{}" but not ' msg_tmpl='Prerequisites "{}" are required in method "{}" but not '
'found, please install them first.'): 'found, please install them first.'): # yapf: disable
"""A decorator factory to check if prerequisites are satisfied. """A decorator factory to check if prerequisites are satisfied.
Args: Args:
......
...@@ -7,7 +7,10 @@ from mmcv.utils import requires_executable ...@@ -7,7 +7,10 @@ from mmcv.utils import requires_executable
@requires_executable('ffmpeg') @requires_executable('ffmpeg')
def convert_video(in_file, out_file, print_cmd=False, pre_options='', def convert_video(in_file,
out_file,
print_cmd=False,
pre_options='',
**kwargs): **kwargs):
"""Convert a video with ffmpeg. """Convert a video with ffmpeg.
......
...@@ -119,10 +119,10 @@ def test_dequantize_flow(): ...@@ -119,10 +119,10 @@ def test_dequantize_flow():
ref = np.zeros_like(flow, dtype=np.float32) ref = np.zeros_like(flow, dtype=np.float32)
for i in range(ref.shape[0]): for i in range(ref.shape[0]):
for j in range(ref.shape[1]): for j in range(ref.shape[1]):
ref[i, j, 0] = (float(dx[i, j] + 0.5) * 2 * max_val / 255 - ref[i, j,
max_val) * w 0] = (float(dx[i, j] + 0.5) * 2 * max_val / 255 - max_val) * w
ref[i, j, 1] = (float(dy[i, j] + 0.5) * 2 * max_val / 255 - ref[i, j,
max_val) * h 1] = (float(dy[i, j] + 0.5) * 2 * max_val / 255 - max_val) * h
assert_array_almost_equal(flow, ref) assert_array_almost_equal(flow, ref)
...@@ -156,8 +156,8 @@ def test_flow_warp(): ...@@ -156,8 +156,8 @@ def test_flow_warp():
sy = np.floor(dy).astype(int) sy = np.floor(dy).astype(int)
valid = (sx >= 0) & (sx < height - 1) & (sy >= 0) & (sy < width - 1) valid = (sx >= 0) & (sx < height - 1) & (sy >= 0) & (sy < width - 1)
output[valid, :] = img[dx[valid].round().astype(int), dy[valid].round( output[valid, :] = img[dx[valid].round().astype(int),
).astype(int), :] dy[valid].round().astype(int), :]
return output return output
......
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