Giter Club home page Giter Club logo

adaptive-style-transfer's Introduction

A Style-Aware Content Loss for Real-time HD Style Transfer

Artsiom Sanakoyeu*, Dmytro Kotovenko*, Sabine Lang, Björn Ommer, In ECCV 2018 (Oral)

Website: https://compvis.github.io/adaptive-style-transfer
Paper: https://arxiv.org/abs/1807.10201

pipeline

example Please click on the image for a high-res version.

Requirements

  • python 2.7
  • tensorflow 1.2.
  • PIL, numpy, scipy
  • tqdm

Also tested in python3.6 + tensorflow 1.12.0

Inference

Simplest van Gogh example

To launch the inference on van Gogh style:

  1. Download the pretrained model model_van-gogh_ckpt.tar.gz
  2. Download sample photographs.
  3. Extract the model to ./models/ folder and sample photographs to ./data/ folder.
  4. Run the following command:
CUDA_VISIBLE_DEVICES=0 python main.py \
                 --model_name=model_van-gogh \
                 --phase=inference \
                 --image_size=1280

Stylized photographs are stored in the folder ./models/model_van-gogh/inference_ckpt300000_sz1280/

Additional settings

  • --ii_dir INPUT_DIR - path to the folder containing target content images.
    You can specify multiple folders separated with commas (don't use spaces!).
  • --image_size SIZE - resolution of the images to generate.
  • --save_dir SAVE_DIR - path to the output dir where the generated images will be saved.
  • --model_name NAME - the name of the model (all model should as subfolders in ./models/).

Usage example (inference):

CUDA_VISIBLE_DEVICES=0 python main.py \
                 --model_name=model_van-gogh \
                 --phase=inference \
                 --image_size=1280 \
                 --ii_dir ../my_photographs1/,../my_photographs2/ \
                 --save_dir=../save_processed_images_here/

If your GPU memory is not large enough, set the variable CUDA_VISIBLE_DEVICES="" to use CPU.

Pretrained models

We provide pretrained models for the following artists:
Paul Cezanne,
El-Greco,
Paul Gauguin,
Wassily Kandinsky (Василий Кандинский),
Ernst Ludwig Kirchner,
Claude Monet,
Berthe Morisot,
Edvard Munch,
Samuel Peploe,
Pablo Picasso,
Jackson Pollock,
Nicholal Roerich (Николай Рерих),
Vincent van Gogh.

Download pretrained models: link.
Extract models to the folder ./models/.

Training

Content images used for training: Places365-Standard high-res train mages (105GB).

Style images used for training the aforementioned models: [download link](https://

cloud.iwr.uni-heidelberg.de/index.php/s/NcJj2oLBTYuT1tf).
Query style examples used to collect style images: query_style_images.tar.gz.

  • For example, Vincent van Gogh style: vincent-van-gogh_road-with-cypresses-1890.tar.gz.
    This is the dataset representing a particular artistic period of Vincent van Gogh and was automatically collected using "Road with Cypress and Star, 1890" painting as query.
  1. Download and extract style archives in folder ./data.
  2. Download and extract content images.
  3. Launch the training process (for example, on van Gogh):
CUDA_VISIBLE_DEVICES=1 python main.py \
                 --model_name=model_van-gogh_new \
                 --batch_size=1 \
                 --phase=train \
                 --image_size=768 \
                 --lr=0.0002 \
                 --dsr=0.8 \
                 --ptcd=/path/to/Places2/data_large \
                 --ptad=./data/vincent-van-gogh_road-with-cypresses-1890

Evaluation

How to calculate Deception Score and where to download artist classification model is described in evaluation.

Video stylization

To stylize a video you can use the following script:

# split video on a set of frames
ffmpeg -i myvideo.mp4 -r 25 -f image2 image-%04d.png

CUDA_VISIBLE_DEVICES=0 python main.py \
--model_name=model_van-gogh \
--phase=inference \
--image_size=1280 \
--ii_dir=input \
--save_dir=output

# reassemble the video back from frames:
ffmpeg -i image-%04d_stylized.jpg kktie-out.mp4

Reference

If you use this code or data, please cite the paper:

@inproceedings{sanakoyeu2018styleaware,
  title={A Style-Aware Content Loss for Real-time HD Style Transfer},
  author={Sanakoyeu, Artsiom and Kotovenko, Dmytro and Lang, Sabine and Ommer, Bj{\"o}rn},
  booktitle={Proceedings of the European Conference on Computer Vision (ECCV)},
  pages={698--714},
  month = 10,
  year={2018}
}

Copyright

Adaptive Style Transfer  
Copyright (C) 2018  Artsiom Sanakoyeu, Dmytro Kotovenko  

Adaptive Style Transfer is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

adaptive-style-transfer's People

Contributors

asanakoy avatar christopher-schroeder avatar dimakot55 avatar rickdotta avatar zh-plus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adaptive-style-transfer's Issues

About the transformer block

Thank you for your excellent job about the style-transfer. I am a little puzzled about the transformer block of this paper which is different from the code. Why doesn't adopt the fully convolutional neural network?

There are some problems to puzzle me? I hope you can explain these, please.

There are some problems as follows.

  1. In the line 177 of "model.py", I think that self.gener_loss should be divided by float(len(scale_weight.keys())). Thus we have the whole average value of the generator. Note that self.gener_acc also gets its mean value by this way. In addition, the discriminator has the same problem in the line 149, self.discr_loss should be divided by float(len(scale_weight.keys())*3).

  2. How do every random batch_size work?
    I think initialize_batch_worker(*) in “prepare_dataset.py” put training data into a queue continuously. Then q_art.get() in “model.py” get training data. The training process of a batch size is finished, and then it continue to repeat the previous process. However, I don't know whether this understanding is correct.

I appreciate your work. I'm very grateful for your help.

Receiving blue-colored mess as result from example

Feels very weird, as the process runs without errors (almost), and the result goes as expected,
except that the resulting images look like this (regardless of selected style):

Places365_val_00010478_stylized

This is what the terminal shows:

(env-Adaptive) deep2@deep2:~/Desktop/style-adaptive$ CUDA_VISIBLE_DEVICES=0 python main.py --model_name=model_van-gogh --phase=inference --image_size=200 --ii_dir=./images/ --save_dir=./images_results/
2019-10-30 17:18:26.154269: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2019-10-30 17:18:26.154290: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2019-10-30 17:18:26.154294: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2019-10-30 17:18:26.154298: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
2019-10-30 17:18:26.154301: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
Inference.
Start inference.
 [*] Reading latest checkpoint from folder ./models/model_van-gogh/checkpoint.
 [*] Reading latest checkpoint from folder ./models/model_van-gogh/checkpoint_long.
 [!] Load failed...
100%|██████████| 32/32 [00:10<00:00,  2.97it/s]
Inference is finished.

I'm on: Ubuntu 18.04, python 2.7, tensorflow 1.2.

Training finished but my stylized images came out black

Thank you for providing this! I was able to apply your pre-trained models on different images successfully on my Ubuntu 16.04 machine using CUDA 9.1 and CuDNN 7. It looked really beautiful. However, I ran into an issue when I trained the model on my own dataset of styles (10 images). It took around a week to finish and when I finally applied my trained model, the images came out black. There was no style at all. I have a few thoughts on what went wrong possibly but I would really appreciate if you can help point me in the right direction.

This is what what I got in my terminal when the training finished (I stitched the image together so a bit of the middle part is missing):

error

At the top, it says "Your CPU supports instructions that this Tensorflow binary was not compiled to use" and at the bottom is says "Load Failed". My Tensorflow version is 1.7. Could this be the issue? I'm not quite sure what "Load failed" means or what it is talking about. I just wanna point out the issue now before I start training for another week.

This is the stylized folder that came out all black:

screen shot 2018-11-01 at 10 52 28 am

training a new model gives bad style output

I try to train a Leonid Afremov style. [check on Google to see his particular style of painting vivid color paintings with knife instead of brush...]

I have 47 training style image each input is roughly about 500kB .
Here is an overview of the training sample : https://ibb.co/y8nVrxF
And of course I downloaded the 112GB training large place sample.

Even after many steps I still do not recognize the style of Afremov even at 75% of the training phase. The results do not look like Afremov style.

For instance:

Step_224500.jpg
https://ibb.co/H7h96Vf

Step_223500.jpg
https://ibb.co/8NLcH1h

Here is how I run the training model:

#!/bin/sh
CUDA_VISIBLE_DEVICES=0 python main.py \
                 --model_name=model_Afremov_new \
                 --batch_size=1 \
                 --phase=train \
                 --image_size=768 \
                 --lr=0.0002 \
                 --dsr=0.8 \
                 --ptcd=/<myOwnPath>/data_large \
                 --ptad=./data/art_afremov

Does someone has any recommendation to give me?

Colab 2023?

Hello, Anyone have this running in colab these days? I ran into some issues with current versions of tensorflow, wondering if any has solved them? Thanks!

python 3 version?

Hello, Been running this lovely code in google colab. However, python 2 is going away this month, and there are various dependencies (around scipy.misc.imread, for example) that cause issues in python 3.

Does anyone already have a version of this code working under python 3?

About how to calculate deception score for our own model of our own style dataset

I can evaluate the new models of the artists mentioned in github page, based on evaluation data provided by the authors. But I wonder how to calculate deception score for new models of new styles, for example, I collect a data set on ink painting, and made a new model of ink painting. For this case, how can I calculate deception score for the new model of ink painting ?

Thank you so much for your comments.

Why is the style-aware content loss inconsistent in your paper and program?

Hi, excuse me. I have a problem, and hope you to help me, please.

In your paper, you define a style-aware content loss as normalized squared 

Euclidean distance between E(xi) and E(yi) in the formula (3).

However, in your program "model.py", it use L1 norm for a style-aware content loss. For instance,
self.feature_loss_photo = abs_criterion(self.output_photo_features, self.input_photo_features)

Thank you for your help!

Multiple GPU training not working on AWS instances

Hi guys, thank you for sharing this fantastic project! I'm using AWS g3 instance for training with 2 x Tesla M60 cards, looks like the training is not utilizing both cards at the same time.

Arguments:
CUDA_VISIBLE_DEVICES=0,1 python main.py --model_name=model_van-gogh --phase=inference --image_size=1280 --ii_dir=./samples/ --save_dir=./output/

One of the cards is 100% utilized while the other one remains unused.

documen 2018-12-19 16-46-16

How do resolve a problem of the discriminater?

Hi, I find a problem as follows when I test your program. I hope your help. Thank you very much.

Traceback (most recent call last):
File "main.py", line 149, in
tf.app.run()
File "D:\ProgramData\Anaconda3\envs\Tensorflow\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run
_sys.exit(main(argv))
File "main.py", line 129, in main
model = Artgan(sess, args)
File "G:\adaptive-style-transfer-master\model.py", line 68, in init
self._build_model()
File "G:\adaptive-style-transfer-master\model.py", line 133, in _build_model
tf.add_n(self.input_photo_discr_loss.values()) +
File "D:\ProgramData\Anaconda3\envs\Tensorflow\lib\site-packages\tensorflow\python\ops\math_ops.py", line 2154, in add_n
raise ValueError("inputs must be a list of at least one"
ValueError: inputs must be a list of at least oneTensor/IndexedSlices with the same dtype and shape

could we apply style-transfer to image deformation?

I'm sorry to bother you,but I have a question on could we apply style-transfer to image deformation.

In style-transfer,we usually provide a content image and a style image to generate results.And now,could we give a content picture,and let it transform into a warpping image?If the answer is yes,what is the style image?How could we get the style image?

Here are two pictures:one is the original picture,and the other is the transformed image.
before
after

I would very appreciate if you could help me,thank you!

Training isn't working as expected

[] Reading latest checkpoint from folder ./models\model_van-gogh_new\checkpoint.
[] Reading latest checkpoint from folder ./models\model_van-gogh_new\checkpoint_long.
[!] Load failed...
0%| | 0/300000 [00:00<?, ?it/s]

No output, please advise.

Tensorflow version upgrade

Hi :)

First, I really enjoy this library and what I can do with it.
I was wondering if by any chance, you had ported this code to Tensorflow 2.x ??
best regards

About the style image grouping.

In the paper, you have mentioned a VGG16 network C used for Style Image Grouping.Is the pretrained model available?Many thanks.

Training image volume

How are the results if training on less than 100 GB of images?

If reasonable, is it possible to get an archive of some sampled set (5-10%) of these images from somewhere? The 100 GB of images (which appears to require specific directory structure of the images, not otherwise available in the usual Places365 download) is prohibitively large (both to download & train!) for some setups.

Cheers

About GPU memory leak

Does anyone encounter the following error on "CUDA_ERROR_ILLEGAL_ADDRESS" ?
I have changed multiprocessing to single process, but the same problem happened.

My GPU is GeForce RTX 2080 8GB (driver: 440.33.01), and
tensorflow: 1.12.0
cuda: 9.0
cudnn: 7.5.0

Training command is like this way:
CUDA_VISIBLE_DEVICES=0 python main.py
--model_name=model_roerich
--batch_size=1
--phase=train
--image_size=768
--lr=0.0002
--dsr=0.8
--ptcd=./data/Places2/data_large
--ptad=./data/artist/nicholas-roerich

Finally, the error message are:
tensorflow::CurrentStackTrace()
stream_executor::cuda::CUDADriver::SynchronizeContext(stream_executor::cuda::CudaContext*)
stream_executor::StreamExecutor::SynchronizeAllActivity()
tensorflow::GPUUtil::SyncAll(tensorflow::Device*)
tensorflow::BaseGPUDevice::Sync()

Eigen::NonBlockingThreadPoolTempl<tensorflow::thread::EigenEnvironment>::WorkerLoop(int)
std::_Function_handler<void (), tensorflow::thread::EigenEnvironment::CreateThread(std::function<void ()>)::{lambda()#1}>::_M_invoke(std::_Any_data const&)


clone

*** End stack trace ***

2020-01-26 00:10:03.045956: E tensorflow/stream_executor/event.cc:34] error destroying CUDA event in context 0x5402c10: CUDA_ERROR_ILLEGAL_ADDRESS: an illegal memory access was encountered
Traceback (most recent call last):
File "/home/username/.local/share/virtualenvs/adaptive-style-transfer-PbxNnQ9W/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1334, in _do_call
return fn(*args)
File "/home/username/.local/share/virtualenvs/adaptive-style-transfer-PbxNnQ9W/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1319, in _run_fn
options, feed_dict, fetch_list, target_list, run_metadata)
File "/home/username/.local/share/virtualenvs/adaptive-style-transfer-PbxNnQ9W/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1407, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.InternalError: GPU sync failed

Links appear to be down

Just wanted to post in case this is still maintained, the links to the hcicloud download for the pertained models, style images and datasets all look down. I checked on two browsers and a direct wget with connection timing out.

taining problem

After start:
Limit: 3210821632
InUse: 3142544896
MaxInUse: 3166815232
NumAllocs: 1714
MaxAllocSize: 688914432
Then the system show that :
Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.

BrokenPipeError: [Errno 32] Broken pipe

Using python main.py --model_name=my_artist --batch_size=1 --phase=train --image_size=256 --lr=0.0002 --dsr=0.8 --ptcd="E:/data/data_256/" --ptad="E:/style/" I get

Art dataset contains 137 images.
Traceback (most recent call last):
  File "main.py", line 149, in <module>
    tf.app.run()
  File "E:\Anaconda\envs\tensorflow\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run
    _sys.exit(main(argv))
  File "main.py", line 132, in main
    model.train(args, ckpt_nmbr=args.ckpt_nmbr)
  File "E:\model.py", line 271, in train
    p.start()
  File "E:\Anaconda\envs\tensorflow\lib\multiprocessing\process.py", line 105, in start
    self._popen = self._Popen(self)
  File "E:\Anaconda\envs\tensorflow\lib\multiprocessing\context.py", line 212, in _Popen
    return _default_context.get_context().Process._Popen(process_obj)
  File "E:\Anaconda\envs\tensorflow\lib\multiprocessing\context.py", line 313, in _Popen
    return Popen(process_obj)
  File "E:\Anaconda\envs\tensorflow\lib\multiprocessing\popen_spawn_win32.py", line 66, in __init__
    reduction.dump(process_obj, to_child)
  File "E:\Anaconda\envs\tensorflow\lib\multiprocessing\reduction.py", line 59, in dump
    ForkingPickler(file, protocol).dump(obj)
BrokenPipeError: [Errno 32] Broken pipe

BTW: I am using the smaller image collection with 256 pixel images.

Yet the cursor keeps blinking but the CPU is not being used according to the Task-Manager. Will it continue later, does it need code fixing?

failed to train model

thanks for your great job, I'm running the code and it worked well for style transfer with the models, but when I tried to train on my model, I got this error:
I don't have any experience in coding, I'm just interested in style transfer.
I would be more than happy if you help me on this


F:\NeuralStyleTransfers\adaptive-style-transfer-master_2\adaptive-style-transfer-master>python main.py --model_name=Farshchiyan_First_Style --batch_size=1 --phase=train --image_size=768 --lr=0.0002 --dsr=0.8 --ptcd=./TrainData/train2014 --ptad=./data/Farshchiyan_first_Style
2018-09-08 13:40:17.233262: I T:\src\github\tensorflow\tensorflow\core\platform\cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2018-09-08 13:40:17.630972: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1405] Found device 0 with properties:
name: GeForce GTX 1080 major: 6 minor: 1 memoryClockRate(GHz): 1.86
pciBusID: 0000:01:00.0
totalMemory: 8.00GiB freeMemory: 6.61GiB
2018-09-08 13:40:17.837224: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1405] Found device 1 with properties:
name: GeForce GTX 1070 major: 6 minor: 1 memoryClockRate(GHz): 1.7845
pciBusID: 0000:02:00.0
totalMemory: 8.00GiB freeMemory: 6.64GiB
2018-09-08 13:40:17.978312: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1405] Found device 2 with properties:
name: GeForce GTX 1070 major: 6 minor: 1 memoryClockRate(GHz): 1.7845
pciBusID: 0000:06:00.0
totalMemory: 8.00GiB freeMemory: 6.64GiB
2018-09-08 13:40:17.981198: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1484] Adding visible gpu devices: 0, 1, 2
2018-09-08 13:40:20.650595: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:965] Device interconnect StreamExecutor with strength 1 edge matrix:
2018-09-08 13:40:20.653751: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:971] 0 1 2
2018-09-08 13:40:20.655384: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:984] 0: N N N
2018-09-08 13:40:20.657080: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:984] 1: N N N
2018-09-08 13:40:20.658863: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:984] 2: N N N
2018-09-08 13:40:20.661335: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1097] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 6372 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1080, pci bus id: 0000:01:00.0, compute capability: 6.1)
2018-09-08 13:40:20.681136: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1097] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:1 with 6403 MB memory) -> physical GPU (device: 1, name: GeForce GTX 1070, pci bus id: 0000:02:00.0, compute capability: 6.1)
2018-09-08 13:40:20.699847: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1097] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:2 with 6403 MB memory) -> physical GPU (device: 2, name: GeForce GTX 1070, pci bus id: 0000:06:00.0, compute capability: 6.1)
Traceback (most recent call last):
File "main.py", line 149, in
tf.app.run()
File "C:\Users\rohollah\Anaconda3\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run
_sys.exit(main(argv))
File "main.py", line 129, in main
model = Artgan(sess, args)
File "F:\NeuralStyleTransfers\adaptive-style-transfer-master_2\adaptive-style-transfer-master\model.py", line 68, in init
self._build_model()
File "F:\NeuralStyleTransfers\adaptive-style-transfer-master_2\adaptive-style-transfer-master\model.py", line 133, in _build_model
tf.add_n(self.input_photo_discr_loss.values()) +
File "C:\Users\rohollah\Anaconda3\lib\site-packages\tensorflow\python\ops\math_ops.py", line 2118, in add_n
raise ValueError("inputs must be a list of at least one Tensor with the "
ValueError: inputs must be a list of at least one Tensor with the same dtype and shape


It seems training will collapse when applying another Dataset

I have trained the model using another content dataset with the given styles images of Monet, but it seems it will soon collapse and output entirely black stylized images.
I've tried discarding the image augmentation process and scipy.misc.imresize(), but it still can not work with this content dataset (150,000 jpg images with generally 1800+ pixels).
Would you please give me some tips or suggestions about this issue? Such as trying another learning rate/discriminator success rate.
Thanks for your time in advance.

Training seems to collapse after 38,000 iterations

Hi all,

First of all I want o congratulate you for your amazing work on style transfer :) I am currently training with your code in order to be able to generate semi-realistic images from simulated ones.

