Skip to content
ml-recall

#totensor

1 question from Segmentation

Timed test

1 question · 1 min · score and explanations at the end

Take a test
Q 1 / 1Score 0 / 0

Question 1: Short answer

mediumAI-checkedSegmentation

A segmentation label mask stores class indices as uint8. It is converted like an input image:

import numpy as np
from torchvision import transforms

mask = np.full((4, 4, 1), 15, dtype=np.uint8)   # every pixel has class 15
t = transforms.ToTensor()(mask)
print(round(t[0, 0, 0].item(), 4))

What is printed?

a number, 4 decimals