fzliu / style-transfer

An implementation of "A Neural Algorithm of Artistic Style" by L. Gatys, A. Ecker, and M. Bethge. http://arxiv.org/abs/1508.06576.
1.54k stars 387 forks source link

changed length parameter to a scale parameter #15

Closed dpaiton closed 9 years ago

dpaiton commented 9 years ago

scale parameter is easier to think about than pixel length

dpaiton commented 9 years ago

Should I leave this a separate branch?

fzliu commented 9 years ago

Main reason I changed it to max length is so that we can track the input size better. If we define a fixed scale factor, a 1920x1080 image will be scaled to the same size as a 640x360 one. I'm running some tests trying different fixed length style versus content images, and this makes it a bit easier to do so. I think we might eventually want to change back and/or have both, so let's keep the PR open for now but hold off on merging it.

dpaiton commented 9 years ago

I agree, although I'm not sure what you mean when you say that a 1920x1080 image will be scaled to the same as a 640x360 one. My original implementation scaled both the content and the style image to scale_factor * content_size. This way the output size is also scale_factor * content_size. It was just much easier for me to think "I want to be N% of the original size" than to think in terms of pixel length.

Maybe we should just allow either specification, and force one to take priority if both are specified?

dpaiton commented 9 years ago

Sorry - bad at GIThub. I can see a reason for both parameters both for prototyping and for the demo. For now I'm fine with working with length as a specifier. We can discuss it more in the future.

fzliu commented 9 years ago

Yeah I was experimenting with changing the size of the style image, so that stuff will be different. Didn't know what your timeline was for continuing to work on the code (but I know now, so I'll hold off on doing experimentation in master).

One more thing - the style and content gradients are now normalized via grad /= np.nextafter(np.abs(grad).sum(), INF), so watch out for different results. I think this, combined with using the full set of features from each layer, is giving decent-ish results for googlenet. Still not as good as vgg though.

fzliu commented 9 years ago

Actually I'm just not going to merge anything into master for the time being.

dpaiton commented 9 years ago

Yeah I'm still actively working on it. I haven't pushed anything because I haven't had access to my VPN since I left the office.

dpaiton commented 9 years ago

I'm going to close this pull request and delete the branch. It is an easy feature to add later and for now isn't necessary.