I am training with a Nvidia Tesla K80, and I see the following after certain iterations:

step_36500
Iteration 36500

step_37000
Iteration 37000

step_37500
Iteration 37500

step_38000
Iteration 38000

step_38500
Iteration 38500

Is this normal? Do you have any suggestion? It worth mention that I am filling the Places2 dataset with my own data (only in the folder /a/abbey). Thanks in advance.

Still runnable in Colab?

I'm not able to run it on Colab.

From the command
!CUDA_VISIBLE_DEVICES=0 python main.py
--model_name=model_pollock
--phase=inference
--image_size=512
--ii_dir=./seed0168.png
--save_dir=./out

I'm getting
[...]

Start inference.
[] Reading latest checkpoint from folder ./models/model_pollock/checkpoint.
[
] Reading latest checkpoint from folder ./models/model_pollock/checkpoint_long.
Load checkpoint model10_pollock_bks10_flw100_300000.ckpt-300000. Initial step: 300000.
INFO:tensorflow:Restoring parameters from ./models/model_pollock/checkpoint_long/model10_pollock_bks10_flw100_300000.ckpt-300000
I1031 15:09:23.577128 140008567285632 saver.py:1284] Restoring parameters from ./models/model_pollock/checkpoint_long/model10_pollock_bks10_flw100_300000.ckpt-300000
[*] Load SUCCESS
0it [00:00, ?it/s]
Inference is finished.

