pystiche / papers

Reference implementation and replication of prominent NST papers
BSD 3-Clause "New" or "Revised" License
4 stars 1 forks source link

Ulyanov image stylization RuntimeError #295

Closed jbueltemeier closed 1 year ago

jbueltemeier commented 1 year ago

As described in #294, a RuntimeError currently occurs for images with a height or width that are not multiples of 64. This PR solves this problem by using an additional TopLeftCropToMultiple for the case with impl_params=False.

jbueltemeier commented 1 year ago

The problem is that the authors do not specify in their paper (impl_params=False) how the images are preprocessed. They only show images in different sizes, with a height and width that are multiples of 64.

pmeier commented 1 year ago

Could you have a look what the author is doing in the implementation?

jbueltemeier commented 1 year ago

In the implementation, only a resize to the required image size is used. For the example images, the image size is 256x256. This results in a deformation of the image.

pmeier commented 1 year ago

I'm not sure I understand. Could you link the parts you refer to?

jbueltemeier commented 1 year ago

Here are the links to the original implementation for both replicated branches: master branch texture_net_v1 branch

pmeier commented 1 year ago

As discussed offline:

  1. Check if both side lengths are a multiple of 64. If yes, return.
  2. Resize the image so that the smaller size is the next larger multiple of 64.
  3. Center crop so both side lengths are a multiple of 64.