titu1994 / Neural-Style-Transfer

Keras Implementation of Neural Style Transfer from the paper "A Neural Algorithm of Artistic Style" (http://arxiv.org/abs/1508.06576) in Keras 2.0+
Apache License 2.0
2.26k stars 481 forks source link

several issues #18

Closed wlxyhy closed 7 years ago

wlxyhy commented 7 years ago

1.On linux, when I ran the project, it show "no module named tensorflow",evenif I had installed Theano. How to change it to theano? 2.I tried to install tensorflow and run again, then I received this: _Traceback (most recent call last): File "Network.py", line 257, in base_image = K.variable(preprocess_image(base_image_path, True, read_mode=read_mode)) File "Network.py", line 141, in preprocess_image img = imread(imagepath, mode=mode) # Prevents crashes due to PNG images (ARGB) TypeError: imread() got an unexpected keyword argument 'mode'

3.I changed "img = imread(image_path, mode=mode)" to "img = imread(image_path, mode)" and ran it again, I encounted the 3rd problem:

Traceback (most recent call last): File "Network.py", line 257, in base_image = K.variable(preprocess_image(base_image_path, True, read_mode=read_mode)) File "Network.py", line 160, in preprocess_image img = img[:, :, ::-1] IndexError: too many indices for array

  1. To run the project,should all the path be from root?

Look forward to your reply, thank you

titu1994 commented 7 years ago
  1. There is a note for all people who wish to use theano in the guide.md as well as the beginning of readme.md. To use theano with Keras, open the ~/.keras directory (it is a hidden directory, so use Ctrl H to see hidden folders) and configure their keras.json file inside it as below: { "image_dim_ordering": "th", "floatx": "float32", "backend": "theano", "epsilon": 1e-07 }
  2. Update your scipy library. imread is in scipy and should have the mode argument.
  3. That change will cause a crash because the second argument must be an array, not the mode argument. The mode argument is the 3rd parameter. However, the error caused due to that shouldn't happen either. The image shape is (width, height, channel), and so the rotation of the RGB to BGR in the channel axis should be fine.
  4. Path from the root is prefered, but it works with relative path as well. It is prefered to use absolute path simply because you can place content, style and generated images in separate folders.

I would also advise you to simply install Mono (instructions for that are in Guide.md) and directly run the script helper program. It is available in the Releases tab of the project here https://github.com/titu1994/Neural-Style-Transfer/releases

This allows easy selection of images, changing of parameters and other things which allow easier use of the script. If there is some problem and it shuts down automatically, then you can copy the command arguments as well and run it in the Terminal

wlxyhy commented 7 years ago

Thank you very much, I'll try it

wlxyhy commented 7 years ago

It does work, but there's a problem: nvcc compiler not found on $PATH. Check your nvcc installation and try again. Is that made the iteration cycle to more than 200 seconds?

titu1994 commented 7 years ago

Have you set up your CUDA path properly? nvcc compiler is contained in the bin folder of your CUDA installation. Usually inside bin folder of the CUDA installation.

Check if the cuda installation is added to your path variable. You need to export PATH=${CUDA_HOME}/bin:${PATH} where CUDA_HOME is the path to your cuda installation. Please read the docs to setup CUDA from here - http://www.r-tutor.com/gpu-computing/cuda-installation/cuda7.5-ubuntu

wlxyhy commented 7 years ago

Thank you, there are still problems, perhaps I should reinstall cuda

titu1994 commented 7 years ago

There is no need to reinstall cuda. Set the cuda path appropriately and it should work.