Browse Source

!2850 Fix data preprocess bug in yolov3-darknet53

Merge pull request !2850 from yangyongjie/master
tags/v0.6.0-beta
mindspore-ci-bot Gitee 5 years ago
parent
commit
0aa8f0010d
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      model_zoo/yolov3_darknet53/src/transforms.py

+ 2
- 2
model_zoo/yolov3_darknet53/src/transforms.py View File

@@ -166,7 +166,7 @@ def _preprocess_true_boxes(true_boxes, anchors, in_shape, num_classes,
valid_mask = boxes_wh[..., 0] > 0 valid_mask = boxes_wh[..., 0] > 0
wh = boxes_wh[valid_mask] wh = boxes_wh[valid_mask]
if wh:
if wh.size > 0:
wh = np.expand_dims(wh, -2) wh = np.expand_dims(wh, -2)
boxes_max = wh / 2. boxes_max = wh / 2.
boxes_min = -boxes_max boxes_min = -boxes_max
@@ -319,7 +319,7 @@ def _choose_candidate_by_constraints(max_trial, input_w, input_h, image_w, image
dx = int(_rand(0, input_w - nw)) dx = int(_rand(0, input_w - nw))
dy = int(_rand(0, input_h - nh)) dy = int(_rand(0, input_h - nh))
if box:
if box.size > 0:
t_box = copy.deepcopy(box) t_box = copy.deepcopy(box)
t_box[:, [0, 2]] = t_box[:, [0, 2]] * float(nw) / float(image_w) + dx t_box[:, [0, 2]] = t_box[:, [0, 2]] * float(nw) / float(image_w) + dx
t_box[:, [1, 3]] = t_box[:, [1, 3]] * float(nh) / float(image_h) + dy t_box[:, [1, 3]] = t_box[:, [1, 3]] * float(nh) / float(image_h) + dy


Loading…
Cancel
Save