There are two tiff files containing training data and the corresponding label.
I only implemented one experience(MNIST dataset for recognition of handwritten numbers) before, in which case there is one dataloader for me to extract both data and label simultaneously in a tuple.
And I don’t know how to use data in the form I encountered this time…
Wonder what method is commonly used.
Need for Help
Here’s part of my code:
data_set = ISBIdata(‘D:/Projects/U-Net/train-volume.tif’)
label_set = ISBIdata(‘D:/Projects/U-Net/train-labels.tif’)
test_set = ISBIdata(‘D:/Projects/U-Net/test-volume.tif’)
data_loader = DataLoader(data_set, batch_size = args.batch_size)
label_loader = DataLoader(label_set, batch_size = args.batch_size)
test_loader = DataLoader(test_set, batch_size = args.batch_size)
def train():
for idx,  in enumerate(data_loader):
data =
label =
data.requires_grad = True
data = data.to(device)
label = label.to(device)
optimzer.zero_grad()
pred = model(data)
loss = criterion(pred, label)
loss.bachward()
optimizer.step()