Problem in .transform #376
Unanswered
senior-bot-dev
asked this question in
Q&A
Replies: 1 comment
-
Hi @senior-bot-dev, Where did you get the code from? What have you tried so far? You can import from torchvision import transforms |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I actually wrote this code:
'''def plot_transformed_images(image_paths,tranform,n=3,seed=None):
if seed:
random.seed(seed)
random_image_paths=random.sample(image_paths,k=n)
for image_path in random_image_paths:
with Image.open(image_path) as f:
fig,ax=plt.subplots(1,2)
ax[0].imshow(f)
ax[0].set_title(f'Original\nSize:{f.size}')
ax[0].axis(False)
transformed_image = torch.transf(f).permute(1, 2, 0)
ax[1].imshow(transformed_image)
ax[1].set_title(f"Transformed\nShape:{transformed_image.shape}")
ax[1].axis("off")
fig.suptitle(f'Class{image_path.parent.stem}')
plot_transformed_images(image_path_list,data_transform,3,42)'''
but he returned an error that transforms is not defined
what to do?
Beta Was this translation helpful? Give feedback.
All reactions