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
11b92640
"git@developer.sourcefind.cn:OpenDAS/ollama.git" did not exist on "ce0c95d0972476f1e5a0064edbceb33d3ceed6ba"
Unverified
Commit
11b92640
authored
Feb 07, 2021
by
Luting Wang
Committed by
GitHub
Feb 07, 2021
Browse files
fix: imshow_bboxes fails with incontiguous img (#823)
parent
4a694cc0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
mmcv/visualization/image.py
mmcv/visualization/image.py
+3
-1
No files found.
mmcv/visualization/image.py
View file @
11b92640
...
@@ -53,6 +53,7 @@ def imshow_bboxes(img,
...
@@ -53,6 +53,7 @@ def imshow_bboxes(img,
ndarray: The image with bboxes drawn on it.
ndarray: The image with bboxes drawn on it.
"""
"""
img
=
imread
(
img
)
img
=
imread
(
img
)
img
=
np
.
ascontiguousarray
(
img
)
if
isinstance
(
bboxes
,
np
.
ndarray
):
if
isinstance
(
bboxes
,
np
.
ndarray
):
bboxes
=
[
bboxes
]
bboxes
=
[
bboxes
]
...
@@ -119,6 +120,7 @@ def imshow_det_bboxes(img,
...
@@ -119,6 +120,7 @@ def imshow_det_bboxes(img,
assert
bboxes
.
shape
[
0
]
==
labels
.
shape
[
0
]
assert
bboxes
.
shape
[
0
]
==
labels
.
shape
[
0
]
assert
bboxes
.
shape
[
1
]
==
4
or
bboxes
.
shape
[
1
]
==
5
assert
bboxes
.
shape
[
1
]
==
4
or
bboxes
.
shape
[
1
]
==
5
img
=
imread
(
img
)
img
=
imread
(
img
)
img
=
np
.
ascontiguousarray
(
img
)
if
score_thr
>
0
:
if
score_thr
>
0
:
assert
bboxes
.
shape
[
1
]
==
5
assert
bboxes
.
shape
[
1
]
==
5
...
@@ -129,7 +131,7 @@ def imshow_det_bboxes(img,
...
@@ -129,7 +131,7 @@ def imshow_det_bboxes(img,
bbox_color
=
color_val
(
bbox_color
)
bbox_color
=
color_val
(
bbox_color
)
text_color
=
color_val
(
text_color
)
text_color
=
color_val
(
text_color
)
img
=
np
.
ascontiguousarray
(
img
)
for
bbox
,
label
in
zip
(
bboxes
,
labels
):
for
bbox
,
label
in
zip
(
bboxes
,
labels
):
bbox_int
=
bbox
.
astype
(
np
.
int32
)
bbox_int
=
bbox
.
astype
(
np
.
int32
)
left_top
=
(
bbox_int
[
0
],
bbox_int
[
1
])
left_top
=
(
bbox_int
[
0
],
bbox_int
[
1
])
...
...
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