Skip to content

Conversation

alykhantejani
Copy link
Contributor

As per the comment here there was some confusion and discussion around how to use FiveCrop and TenCrop as they return a tuple of images instead of a single images.

This PR adds an example to the docstrings of how to do this.

Example:
>>> transform = Compose([
>>> FiveCrop(size), # this is a list of PIL Images
>>> Lambda(lambda crops: torch.stack([ToTensor()(crop) for crop in crops])) # returns a 4D tensor

This comment was marked as off-topic.

This comment was marked as off-topic.

Example:
>>> transform = Compose([
>>> TenCrop(size), # this is a list of PIL Images
>>> Lambda(lambda crops: torch.stack([ToTensor()(crop) for crop in crops])) # returns a 4D tensor

This comment was marked as off-topic.

Copy link
Member

@fmassa fmassa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks good, thanks Aly!
I have only one minor comment, but apart from that this is ready to merge.

@fmassa fmassa merged commit 7be960f into pytorch:master Oct 30, 2017
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

Successfully merging this pull request may close these issues.

2 participants