open-mmlab / mmsegmentation

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

Confidence Score associated with segmentation #3684

Open rafaelagrc opened 1 month ago

rafaelagrc commented 1 month ago

Hello,

I am wondering if there is a way to extract the confidence score associated with the predicted masks. I am aware that I can extract the logits (described below) and pass them through a softmax layer to get confidence for each pixel, but I get very low values. Do you suggest any other way?

model = init_model(cfg, checkpoint_file, 'cuda:0')
result = inference_model(model, image)

for i in range(len(classes)):
      seg_logits = result.seg_logits.data[i]
      prob = F.softmax(seg_logits, dim=1)

Thank you for your attention!