Skip to content

Commit

Permalink
COCOReader: Support for uncompressed RLE masks (#2478)
Browse files Browse the repository at this point in the history
Signed-off-by: Joaquin Anton <janton@nvidia.com>
  • Loading branch information
jantonguirao committed Nov 30, 2020
1 parent 4a7374a commit 737b7b9
Show file tree
Hide file tree
Showing 7 changed files with 426 additions and 202 deletions.
2 changes: 1 addition & 1 deletion DALI_EXTRA_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
fdd536addddc0f1a5bd52a15db708f95492c813e
355734c4d6f2d3ec77fddf849adac2b812769712
5 changes: 3 additions & 2 deletions dali/operators/reader/coco_reader_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,12 @@ void COCOReader::PixelwiseMasks(int image_idx, int* mask) {
RLE* R;
rlesInit(&R, *labels.rbegin() + 1);

// Create a run-length encoding for each compressed string representation
// Mask was originally described in RLE format
for (uint ann_id = 0 ; ann_id < masks_info.mask_indices.size(); ann_id++) {
const auto &rle = masks_info.rles[ann_id];
auto mask_idx = masks_info.mask_indices[ann_id];
int label = labels_span[mask_idx];
rleFrString(&R[label], const_cast<char*>(masks_info.rles[ann_id].c_str()), h, w);
rleInit(&R[label], rle->h, rle->w, rle->m, rle->cnts);
}

// Merge each label (from multi-polygons annotations)
Expand Down
Loading

0 comments on commit 737b7b9

Please sign in to comment.