junyanz / igan Goto Github PK
View Code? Open in Web Editor NEWInteractive Image Generation via Generative Adversarial Networks
License: MIT License
Interactive Image Generation via Generative Adversarial Networks
License: MIT License
I have installed cuda and cudnn, and I run THEANO_FLAGS='device=cpu, floatX=float32, nvcc.fastmath=True' /usr/bin/python iGAN_main.py --model_name outdoor_64
, the error message is:
Traceback (most recent call last):
File "iGAN_main.py", line 41, in <module>
model = model_class.Model(model_name=args.model_name, model_file=args.model_file)
File "/root/iGAN/model_def/dcgan_theano.py", line 27, in __init__
self._gen = self.def_gen(self.gen_params, self.gen_batchnorm, n_layers=self.n_layers, n_f=self.n_f, nc=self.nc)
File "/root/iGAN/model_def/dcgan_theano.py", line 40, in def_gen
gx = gen_test(z, gen_params, gen_pl, n_layers=n_layers, n_f=n_f, nc=nc, use_tanh=False)
File "/root/iGAN/model_def/dcgan_theano.py", line 227, in gen_test
hout = relu(batchnorm(deconv(hin, w, subsample=(2, 2), border_mode=(2, 2)), u=u, s=s, g=g, b=b))
File "/root/iGAN/lib/ops.py", line 95, in deconv
d_img = GpuDnnConvGradI()(kerns, img, out, desc)
File "/usr/local/lib/python2.7/dist-packages/theano/sandbox/cuda/dnn.py", line 838, in __init__
if version() < (4000, 4000):
File "/usr/local/lib/python2.7/dist-packages/theano/sandbox/cuda/__init__.py", line 407, in dnn_version
dnn_available.msg)
Exception: ("We can't determine the cudnn version as it is not available", "Can not compile with cuDNN. We got this error:\nnvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).\n/usr/bin/ld: cannot find -lcudnn\ncollect2: error: ld returned 1 exit status\n")
Theano (0.8.2)
cuda (8.0)
cudnn(5.1)
Thank you!
Hi author
Could you upload the file hed_shoes_64.dcgan_theano again? The previous link is outdated.
Is the model for projecting an image back onto the manifold also packaged with the pre-trained models listed in the README? The code is organized very well and I've been able to use the Model
class in ``dcgan_theano.pyto sample from the downloaded models, but I'm less clear how to do the inverse mapping
x => z` through the projection model and optimization objective.
Hello professor, I saw in an issue a few years ago that you mentioned that there would be a PyTorch version of this code, but a few days ago you replied that there was an iGAN improvement work, do you mean that there will be no PyTorch version of this code? I am very interested in iGAN and want to use it to do some work to complete my study, but Theano has stopped updating. It is not only difficult to read the code, but also incompatible with many versions when reproducing the code. If the PyTorch version of iGAN will be released in the near future, it will save a lot of time for my follow-up work.
Thanks!
If you are interested in image editing and GANs, I would like to share with you our recent project CycleGAN for learning an image-to-image translation (i.e. pix2pix) without input-output pairs. Here are a few applications of the algorithm.
Ubuntu16.04 GTX960 2G
Traceback (most recent call last):
File "iGAN_main.py", line 38, in
model_G = model_class.Model(model_name=args.model_name, model_file=args.model_file)
File "/home/tzatter/iGAN/model_def/dcgan_theano.py", line 24, in init
self._gen = self.def_gen(self.gen_params, self.gen_pl, self.n_layers, self.n_f)
File "/home/tzatter/iGAN/model_def/dcgan_theano.py", line 34, in def_gen
gx = gen_test(z, gen_params, gen_pl, n_layers=n_layers, n_f=n_f)
File "/home/tzatter/iGAN/model_def/dcgan_theano.py", line 319, in gen_test
hout = relu(batchnorm(deconv(hin, w, subsample=(2, 2), border_mode=(2, 2)), u=u, s=s, g=g, b=b))
File "/home/tzatter/iGAN/lib/ops.py", line 90, in deconv
img = gpu_contiguous(X)
File "/usr/local/lib/python2.7/dist-packages/theano/gof/op.py", line 602, in call
node = self.make_node(_inputs, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/theano/sandbox/cuda/basic_ops.py", line 3963, in make_node
input = as_cuda_ndarray_variable(input)
File "/usr/local/lib/python2.7/dist-packages/theano/sandbox/cuda/basic_ops.py", line 46, in as_cuda_ndarray_variable
return gpu_from_host(tensor_x)
File "/usr/local/lib/python2.7/dist-packages/theano/gof/op.py", line 602, in call
node = self.make_node(_inputs, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/theano/sandbox/cuda/basic_ops.py", line 139, in make_node
dtype=x.dtype)()])
File "/usr/local/lib/python2.7/dist-packages/theano/sandbox/cuda/type.py", line 95, in init
(self.class.name, dtype, name))
TypeError: CudaNdarrayType only supports dtype float32 for now. Tried using dtype float64 for variable None
Jun-Yan Zhu, thank you for the awesome code.
As title, I saw the demo in youtube video, but however I can't find any way in GUI to load and image, any ideas?
Thank you for your excellent work. I believe this code will be more readable and extensible if in PyTorch. So will the PyTorch version be released? A link of third-party implementation is also fine, though I cannot find one for now.
Specifically, I'm interested in latent vector prediction and projection section.
I am working in Windows. Could you tell the version of Theano and cudnn that the code will work on. ?
I am running iGAN_main.py
on Windows 10 with an NVIDIA GeForce GTX 980 with the following command
python iGAN_main.py --model_name outdoor_64
and have added the following lines to iGAN_main.py
import os
os.environ["THEANO_FLAGS"] = "device=gpu, floatX=float32, nvcc.fastmath=True"
and I receive the following error
TypeError: CudaNdarrayType only supports dtype float32 for now. Tried using dtype float64 for variable None
I have also added these THEANO_FLAGS to the .theanorc
file and still receive this error. I have upgraded Theano to 0.9. Can someone please help me with this issue? I am happy to provide whatever further information is needed to solve this issue.
Traceback (most recent call last):
File "generate_samples.py", line 32, in
model_class = locate('model_def.%s' % args.model_type)
File "/usr/lib/python2.7/pydoc.py", line 1504, in locate
nextmodule = safeimport(join(parts[:n+1], '.'), forceload)
File "/usr/lib/python2.7/pydoc.py", line 341, in safeimport
raise ErrorDuringImport(path, sys.exc_info())
pydoc.ErrorDuringImport: problem in model_def.dcgan_theano - <type 'exceptions.ImportError'>: cannot import name raise_from
This is the error, I am getting. It would be great if you could help me out here.
When I run this python,
THEANO_FLAGS='device=cpu, floatX=float32, nvcc.fastmath=True' python iGAN_main.py --model_name outdoor_64
I got this error.
Traceback (most recent call last):
File "iGAN_main.py", line 40, in
model_class = locate('model_def.%s' % args.model_type)
File "/usr/lib/python2.7/pydoc.py", line 1521, in locate
nextmodule = safeimport(join(parts[:n+1], '.'), forceload)
File "/usr/lib/python2.7/pydoc.py", line 342, in safeimport
raise ErrorDuringImport(path, sys.exc_info())
pydoc.ErrorDuringImport: problem in model_def.dcgan_theano - <type 'exceptions.ImportError'>: No module named cuda.dnn
I already installed CUDA and cuDNN.
How can I run this code?
Thank you.
Hi :) Thankyou for this repo!
Can I run the system on CPU alone?
If so, what are the necessary changes required?
I have tried changing the default config variables through THEANO_FLAGS - "device=cpu" and "config.device=cpu". But I get below issue. Is there a workaround to not use cudnn?
"Exception: ("We can't determine the cudnn version as it is not available", 'CUDA not available')"
Hi!
Could you explain in detail the Motion+Color flow algorithm?
If there is a corresponding code that would be cool!
This is great stuff!
The README.md mentioned that there is a plan to support variational autoencoder, which I very much look forward to. My understanding is that the vanilla VAE tends to create blurry images (perhaps due to the disentangled representation that it learns), and I wonder if the planned VAE feature will be based on the vanilla VAE, or something like the autoencoding beyond pixels, or adversarial autoencoders?
I am trying to create my own dataset. I created the hdf5 file using the given script on the Readme, and now I want to launch the train_dcgan.py file on the hdf5 file. I also defined the model parameters in train_dcgan_config.py.
This is what I get after computing (hdf5 file's name is mickey_64) :
[model_name] = mickey_64
[ext] =
[data_file] = ../datasets/mickey_64.hdf5
[cache_dir] = ./cache/mickey_64/
[batch_size] = 128
[update_k] = 2
[save_freq] = 1
[lr] = 0.0002
[weight_decay] = 1e-05
[b1] = 0.5
./cache/mickey_64/web_dcgan/images
LOADING DATASET...
name = ../datasets/mickey_64.hdf5, ntrain = 884, ntest = 46
0.01 secs to load data
Traceback (most recent call last):
File "train_dcgan.py", line 66, in
vis_idxs = py_rng.sample(np.arange(len(test_x)), n_vis)
File "/home/aeon7/anaconda3/lib/python3.6/random.py", line 313, in sample
raise TypeError("Population must be a sequence or set. For dicts, use list(d).")
TypeError: Population must be a sequence or set. For dicts, use list(d).
I don't understand where this error comes from.
hi, i'm running this command after I have installed everything
iGAN2noui A$ THEANO_FLAGS='device=gpu0, floatX=float32, nvcc.fastmath=True' python iGAN_main.py --model_name outdoor_64
and get this error. everything is installed as you described. i tried it on macos and ubuntu. same error.
Traceback (most recent call last):
File "iGAN_main.py", line 4, in <module>
import qdarkstyle
ImportError: No module named qdarkstyle
when I run your code, there is an error:
ImportError Traceback (most recent call last)
in ()
5
6 from theano.sandbox.cuda.dnn import dnn_conv
----> 7 from lib import activations
8 from lib import inits
9 from lib.ops import batchnorm, deconv
ImportError: cannot import name activations
what can I do to solve this? sorry to bother you with such a simple question but I am a new one, coud you please help me ?
Can you help me to package a program, running on Windows?
If so, how would one do that?
The dataset link is not found. (https://people.eecs.berkeley.edu/~junyanz/projects/gvm/datasets/$FILE.zip)
Would you please give a new URL link?
ThinkPad R400 with ArchLinux
my GPU is AMD rather than Nvidia.
when I exec
THEANO_FLAGS='device=gpu0, floatX=float32, nvcc.fastmath=True' python iGAN_main.py --model_name outdoor_64'
It says:
Traceback (most recent call last):
File "iGAN_main.py", line 9, in <module>
import constrained_opt
File "/home/konjac/code/iGAN/constrained_opt.py", line 3, in <module>
from lib.rng import np_rng
File "/home/konjac/code/iGAN/lib/rng.py", line 2, in <module>
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
File "/usr/lib/python3.6/site-packages/theano/__init__.py", line 67, in <module>
from theano.configdefaults import config
File "/usr/lib/python3.6/site-packages/theano/configdefaults.py", line 113, in <module>
in_c_key=False)
File "/usr/lib/python3.6/site-packages/theano/configparser.py", line 285, in AddConfigVar
configparam.__get__(root, type(root), delete_key=True)
File "/usr/lib/python3.6/site-packages/theano/configparser.py", line 333, in __get__
self.__set__(cls, val_str)
File "/usr/lib/python3.6/site-packages/theano/configparser.py", line 344, in __set__
self.val = self.filter(val)
File "/usr/lib/python3.6/site-packages/theano/configdefaults.py", line 100, in filter
% (self.default, val, self.fullname)))
ValueError: Invalid value ("cpu") for configuration variable "gpu0". Valid options start with one of "device", "opencl", "cuda"
What should I do to solve this?
Is it caused because of my gpu brand? So is it possible to run this app on amd gpu?
Why I cannot find the code about flow in project?
Since it says learning shape and color is very important which is objective 6 in your this paper.
When I run this script, the following error happens:
File "train_predict_z.py", line 19, in
from lib import AlexNet
File "../lib/AlexNet.py", line 1, in
from lasagne.layers import InputLayer, Conv2DLayer
File "/home/atlantix/.local/lib/python2.7/site-packages/lasagne/init.py", line 19, in
from . import layers
File "/home/atlantix/.local/lib/python2.7/site-packages/lasagne/layers/init.py", line 7, in
from .pool import *
File "/home/atlantix/.local/lib/python2.7/site-packages/lasagne/layers/pool.py", line 6, in
from theano.tensor.signal import downsample
ImportError: cannot import name downsample
I'm sure the version of theano and lasagne is the latest. And I have tried to reinstall lasagne but the error is still there. Is lasagne not working?
Thanks.
I am trying to train my own data set. For starting I prepared 1000 pictures and made an hdf5 file based on 64*64. After that I ran the train_dcgan.py file I had an error and I had to modify the n_vis parameter manually to 10 in train_dcgan.py to get it work. But after that I had a new error which I have paste it here:
Traceback (most recent call last):
File "train_dcgan.py", line 71, in
grid_real = utils.grid_vis((vaX_vis*255.0).astype(np.uint8), n_grid, n_grid)
File "../lib/utils.py", line 138, in grid_vis
img[j * h:j * h + h, i * w:i * w + w, :] = x
ValueError: could not broadcast input array from shape (64,64,3) into shape (0,64,3)
I would be very appreciated if you have any suggestions.
What would you recommend for someone who's running this code now? What should I install?
I am asking this because theano backend has been changed and on running the given code now, I am getting numerous errors related to the same.
Do give some suggestions in this matter.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.