Hello, I was trying to do an image segmentation and after testing saved the three images ( as an example).
The problem is that 3 images are merged, while I want to save each one separately.
def save_test(loader, model, folder=‘/kaggle/working/saved_test/’,device=‘cuda’):
model.eval()
for idx, x in enumerate(loader):
x = x.to(device=device)
with torch.no_grad():
preds = torch.sigmoid(model(x))
preds = (preds > 0.5).float()
torchvision.utils.save_image(
preds, f"{folder}/test_{idx}.png"
)
#torchvision.utils.save_image(y.unsqueeze(1), f"{folder}{idx}.png")
model.train()
Could you check, please?
Does anyone know what is the problem?