Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
MMCV
Commits
0eef3757
Unverified
Commit
0eef3757
authored
Dec 02, 2019
by
Kai Chen
Committed by
GitHub
Dec 02, 2019
Browse files
fix the code style of yapf 0.29 (#150)
* fix the code style of yapf 0.29 * fix flake8
parent
56971278
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
20 additions
and
12 deletions
+20
-12
mmcv/image/transforms/geometry.py
mmcv/image/transforms/geometry.py
+2
-2
mmcv/parallel/distributed.py
mmcv/parallel/distributed.py
+4
-1
mmcv/runner/runner.py
mmcv/runner/runner.py
+3
-1
mmcv/utils/misc.py
mmcv/utils/misc.py
+1
-1
mmcv/video/processing.py
mmcv/video/processing.py
+4
-1
tests/test_optflow.py
tests/test_optflow.py
+6
-6
No files found.
mmcv/image/transforms/geometry.py
View file @
0eef3757
...
@@ -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
:
...
...
mmcv/parallel/distributed.py
View file @
0eef3757
...
@@ -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
...
...
mmcv/runner/runner.py
View file @
0eef3757
...
@@ -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
()
...
...
mmcv/utils/misc.py
View file @
0eef3757
...
@@ -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:
...
...
mmcv/video/processing.py
View file @
0eef3757
...
@@ -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.
...
...
tests/test_optflow.py
View file @
0eef3757
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment