crack_segmentation
crack_segmentation copied to clipboard
where is the joint_transforms
When I was reading train_tiramisu.py, I found that the code need to import JointRandomSizedCrop from joint_transforms. However, I did not find the joint_transforms. Whether it is a package, or you deleted it?
train_tiramisu.py no module 'joint_transforms', how to do? thank u! @zuiyichangdi
train_tiramisu.py no module 'joint_transforms', how to do? thank u! @zuiyichangdi
Oh, sorry, I didn't find a solution. And it's been two years, I almost forgot about the project. I regret not being able to advise you.
I think this function should be useful.
def joint_transform(img, mask):
img = transforms.ToTensor()(img)
mask = transforms.ToTensor()(mask)
both_images = torch.cat((img, mask), 0)
# Apply the transformations to both images simultaneously:
transformed_images = transforms.RandomResizedCrop(224, antialias=True)(both_images)
# Get the transformed images:
img = transforms.ToPILImage()(transformed_images[0:3])
mask = transforms.ToPILImage()(transformed_images[3:6])
return img, mask