Skip to content

Commit

Permalink
fix pad2D potential error (#250)
Browse files Browse the repository at this point in the history
  • Loading branch information
zehuichen123 authored and RogerChern committed Oct 24, 2019
1 parent 67c79f5 commit f09f507
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/detection_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,9 @@ def apply(self, input_record):
image = input_record["image"]
gt_bbox = input_record["gt_bbox"]

origin_h, origin_w = input_record["h"], input_record["w"]
h, w = image.shape[:2]
shape = (p.long, p.short, 3) if h >= w \
shape = (p.long, p.short, 3) if origin_h >= origin_w \
else (p.short, p.long, 3)

padded_image = np.zeros(shape, dtype=np.float32)
Expand Down Expand Up @@ -334,8 +335,9 @@ def apply(self, input_record):

image = input_record["image"]

origin_h, origin_w = input_record["h"], input_record["w"]
h, w = image.shape[:2]
shape = (p.long, p.short, 3) if h >= w \
shape = (p.long, p.short, 3) if origin_h >= origin_w \
else (p.short, p.long, 3)

padded_image = np.zeros(shape, dtype=np.float32)
Expand Down

0 comments on commit f09f507

Please sign in to comment.