Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

where is the joint_transforms #5

Open
zuiyichangdi opened this issue Jul 21, 2020 · 3 comments
Open

where is the joint_transforms #5

zuiyichangdi opened this issue Jul 21, 2020 · 3 comments

Comments

@zuiyichangdi
Copy link

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?

@zuiyichangdi zuiyichangdi changed the title where is the train_tiramisu.py where is the joint_transforms Jul 21, 2020
@zuiyichangdi zuiyichangdi reopened this Jul 21, 2020
@li0128
Copy link

li0128 commented Jul 6, 2022

train_tiramisu.py no module 'joint_transforms', how to do? thank u! @zuiyichangdi

@zuiyichangdi
Copy link
Author

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.

@cleverk1ng
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants