Skip to content

Conversation

ProGamerGov
Copy link
Contributor

  • I merged the two center crop algorithms into a single function and class.

  • ToRGB can now accept user matrices, and it can also be disabled in NaturalImage.

@ProGamerGov
Copy link
Contributor Author

@NarineK This PR and #574 do not overlap with #552, so they can be reviewed whenever.

@NarineK
Copy link
Contributor

NarineK commented Dec 27, 2020

@NarineK This PR and #574 do not overlap with #552, so they can be reviewed whenever.

Thank you, @ProGamerGov! I'll take a look!

Copy link
Contributor

@NarineK NarineK left a comment

Choose a reason for hiding this comment

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

Thank you for working on this PR, @ProGamerGov! I left couple comments.

@ProGamerGov
Copy link
Contributor Author

ProGamerGov commented Dec 31, 2020

@NarineK I've made all the suggested changes, and it should be ready for merging now if there are no other issues!

Copy link
Contributor

@NarineK NarineK left a comment

Choose a reason for hiding this comment

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

Thank you for addressing the comments, @ProGamerGov! Posting couple more comments primarily related to type hints.

TransformValList = Union[Sequence[int], Sequence[float], Tensor]
TransformVal = Union[int, float, Tensor]
TransformSize = Union[List[int], Tuple[int], int]
SquashFuncType = Callable[[Tensor], Tensor]
Copy link
Contributor

Choose a reason for hiding this comment

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

Does [Tensor] mean a list of tensors ?

Copy link
Contributor Author

@ProGamerGov ProGamerGov Jan 2, 2021

Choose a reason for hiding this comment

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

No, it's just how lambda functions are type hinted: Callable[[<in type>], <out type>].

" torchvision.transforms.RandomRotation(degrees=(-5,5)),\r\n",
" optimviz.transform.RandomSpatialJitter(8),\r\n",
" optimviz.transform.CenterCrop(16),\r\n",
" optimviz.transform.CenterCrop((224,224)),\r\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

question: Would this be equivalent to passing: optimviz.transform.CenterCrop(16, pixels_from_edges=True) ?

Copy link
Contributor Author

@ProGamerGov ProGamerGov Jan 2, 2021

Choose a reason for hiding this comment

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

For removing the padding from torch.nn.ReflectionPad2d(16), the equivalent to optimviz.transform.CenterCrop(224, False), is optimviz.transform.CenterCrop(32, True) (16 * 2 = 32).

Copy link
Contributor

@NarineK NarineK Jan 3, 2021

Choose a reason for hiding this comment

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

I see, @ProGamerGov was the original line optimviz.transform.CenterCrop(16) incorrect ? because it looks like the original cropped 8 from each side ?

Copy link
Contributor Author

@ProGamerGov ProGamerGov Jan 3, 2021

Choose a reason for hiding this comment

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

@NarineK Yeah, it was! I mistakenly put 16 as I forgot about the division by 2.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can change it so that 16 is the correct user input if you think it would be better.

@NarineK
Copy link
Contributor

NarineK commented Jan 4, 2021

Thank you for working on this PR, @ProGamerGov ! Merging ...

@NarineK NarineK merged commit 885ea4b into meta-pytorch:optim-wip Jan 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants