open-mmlab / mmsegmentation

OpenMMLab Semantic Segmentation Toolbox and Benchmark.
https://mmsegmentation.readthedocs.io/en/main/
Apache License 2.0
7.7k stars 2.53k forks source link

Overflow in `tools/analysis_tools/confusion_matrix.py` #3583

Open huynhtuan17ti opened 4 months ago

huynhtuan17ti commented 4 months ago

Bug

gt_segm, res_segm = gt_segm[~to_ignore], res_segm[~to_ignore]
inds = n * gt_segm + res_segm

Seems inds can be overflowed due to dtype of gt_segm and res_segm being np.uint8.

Bug fix

A possible fix is to cast the type of gt_segm to a bigger byte-size type.