-
Notifications
You must be signed in to change notification settings - Fork 484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aspect ratio #22
Comments
The requirement is not dropped. The gram matrix is always a square matrix. Therefore to compute the gram matrix I resize the image to a square shape. Then perform all the vgg loss and style loss and so on using LBFGS. The final output is a square image of same size as the gram matrix. I then resize this gram matrix to preserve aspect ratio of the original image. If you wish to see a square image, set --maintain_aspect_ratio="False" |
Sorry, that was not quite what I wanted to ask. I'm asking about image aspect ratio. I think it can be arbitrary throughout all processing steps. Of course the Gram matrix is square because it is a cross correlation matrix. What I don't understand is why you require the width and height of a processed image to be equal. Line 130: When I remove this requirement the code still works (as it should!) |
That's a redundant check. I resize the image to the gram matrix size (400x400) by default, and then perform this check. The check can safely be removed, since we are rescaling the image to the gram matrix size just above that. |
Yes, I can see that. What I'm asking is why you are doing What has the Gram matrix to do with the aspect ration of your image? |
The results seem close now. I'm travelling for a few days and won't have access to my laptop. The 640x400 seems to preserve the text at the top right far better, along with similar style transfer in other regions. My results must be due to some other error. Feel free to add a PR |
@ink1, I found the mistake. I used the older Network.py to test my image (since it is faster), but it sacrifices quality for speed. When I switched to INetwork.py I was able to replicate your results. As of commit 6a08eaa, the content image and style image are scaled to the content aspect ratio before passing onto the VGG network. This will drastically increase execution time (INetwork used to take 14 seconds, now it takes 23 seconds per epoch), but delivers more precise results. Thanks for raising the issue. The results now seems to be closer to the DeepArt.io results. |
Hi, nice code and thank you for sharing it!
Why do you say (and require) that Gram matrix is square?
In fact your code seems to work even when this requirement is dropped out (thanks for keeping widths and heights separate).
The text was updated successfully, but these errors were encountered: