Hi all
i am new in using of Sematic Segmantation models
so i used the smp modsl for smenatic segamtnion amd i built model and loss lik follosing :
model = smp.Unet(encoder_name=‘resnet34’,
encoder_depth=5,
encoder_weights=‘imagenet’,
decoder_use_batchnorm=True,
decoder_channels=(256, 128, 64, 32, 16),
decoder_attention_type=None,
in_channels=3,
classes=5,
activation=None,
aux_params=None)
loss = smp.losses.FocalLoss(mode=‘multiclass’, gamma=2.0)
loss.name = ‘FocalLoss’
and the target mask size is 8x512x512  (contain indices in each pixel represents the class value)
with image size is 8x3x512x512
after run the following code to train the model :
train_epoch = smp.utils.train.TrainEpoch(
model=model,
loss=loss,
metrics= metrics,
optimizer=optimizer,
device=device,
verbose=True,)
train_logs = train_epoch.run(traindataloader)
i got this error:
…/ Deeplearning\lib\site-packages\segmentation_models_pytorch\utils\functional.py", line 34, in iou
intersection = torch.sum(gt * pr)
RuntimeError: The size of tensor a (8) must match the size of tensor b (5) at non-singleton dimension 1
why the gt and pr mismatch ??
how can I overcome this error?