Here is the Colab Notebook

Prediction Works, but Training Fails at Startup

Hi. I am trying to run your example commands from the README file and the prediction is working perfectly. Yet, when I attempt to run your training example, the script crashes at startup:

Traceback (most recent call last): File "main.py", line 149, in tf.app.run() File "C:\Users\j-cardoso\AppData\Local\Continuum\anaconda2\envs\Python 3.6\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run _sys.exit(main(argv)) File "main.py", line 129, in main model = Artgan(sess, args) File "C:\Users\j-cardoso\Documents\adaptive-style-transfer\model.py", line 68, in init self._build_model() File "C:\Users\j-cardoso\Documents\adaptive-style-transfer\model.py", line 133, in _build_model tf.add_n(self.input_photo_discr_loss.values()) + \ File "C:\Users\j-cardoso\AppData\Local\Continuum\anaconda2\envs\Python 3.6\lib\site-packages\tensorflow\python\ops\math_ops.py", line 2118, in add_n raise ValueError("inputs must be a list of at least one Tensor with the " ValueError: inputs must be a list of at least one Tensor with the same dtype and shape

Any idea why this is happening? I downloaded the van-gogh image set and the places365_standard database.

training problem:IndexError: Cannot choose from an empty sequence

when I train using small content dataset, the system puts forward" IndexError: Cannot choose from an empty sequence".

