mirror of
https://github.com/open-mmlab/mmcv.git
synced 2025-06-03 21:54:52 +08:00
fix the code style of yapf 0.29 (#150)
* fix the code style of yapf 0.29 * fix flake8
This commit is contained in:
parent
56971278db
commit
0eef3757e8
@ -153,8 +153,8 @@ def imcrop(img, bboxes, scale=1.0, pad_fill=None):
|
||||
y_start = 0 if _y1 >= 0 else -_y1
|
||||
w = x2 - x1 + 1
|
||||
h = y2 - y1 + 1
|
||||
patch[y_start:y_start + h, x_start:x_start +
|
||||
w, ...] = img[y1:y1 + h, x1:x1 + w, ...]
|
||||
patch[y_start:y_start + h, x_start:x_start + w,
|
||||
...] = img[y1:y1 + h, x1:x1 + w, ...]
|
||||
patches.append(patch)
|
||||
|
||||
if bboxes.ndim == 1:
|
||||
|
@ -9,7 +9,10 @@ from .scatter_gather import scatter_kwargs
|
||||
|
||||
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):
|
||||
super(MMDistributedDataParallel, self).__init__()
|
||||
self.module = module
|
||||
|
@ -296,7 +296,9 @@ class Runner(object):
|
||||
|
||||
self.call_hook('after_val_epoch')
|
||||
|
||||
def resume(self, checkpoint, resume_optimizer=True,
|
||||
def resume(self,
|
||||
checkpoint,
|
||||
resume_optimizer=True,
|
||||
map_location='default'):
|
||||
if map_location == 'default':
|
||||
device_id = torch.cuda.current_device()
|
||||
|
@ -140,7 +140,7 @@ def check_prerequisites(
|
||||
prerequisites,
|
||||
checker,
|
||||
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.
|
||||
|
||||
Args:
|
||||
|
@ -7,7 +7,10 @@ from mmcv.utils import requires_executable
|
||||
|
||||
|
||||
@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):
|
||||
"""Convert a video with ffmpeg.
|
||||
|
||||
|
@ -119,10 +119,10 @@ def test_dequantize_flow():
|
||||
ref = np.zeros_like(flow, dtype=np.float32)
|
||||
for i in range(ref.shape[0]):
|
||||
for j in range(ref.shape[1]):
|
||||
ref[i, j, 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 -
|
||||
max_val) * h
|
||||
ref[i, j,
|
||||
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 - max_val) * h
|
||||
assert_array_almost_equal(flow, ref)
|
||||
|
||||
|
||||
@ -156,8 +156,8 @@ def test_flow_warp():
|
||||
sy = np.floor(dy).astype(int)
|
||||
valid = (sx >= 0) & (sx < height - 1) & (sy >= 0) & (sy < width - 1)
|
||||
|
||||
output[valid, :] = img[dx[valid].round().astype(int), dy[valid].round(
|
||||
).astype(int), :]
|
||||
output[valid, :] = img[dx[valid].round().astype(int),
|
||||
dy[valid].round().astype(int), :]
|
||||
|
||||
return output
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user