未验证 提交 d8cb6707 编写于 作者: W Wenyu 提交者: GitHub

fix picodet postprocess for none-det case (#4462)

上级 397a1d57
...@@ -193,29 +193,34 @@ class PicoDetPostProcess(object): ...@@ -193,29 +193,34 @@ class PicoDetPostProcess(object):
top_k=self.keep_top_k, ) top_k=self.keep_top_k, )
picked_box_probs.append(box_probs) picked_box_probs.append(box_probs)
picked_labels.extend([class_index] * box_probs.shape[0]) picked_labels.extend([class_index] * box_probs.shape[0])
if not picked_box_probs:
return np.array([]), np.array([]), np.array([]) if len(picked_box_probs) == 0:
picked_box_probs = np.concatenate(picked_box_probs) out_boxes_list.append(np.empty((0, 4)))
out_boxes_num.append(0)
# resize output boxes
picked_box_probs[:, :4] = self.warp_boxes(picked_box_probs[:, :4], else:
self.ori_shape[batch_id]) picked_box_probs = np.concatenate(picked_box_probs)
im_scale = np.concatenate([
self.scale_factor[batch_id][::-1], # resize output boxes
self.scale_factor[batch_id][::-1] picked_box_probs[:, :4] = self.warp_boxes(
]) picked_box_probs[:, :4], self.ori_shape[batch_id])
picked_box_probs[:, :4] /= im_scale im_scale = np.concatenate([
# clas score box self.scale_factor[batch_id][::-1],
out_boxes_list.append( self.scale_factor[batch_id][::-1]
np.concatenate( ])
[ picked_box_probs[:, :4] /= im_scale
np.expand_dims( # clas score box
np.array(picked_labels), axis=-1), np.expand_dims( out_boxes_list.append(
picked_box_probs[:, 4], axis=-1), np.concatenate(
picked_box_probs[:, :4] [
], np.expand_dims(
axis=1)) np.array(picked_labels),
out_boxes_num.append(len(picked_labels)) axis=-1), np.expand_dims(
picked_box_probs[:, 4], axis=-1),
picked_box_probs[:, :4]
],
axis=1))
out_boxes_num.append(len(picked_labels))
out_boxes_list = np.concatenate(out_boxes_list, axis=0) out_boxes_list = np.concatenate(out_boxes_list, axis=0)
out_boxes_num = np.asarray(out_boxes_num).astype(np.int32) out_boxes_num = np.asarray(out_boxes_num).astype(np.int32)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册