HumanSignal / label-studio-converter

Tools for converting Label Studio annotations into common dataset formats
https://labelstud.io/
255 stars 132 forks source link

Speed up encode_rle function by 250-500x #52

Closed csaroff closed 2 years ago

csaroff commented 3 years ago

Converting a segmentation mask(691 x 1024 where pixel-intensity = segmentation class) to series of run-length encoded masks(label-studio format) was taking forever(about 95 seconds with 4 segmentation classes).

After improving the performance of encode_rle, the same conversion takes 174ms

Here's the performance differences with timeit:

image

robhyb19 commented 2 years ago

@makseq This performance improvement that @csaroff made helped us immensely. Was wondering if there was an ETA on merging this PR in with master?

makseq commented 2 years ago

@robhyb19 I've checked it now, works well. Merged.