Skip to content

Instantly share code, notes, and snippets.

@Noob-can-Compile
Created December 1, 2019 09:32
Show Gist options
  • Save Noob-can-Compile/7fc854c63a16252af49fb463aabf0437 to your computer and use it in GitHub Desktop.
Save Noob-can-Compile/7fc854c63a16252af49fb463aabf0437 to your computer and use it in GitHub Desktop.
# test out some of these transforms
rescale = Rescale(100)
crop = RandomCrop(50)
composed = transforms.Compose([Rescale(250),
RandomCrop(224)])
# apply the transforms to a sample image
test_num = 500
sample = face_dataset[test_num]
fig = plt.figure()
for i, tx in enumerate([rescale, crop, composed]):
transformed_sample = tx(sample)
ax = plt.subplot(1, 3, i + 1)
plt.tight_layout()
ax.set_title(type(tx).__name__)
show_keypoints(transformed_sample['image'], transformed_sample['keypoints'])
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment