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
0874642f
Unverified
Commit
0874642f
authored
Feb 05, 2020
by
lizz
Committed by
GitHub
Feb 05, 2020
Browse files
Speed up bbox_clip (#177)
* Speed up bbox_clip * Update geometry.py
parent
d6ce3a2e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
mmcv/image/transforms/geometry.py
mmcv/image/transforms/geometry.py
+4
-5
No files found.
mmcv/image/transforms/geometry.py
View file @
0874642f
...
@@ -76,11 +76,10 @@ def bbox_clip(bboxes, img_shape):
...
@@ -76,11 +76,10 @@ def bbox_clip(bboxes, img_shape):
ndarray: Clipped bboxes.
ndarray: Clipped bboxes.
"""
"""
assert
bboxes
.
shape
[
-
1
]
%
4
==
0
assert
bboxes
.
shape
[
-
1
]
%
4
==
0
clipped_bboxes
=
np
.
empty_like
(
bboxes
,
dtype
=
bboxes
.
dtype
)
cmin
=
np
.
empty
(
bboxes
.
shape
[
-
1
],
dtype
=
bboxes
.
dtype
)
clipped_bboxes
[...,
0
::
2
]
=
np
.
maximum
(
cmin
[
0
::
2
]
=
img_shape
[
1
]
-
1
np
.
minimum
(
bboxes
[...,
0
::
2
],
img_shape
[
1
]
-
1
),
0
)
cmin
[
1
::
2
]
=
img_shape
[
0
]
-
1
clipped_bboxes
[...,
1
::
2
]
=
np
.
maximum
(
clipped_bboxes
=
np
.
maximum
(
np
.
minimum
(
bboxes
,
cmin
),
0
)
np
.
minimum
(
bboxes
[...,
1
::
2
],
img_shape
[
0
]
-
1
),
0
)
return
clipped_bboxes
return
clipped_bboxes
...
...
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