thodan / bop_toolkit

A Python toolkit of the BOP benchmark for 6D object pose estimation.
http://bop.felk.cvut.cz
MIT License
396 stars 138 forks source link

Speeds up binary_mask_to_rle #105

Closed cornerfarmer closed 11 months ago

cornerfarmer commented 11 months ago

When running calc_gt_coco.py using the RLE format, the biggest bottleneck is the binary_mask_to_rle function. Replacing the explicit python loop with pure numpy, reduces the execution time of the function from 70ms to 1ms. Especially when having many objects/masks this leads to a significant speed up of calc_gt_coco.