Kaggle competition: Painter by Numbers
encodings = []
counter = 0
for image in test_dl:
if torch.cuda.is_available() :
image = image.cuda()
pr_mask = unet(image)
 pr_mask = pr_mask[0]
pr_mask = pr_mask.squeeze().cpu().detach().numpy().round().astype(np.uint8)
 pr_mask = cv2.resize(pr_mask,(580,420), interpolation=cv2.INTER_CUBIC)
 encodings.append(rle_encoding(pr_mask))
print(f'Image: {counter} ')
 counter += 1 
<save_to_csv>
print(check_output(["cp", ".. /input/sampleSubmission.csv", "sub.csv"] ).decode("utf8"))