Image stylization example only produces black images when run on CPU
See original GitHub issueWith tensorflow on master (commit baa85cbf5e51a21f58bc28ef9eedc122e6118eb8). Command run:
CUDA_VISIBLE_DEVICES=-1 bazel-bin/magenta/models/image_stylization/image_stylization_transform --num_styles=32 --checkpoint=$HOME/Downloads/multistyle-pastiche-generator-varied.ckpt --input_image=${INPUT_IMG} --which_styles="[0]" --output_dir=${OUTPUT_FOLDER} --output_basename="stylized"
Everything works as intended when running on GPU with CUDA_VISIBLE_DEVICES=0. Tensorflow wheel built with
bazel build -c opt --copt=-mavx --copt=-mavx2 --copt=-mfma --copt=-mfpmath=both --copt=-msse4.2 --config=cuda //tensorflow/tools/pip_package:build_pip_package
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:12
Top Results From Across the Web
Image stylization example only produces black ... - GitHub
This occurs whether running the program in Docker or in Conda. It occurs on both the CPU and GPU. I'm using Ubuntu 16.04....
Read more >A survey on Image Data Augmentation for Deep Learning
The augmentations listed in this survey are geometric transformations, color space transformations, kernel filters, mixing images, random ...
Read more >18 Impressive Applications of Generative Adversarial ...
Generate Examples for Image Datasets; Generate Photographs of ... Translation of semantic images to photographs of cityscapes and buildings.
Read more >Image loading and performance – Figma Help Center
If you have a lot of high-resolution images in a file, your images may look blurry at first. Figma will load high-resolution images...
Read more >Binary image - Wikipedia
A binary image is one that consists of pixels that can have one of exactly two colors, usually black and white. ... Most...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I am running into this issue as well. To perform image stylization on CPU, it is necessary to install tensorflow 1.0.1 instead of tensorflow 1.1.0
Thanks @panmari for localizing the first occurrence of the issue. The problem is caused by
NaNvalues in the weights ofConv2Dlayers. The reason why the network works on GPU is supposedly because GPU does not have a exception mechanism, soNaNvalues will be converted to zeros. On CPU, however, theNaNis preserved thorough computation.My personal workaround of this issue is the following:
This snippet should be placed every time you load the model into the session. Worked for
tensorflow==1.8.0. Will make a pull request soon onto both tensorflow/magenta and tensorflow/magenta-demos repositories.A more correct solution should be replacing all the weights in the model according to the snippet above (so someone should upload the new weights onto download.magenta.tensorflow.org/models/ upstream).