diff --git a/paddle/fluid/operators/detection/generate_mask_labels_op.cc b/paddle/fluid/operators/detection/generate_mask_labels_op.cc index 46727c29de13c1213694540e6614a05f9008d232..38eafa5fe8fc6fb1437caa98245d853e0e1566cb 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]);