Process Process-1: ValueError: number of bits must be greater than zero:
IndexError: Cannot choose from an empty sequence

Process Process-3:
ValueError: number of bits must be greater than zero;
IndexError: Cannot choose from an empty sequence;

Process Process-7:
ValueError: number of bits must be greater than zero;
IndexError: Cannot choose from an empty sequence;
Processes are started.

Process Process-9:
raise IndexError('Cannot choose from an empty sequence')
IndexError: Cannot choose from an empty sequence

Start training.
[] Reading latest checkpoint from folder ./models\model_van-gogh_new\checkpoint.
[
] Reading latest checkpoint from folder ./models\model_van-gogh_new\checkpoint_long.
[!] Load failed...
0%| | 0/300000 [00:00<?, ?it/s]

Then the train process is always like the lines above.

I don't know the causing problem.

multiple process aren't terminated

Hi,
Thank you for a very nice work.
I have noticed that after the training is over, the multiple processes aren't terminated.
Lines 370-372 in model.py:
for p in jobs:
p.join()
p.terminate()

I have "solved" the issue by masking the p.join() line but I guess this is not the optimal solution.
Can fix the issue?

authorize information

Hi,
thanks for your great work and source code!!!

download link of style images needs authorize information, would you like to offer this?

Problem when inference with the model converted to pb

