kleinzcy / SASSnet

Shape-aware Semi-supervised 3D Semantic Segmentation for Medical Images
162 stars 29 forks source link

about class number #3

Closed GuobinZhangTJU closed 3 years ago

GuobinZhangTJU commented 3 years ago

Hi, thanks for your reply, I meet a question in the code, can you help, num_classes = 2, but during training, the input class number is n_classes=num_classes-1: net = VNet(n_channels=1, n_classes=num_classes-1, normalization='batchnorm', has_dropout=True) Can you tell me why do this operation? Many thanks, waiting for your reply.

kleinzcy commented 3 years ago

@GuobinZhangTJU Hi,

There is no difference between the two implements for the binary segmentation task.

If the output channel is n_classes = num_classes-1, that means the output is the foreground probability, and you can obtain background probability through 1-foreground probability. If the output channel is n_classes = num_classe, that means the output is the foreground probability and background probability. The implements of n_class will make a little difference to your loss function, whether BCEloss or CrossEntropy.

GuobinZhangTJU commented 3 years ago

@GuobinZhangTJU Hi,

There is no difference between the two implements for the binary segmentation task.

If the output channel is n_classes = num_classes-1, that means the output is the foreground probability, and you can obtain background probability through 1-foreground probability. If the output channel is n_classes = num_classe, that means the output is the foreground probability and background probability. The implements of n_class will make a little difference to your loss function, whether BCEloss or CrossEntropy.

Got it, thanks for your reply~~