Skip to content

Commit

Permalink
plot_images() scale bug fix (#1566)
Browse files Browse the repository at this point in the history
fix bugs in plot_images
  • Loading branch information
xiaohu2015 authored Dec 1, 2020
1 parent b6ed110 commit 577f298
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions utils/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
boxes[[0, 2]] *= w # scale to pixels
boxes[[1, 3]] *= h
if boxes.shape[1]:
if boxes.max() <= 1: # if normalized
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[[1, 3]] += block_y
for j, box in enumerate(boxes.T):
Expand Down

0 comments on commit 577f298

Please sign in to comment.