"vscode:/vscode.git/clone" did not exist on "b15a951a48016a96b7db24090ab3f0c824ad4e73"
Unverified Commit 11b92640 authored by Luting Wang's avatar Luting Wang Committed by GitHub
Browse files

fix: imshow_bboxes fails with incontiguous img (#823)

parent 4a694cc0
...@@ -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])
......
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