Hi, I find this project very interesting, so I hope to deploy this on web (non-commercial use) for people to have fun with this.
After I convert the model to pb, the inference doesn't work. It shows Input 0 of node encoder/g_e0_bn/scale/Assign_1 was passed float from encoder/g_e0_bn/scale_1:0 incompatible with expected float_ref

I don't know much about tensorflow, or AI. I'm not sure if I did this persistence right.
Appreciating for anyone that could help.

How to I make bigger pictures work on smaller gpus?

Given my gpu memory is too small to output images bigger than about 640 pixels, I tried splitting and reassembling a bigger image. Yet this doesn't work seamlessly and there is overall color variation. Which makes a nice effect, but how to I make bigger pictures work ie

  1. by using split images
  2. by using one big image

?

0it [00:00, ?it/s]

Hello.
I am using anaconda with this framework.
After following your tutorial, I get a confusing and surprisingly quick success message:

2018-11-01 00:55:38.924518: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1411] Found device 0 with properties:
name: GeForce GTX 960 major: 5 minor: 2 memoryClockRate(GHz): 1.1775
pciBusID: 0000:01:00.0
totalMemory: 2.00GiB freeMemory: 1.63GiB
2018-11-01 00:55:38.930547: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1490] Adding visible gpu devices: 0
2018-11-01 00:55:39.977549: I tensorflow/core/common_runtime/gpu/gpu_device.cc:971] Device interconnect StreamExecutor with strength 1 edge matrix:
2018-11-01 00:55:39.981657: I tensorflow/core/common_runtime/gpu/gpu_device.cc:977]      0
2018-11-01 00:55:39.983617: I tensorflow/core/common_runtime/gpu/gpu_device.cc:990] 0:   N
2018-11-01 00:55:39.985727: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1103] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 1380 MB memory) -> physical GPU (device: 0, name: GeForce GTX 960, pci bus id: 0000:01:00.0, compute capability: 5.2)
Inference.
Start inference.
 [*] Reading checkpoint 150000 from folder ./models\model_kandinsky\checkpoint_long.
Load checkpoint model9_kandinsky_bks10_flw100_150000.ckpt-150000. Initial step: 150000.
 [*] Load SUCCESS
0it [00:00, ?it/s]
Inference is finished.

Especially the 0it [00:00, ?it/s] is confusing.

How do I debug from here?

When will video feature work?

Don't know if I'm allowed to make an issue out of this but I'd like to know if the video feature will work anytime soon, if there is anything (simple) I can help with I'd be glad to!

the hyperparameter prolblem about the other datasets

hello, I am very instrested in you excellent job about the style transfer of ECCV2018. but I am puzzled about the hyperparameter of the other style datasets such as gauguin, kandinsky,picasso,cezanne。I have trained the model on these style datasets,but the result is diffierent .could you help me a lot? Thank you very much.!

How to solve this problem on Tensorflow2.2?

TypeError: Tensors in list passed to inputs of 'MergeSummary' Op have types[bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool] that do not match expected type string.

accuracy calculation

x=(pred > tf.ones_like(pred)*0.5)
I think this is an error as pred is not the output of sigmoid.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.