Comments (13)
@7yl4r The last commit did change the behaviour of the maintain_aspect_ratio parameter, but I made it so that the image that is generated at the end of the script will always maintain the aspect ratio of the original content image. The parameter now acts as a flag to load a 400x640 image (if set to 1) or else a 400x400 image as the content and style image (assuming that image_size = 400)
The replacement of if maintain_aspect_ratio and (not rescale_image)
with if not rescale_image
basically means that if you aren't going to upscale the image to the original dimensions (say 1080p using bicubic upsampling), then at least maintain the aspect ratio (say 400x640)
Simply put, as long as you aren't providing a square image and aren't upscaling to full size of the original image, it should maintain the aspect ratio in the generated image. Can you provide me with some sample content images on which I can test this?
from neural-style-transfer.
Here is what I get from the first iteration of
python INetwork.py --image_size 200 ./images/inputs/content/tubingen.jpg ./images/inputs/style/starry_night.jpg ./test
from neural-style-transfer.
Can you see if there is a line such as "Rescaling Image to (400, 640)" after each iteration ?
from neural-style-transfer.
Try with the argument : --rescale_image "False"
from neural-style-transfer.
from neural-style-transfer.
Can you copy paste the Network.py and INetwork.py code from the repo into your local copies and run it again? Because this is the results I am getting :
"D:/Users/Yue/PycharmProjects/Neural Style Transfer/INetwork.py" D:\Yue\Pictures\hoovertowernight.jpg D:\Yue\Pictures\Art\starry_night.jpg "D:\Yue\Desktop\Neural Art\test" --image_size 200
Model loaded.
Starting iteration 1 of 10
Current loss value: 135229216.0 Improvement : 0.000 %
Rescaling Image to (200, 380)
Image saved as D:\Yue\Desktop\Neural Art\test_at_iteration_1.png
from neural-style-transfer.
I have cloned the repo through git, and git status shows no changes from master. Adding --rescale_image "False"
didn't have an effect.
from neural-style-transfer.
Well that is weird. The same code having different results ? What is your python version? 2.7 ?
There shouldn't be any difference in calculating the aspect ratio between python 3 and 2 though
from neural-style-transfer.
Python version 2.7.12. I'm going to add some print statements and see if I can find what is going on and I'll get back to you.
from neural-style-transfer.
Yes thanks for that. Also, try adding the original line if maintain_aspect_ratio and (not rescale_image)
to see if it makes any difference.
from neural-style-transfer.
I believe I've identified the issue and suggested a fix. aspect_ratio
was being calculated using integer math, so I've suggested a cast to force floating point computation. I'm guessing the difference has to do with how command line vars are evaluated on windows vs linux.
from neural-style-transfer.
Oh ! Nice catch. If you wish to be credited for the fix, could you create a pull request ?
from neural-style-transfer.
Thanks for the fix !
from neural-style-transfer.
Related Issues (20)
- [Question] Content mask format HOT 5
- how to run the script on multiples GPU?
- ImportError: cannot import name 'imread' HOT 5
- Google colab neural style transfer HOT 2
- error in MRFNetwork.py HOT 1
- could we apply fast-style-transfer to image deformation? HOT 2
- Update documentation to reflect that tensorflow works on Windows now
- Replace tf.gradients with tf.GradientTape : RuntimeError HOT 2
- Bug using preserve color option HOT 3
- ValueError: Tensor conversion requested dtype float32 for Tensor with dtype int32: 'Tensor("strided_slice_8:0", shape=(), dtype=int32)' HOT 1
- script helper
- script helper
- Saving model
- RuntimeError: tf.gradients is not supported when eager execution is enabled. Use tf.GradientTape instead. HOT 5
- convert_all_kernels_in_model removed from tf2 HOT 1
- RuntimeError: tf.gradients is not supported when eager execution is enabled. Use tf.GradientTape instead. HOT 2
- neural doodle
- broken and unusable HOT 1
- Tensorflow 1 is unsupported in Colab
- Hello, I'm sorry to bother you. I need help
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from neural-style-transfer.