Unverified 提交 577f298d authored 作者: Hu Ye's avatar Hu Ye 提交者: GitHub

plot_images() scale bug fix (#1566)

fix bugs in plot_images
上级 b6ed1104
...@@ -141,9 +141,12 @@ def plot_images(images, targets, paths=None, fname='images.jpg', names=None, max ...@@ -141,9 +141,12 @@ def plot_images(images, targets, paths=None, fname='images.jpg', names=None, max
labels = image_targets.shape[1] == 6 # labels if no conf column labels = image_targets.shape[1] == 6 # labels if no conf column
conf = None if labels else image_targets[:, 6] # check for confidence presence (label vs pred) conf = None if labels else image_targets[:, 6] # check for confidence presence (label vs pred)
if boxes.shape[1] and boxes.max() <= 1: # if normalized if boxes.shape[1]:
boxes[[0, 2]] *= w # scale to pixels if boxes.max() <= 1: # if normalized
boxes[[1, 3]] *= h boxes[[0, 2]] *= w # scale to pixels
boxes[[1, 3]] *= h
elif scale_factor < 1: # absolute coords need scale if image scales
boxes *= scale_factor
boxes[[0, 2]] += block_x boxes[[0, 2]] += block_x
boxes[[1, 3]] += block_y boxes[[1, 3]] += block_y
for j, box in enumerate(boxes.T): for j, box in enumerate(boxes.T):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论