Question about creating label for segmentation

Hi,
I’m new to PyTorch and I’m doing a segmentation work.
My dataset is in 3D with size of (64,128,128) and each volume contains 3 different classes.

I set label as (64,128,128,1), so each voxel value is 0 or 1 or 2, and I didn’t use Softmax before CrossEntropy.

In this case, the output of some voxels are [-103.49968 -30.210037 100.66923], [ 188.3785 18.234724 -165.98062].

My question are:
1.Am I setting the labels right?
2.Does the highest score in the voxel stands for the output class?
3.Why there are negative values in the ouput?
4.Should I use one-hot encoded label?

Hi,

if I understand correctly, the shape of label should be (batch_size)x64x128x128, because in a 2D case, the label should be (batch_size)x(height)x(width).

2 Likes

That’s really helpful, thanks!