From 0cae5a36b6235bc4e586a41e506ae4c6ee34aaed Mon Sep 17 00:00:00 2001 From: jerrywgz Date: Tue, 14 May 2019 17:34:09 +0800 Subject: [PATCH] enhance generate mask labels, test=develop (#17380) --- paddle/fluid/operators/detection/generate_mask_labels_op.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/paddle/fluid/operators/detection/generate_mask_labels_op.cc b/paddle/fluid/operators/detection/generate_mask_labels_op.cc index 46727c29de..38eafa5fe8 100644 --- a/paddle/fluid/operators/detection/generate_mask_labels_op.cc +++ b/paddle/fluid/operators/detection/generate_mask_labels_op.cc @@ -323,6 +323,10 @@ class GenerateMaskLabelsKernel : public framework::OpKernel { auto gt_segms_lod = gt_segms->lod(); for (int i = 0; i < n; ++i) { + if (rois_lod[i] == rois_lod[i + 1]) { + lod0.emplace_back(num_mask); + continue; + } Tensor im_info_slice = im_info->Slice(i, i + 1); Tensor gt_classes_slice = gt_classes->Slice(gt_classes_lod[i], gt_classes_lod[i + 1]); -- GitLab