Dataset: CAMVID
Input: torch.Size([1, 3, 160, 160])
Target: torch.Size([160, 160, 3])
Predictions torch.Size([1, 3, 160, 160])
Train code:
model.train()
for idx in tqdm(range(EPOCHS)):
train_images, train_masks = torch.tensor(train_img[idx]), torch.tensor(train_lbl[idx])
inputs = Variable((train_images).unsqueeze(0), requires_grad=True).float().permute(0, 3, 1, 2)
targets = Variable((train_masks), requires_grad=True).long()
print('Input:',inputs.shape)
print('Target:',targets.shape)
predictions = model(inputs)
print('Predictions',predictions.shape)
loss = criterion(predictions, targets)
Network:
super(UNet, self).init()
self.pool = torch.nn.MaxPool2d((2,2))
self.up_samp = torch.nn.Upsample(scale_factor=2, mode=‘nearest’)
self.down_conv1 = down_block(3, 32)
self.down_conv2 = down_block(32, 64)
self.down_conv3 = down_block(64, 128)
self.down_conv4 = down_block(128, 256)
self.down_conv5 = down_block(256, 512)
self.down_conv6 = down_block(512, 1024)
self.up_conv1 = up_block(1024, 512)
self.up_conv2 = up_block(512, 256)
self.up_conv3 = up_block(256, 128)
self.up_conv4 = up_block(128, 64)
self.up_conv5 = up_block(64, 32)
self.out = out(32, 32)
What should my targets looks like?
How should i build the evaluation part for multi class classification?
Thanks