2023 IEEE GRSS Data Fusion Contest Track 1 Forum

Go back to competition Back to thread list Post in this thread

> Converting Binary Masks to RLE Encoding

I am using a library that differs from the mmdetection library and it does not support run-length encoding (RLE) for masks. To overcome this, I am attempting to convert the mask results from my model into the RLE format. I utilized the encode function from the pycocotools library for this purpose. This function produces the RLE as a series of bytes, which I then converted into a string using decode('utf-8'). However, when I uploaded the results to validate my model, I obtained an unexpected outcome. This leads me to believe that I may have made an error in converting the binary masks to the RLE format. Can you suggest a method for accurately converting binary masks to the RLE format?

Posted by: duraklefkan @ Feb. 11, 2023, 10:01 p.m.

You can try using the following code for converting mask to RLE encodings.
```
rle = pycocotools.mask.encode(mask)
rle['counts'] = str(rle['counts'], encoding='utf-8')
```

Posted by: dfc2023.iecas @ Feb. 20, 2023, 5:07 a.m.
Post in this thread