Image Segmentation Tasks not returning Scores

I am following this tutorial from Phil Schmid on how to deploy an image-segmentation model from the huggingface hub to a sagemaker endpoint.

The only difference I make to the code is that I deploy the model serverlessly.

The deployment works great, and the the masking works. However, I am not being returned the scores of each class. The values are all None for the scores.

e.g. {“score”: null, “label”: “wall”, “mask”: }

This applies to every model I try from the Hub, not just one. Would love clarity on this, and any potential fixes.


cc @philschmid

@ShuaHousetable have you tested deploying the model as real-time endpoint rather than serverless? does it work there?

Hi @philschmid , thanks for the response.

Yes, I tried it straight (without the serverless) like you suggested. Still receiving all “None” for the scores.

Running the notebook you created straight, using the DataScience3 Image in sagemaker.

Hey @philschmid, just wondering if there is any update on this. Thanks!


It depends on which model you’re using. In case of semantic segmentation (like SegFormer), there’s no notion of scores per segment. This is because the model predicts a label per pixel. Hence the model only outputs scores per pixel, not per segment.

However, models like DETR and MaskFormer do output scores per segment.