tdeboissiere / deeplearningimplementations Goto Github PK
View Code? Open in Web Editor NEWImplementation of recent Deep Learning papers
License: MIT License
Implementation of recent Deep Learning papers
License: MIT License
It seems that tf.contrib.layers.batch_norm(..., updates_collections=None) automatically updates the bn's parameters. If updates_collections is not None, you should manually conduct the update operations.
The Readme states that the Eve class can simply be copied to the keras sources. Therefore I'd suggest that @tdeboissiere opens a PR to keras =)
The approximate Wasserstein loss you define is:
def wasserstein(y_true, y_pred):
return K.mean(y_true * y_pred)
But in the paper (Algorithm 1) they optimize:
Where x is the batch of real images, z is the noise input to the generator g, and f is the critic.
Your objective seems to function just fine, since the network clearly learns well. I'm confused where the multiplication is coming from though. Could you explain that part of your code?
Traceback (most recent call last):
File "main.py", line 81, in
launch_training(**d_params)
File "main.py", line 11, in launch_training
train_WGAN.train(**kwargs)
File "/home/ubuntu/work/DeepLearningImplementations/WassersteinGAN/src/model/train_WGAN.py", line 47, in train
X_real_train = data_utils.load_image_dataset(dset, img_dim, image_dim_ordering)
File "../utils/data_utils.py", line 94, in load_image_dataset
X_real_train = load_celebA(img_dim, image_dim_ordering)
File "../utils/data_utils.py", line 83, in load_celebA
X_real_train = normalization(X_real_train, image_dim_ordering)
File "../utils/data_utils.py", line 14, in normalization
X = X / 255.
MemoryError
@4g @AlexanderFabisch @LaurentMazare @IanQS @tdeboissiere I anew in this area but i just ask can i use the discriminator network as features extractor for every image in data set then passed this features to classifier algorithm?
Why do you use categorical cross-entropy for loss function of categorical latent code in InfoGAN? The paper uses lower bound of mutual information (entropy minus conditional entropy), i.e.:
I(c, G(z,c)) = H(c) - H(c | G(z,c))
But cross-entropy H(c, Q(c | G(z,c))) between input and output latent codes instead of conditional entropy seems to me it's not correct.
Hi,
I tried to use the WGAN on mnist, with cmd
python main.py --backend=tensorflow --generator deconv --use_mbd
After several epochs, the G_loss and D_loss are both negative value and very close to zero (e.g. -8.7654*e-7)
And the generated pictures have mode-missing issue.
Do you have a workable parameter for mnist dataset?
Hi Thibault,
Thanks for sharing the Densenet code. If I want to leverage this architecture for semantic segmentation work, do you have any suggestions? My preliminary thought is to add deconvolutional braches, while treating the current densenet as the feature encoding part. Thanks.
I am so grateful for you sharing the codes. I am afraid that your notes on "nb_epoch"and "n_batch_per_epoch" may be just mistaken. It is a small mistake.
The readme file and main.py in ...\WassersteinGAN\src\model..
readme:
--nb_epoch NB_EPOCH Number of batches per epoch
--batch_size BATCH_SIZE
Batch size
--n_batch_per_epoch N_BATCH_PER_EPOCH
Number of training epochs
main.py
parser.add_argument('--nb_epoch', default=400, type=int, help="Number of batches per epoch")
parser.add_argument('--batch_size', default=32, type=int, help='Batch size')
parser.add_argument('--n_batch_per_epoch', default=200, type=int, help="Number of training epochs")
Hi, thanks for sharing, does this code work on tensorflow backend on Keras?
Hello @tdeboissiere ,
For DeepLearningImplementations/Colorful how can I make to color a single picture given as input
e.g python main.py eval --img_in my_grayscale_picture.png
Thanks.
"mode" is no longer an acceptable keyword argument
In DeepLearningImplementations/WassersteinGAN/src/model/models_WGAN.py
This has been driving me crazy, but when running your GAN code (original, not tensorflow repo) I am unable to reproduce your example images. I'm using Keras 1.2, tensorflow-gpu 1.0.0, and python 3.5.
I've tried both generators, but invariably after 5-10 epochs, the D logloss plateaus at 8.0554 and the G logloss stagnates at 16.032. The current batch image stops showing improvement too.
This is the command I run. I've tried with --generator deconv too.
python main.py --backend tensorflow --dset mnist
Do you mind sharing the parameters and versions you used to generate the results? Or if you know why things are just not learning? I'd really appreciate it.
Thanks!
when i try to run:
bash make_gif.sh
result is this :
no images defined `MoG_dataset.gif'
could you tell me what's wrong, thanks !
The code does not run with the latest versions of the packages. Some of them have to be downgraded to earlier versions. Please specify the versions of the python modules that are required to run 'Colorful' scripts
It should be a maxpooling as written instead of a avgpooling
When I run the source code, should I use TensorFlow as my backend or Theano?
Because it look like it want Theano. I have an error when U try to use tf as backend.
Traceback (most recent call last):
File "/home/kcho/lib/tensorflow/DeepLearningImplementations/DeconvNet/VGG_deconv.py", line 176, in <module>
Dec = KerasDeconv.DeconvNet(model)
File "/home/kcho/lib/tensorflow/DeepLearningImplementations/DeconvNet/KerasDeconv.py", line 29, in __init__
self.x = K.T.tensor4('x')
AttributeError: 'module' object has no attribute 'T'
After 100 epochs:
D tot: 0.2766 - D log: 0.0055 - D cat: 1.1600 - D cont: -0.8890 - G tot: 11.2585 - G log: 12.5444 - G cat: 0.0936 - G cont: -1.3795
Are there different parameters for celebA dataset ?
Using Theano backend.
Traceback (most recent call last):
File "run_cifar10.py", line 44, in
weight_decay=weight_decay)
File "/home/ian/Desktop/contrib/test/DeepLearningImplementations/DenseRecNet/denserecnet.py", line 127, in DenseNet
x_RNN = Flatten()(x_RNN)
File "/home/ian/.virtualenvs/contrib/lib/python3.5/site-packages/keras/engine/topology.py", line 514, in call
self.add_inbound_node(inbound_layers, node_indices, tensor_indices)
File "/home/ian/.virtualenvs/contrib/lib/python3.5/site-packages/keras/engine/topology.py", line 572, in add_inbound_node
Node.create_node(self, inbound_layers, node_indices, tensor_indices)
File "/home/ian/.virtualenvs/contrib/lib/python3.5/site-packages/keras/engine/topology.py", line 152, in create_node
output_shapes = to_list(outbound_layer.get_output_shape_for(input_shapes[0]))
File "/home/ian/.virtualenvs/contrib/lib/python3.5/site-packages/keras/layers/core.py", line 402, in get_output_shape_for
'(got ' + str(input_shape[1:]) + '. '
Exception: The shape of the input to "Flatten" is not fully defined (got (0, 8, 1). Make sure to pass a complete "input_shape" or "batch_input_shape" argument to the first layer in your model.
Dear Thibault de Boissiere
I tested your code on my own data-set with 130000 sample of 256321 images(256 H, 32 W, 1 C)
with 5 class
the learning process seems done in a very strange form
whats wrong?
the .json file content:
{
"batch_size": 64,
"learning_rate": [
0.0010000000474974513,
0.0010000000474974513,
0.0010000000474974513,
0.0010000000474974513,
0.0010000000474974513,
0.0010000000474974513,
0.0010000000474974513,
0.0010000000474974513,
0.0010000000474974513,
0.0010000000474974513,
0.0010000000474974513
],
"nb_epoch": 30,
"optimizer": {
"beta_1": 0.8999999761581421,
"beta_2": 0.9990000128746033,
"decay": 0.0,
"epsilon": 1e-08,
"lr": 0.0010000000474974513
},
"test_loss": [
[
0.6066114468840254,
0.8129256968527756
],
[
0.4871855918467968,
0.8482972138437325
],
[
0.45037036715277207,
0.8587461300309598
],
[
0.41322950868414654,
0.8722910219670819
],
[
0.4041474326845293,
0.8754643962848297
],
[
0.40550520608299656,
0.8729102170135215
],
[
0.39118199866991665,
0.8778637773850385
],
[
0.38647653761293865,
0.8809597523957953
],
[
0.3755317733199235,
0.8863003097082439
],
[
0.3637650244376239,
0.8899380805691698
],
[
0.36609122125725996,
0.886377709052142
]
],
"train_loss": [
[
0.7174626588821411,
0.7964333891868591
],
[
0.523139476776123,
0.8357153534889221
],
[
0.46472862362861633,
0.8522512912750244
],
[
0.4307743310928345,
0.864177942276001
],
[
0.4081457853317261,
0.8720802068710327
],
[
0.3938981592655182,
0.8766551613807678
],
[
0.38517263531684875,
0.8790456652641296
],
[
0.3747204840183258,
0.8830181360244751
],
[
0.3687455356121063,
0.8850733637809753
],
[
0.36394041776657104,
0.8867501020431519
],
[
0.3598470687866211,
0.8877047896385193
]
]
}
Hello, I am wondering if the colors (back ground color in each deconv feat map represent some meaning, like which feature map in the original image has more action response in the neuron, like which part of one image does the network reponses most?
Hi,
I am trying to run the mnist gan code but the code is not working as intented. My Generator loss is not changing after first epoch and it remains constant at 16.0302 thereafter. Please help me. I have tried to use tensorflow backend with and without label smoothing, with and without use_mbd, also with deconv .
Hi,
I am trying to train the pix2pix model. Unfortunately I get errors with several combinations of Theano / Keras and Tensorflow / Keras. Which versions and which dimension order should I use? Is it documented somewhere?
Hi and thanks for these great implementations. I modified the WGAN-GP code a little bit (basically just take the code from GAN_tf for MNIST) here, and tried to train the MNIST dataset instead of celebA. I got the following error, probably indicating training instability? Have you encountered similar problems? Thanks!
InvalidArgumentError (see above for traceback): Nan in summary histogram for: discriminator/conv2D_1/bn/beta_0/gradient
[[Node: discriminator/conv2D_1/bn/beta_0/gradient = HistogramSummary[T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/cpu:0"](discriminator/conv2D_1/bn/beta_0/gradient/tag, gradients_2/AddN_19/_113)]]
[[Node: gradients_2/gradients/discriminator_2/conv2D_1/bn/moments/sufficient_statistics/var_ss_grad/Tile_grad/transpose/_106 = _SendT=DT_INT32, client_terminated=false, recv_device="/job:localhost/replica:0/task:0/gpu:0", send_device="/job:localhost/replica:0/task:0/gpu:0", send_device_incarnation=1, tensor_name="edge_783_gradients_2/gradients/discriminator_2/conv2D_1/bn/moments/sufficient_statistics/var_ss_grad/Tile_grad/transpose", _device="/job:localhost/replica:0/task:0/gpu:0"]]
Epoch 5: 50%|████▉ | 199/400 [01:10<01:11, 2.81it/s]
Hi Thibault,
Congrats on reimplementing DenseNets in Keras!
I am trying to run your code locally (run_cifar10 in densenet) using Theano and I am getting an error:
Using Theano backend.
Traceback (most recent call last):
File "/home/piotr/workspace/DeepLearningImplementations/DenseNet/run_cifar10.py", line 43, in
weight_decay=weight_decay)
File "/home/piotr/workspace/DeepLearningImplementations/DenseNet/densenet.py", line 99, in DenseNet
weight_decay=weight_decay)
File "/home/piotr/workspace/DeepLearningImplementations/DenseNet/densenet.py", line 58, in denseblock
x = merge(list_feat, mode='concat', concat_axis=1)
File "/usr/local/lib/python2.7/dist-packages/Keras-1.1.0-py2.7.egg/keras/engine/topology.py", line 1528, in merge
name=name)
File "/usr/local/lib/python2.7/dist-packages/Keras-1.1.0-py2.7.egg/keras/engine/topology.py", line 1186, in init
node_indices, tensor_indices)
File "/usr/local/lib/python2.7/dist-packages/Keras-1.1.0-py2.7.egg/keras/engine/topology.py", line 1253, in _arguments_validation
'Layer shapes: %s' % (input_shapes))
Exception: "concat" mode can only merge layers with matching output shapes except for the concat axis. Layer shapes: [(None, 3, 32, 16), (None, 3, 32, 12)]
Any idea why it is crashing?
Many Thanks!
when I run : python main.py --backend tensorflow --generator deconv --dset celebA --lr_G 1E-3 --lr_D 1E-3 --clamp_lower -0.5 --clamp_upper 0.5 --batch_size 512 --noise_dim 128
It traceback:
Traceback (most recent call last):
File "main.py", line 85, in <module>
launch_training(**d_params)
File "main.py", line 11, in launch_training
train_WGAN.train(**kwargs)
File "/mnt/data1/daniel/codes/GAN/DeepLearningImplementations/WassersteinGAN/src/model/train_WGAN.py", line 47, in train
X_real_train = data_utils.load_image_dataset(dset, img_dim, image_dim_ordering)
File "../utils/data_utils.py", line 94, in load_image_dataset
X_real_train = load_celebA(img_dim, image_dim_ordering)
File "../utils/data_utils.py", line 83, in load_celebA
X_real_train = normalization(X_real_train, image_dim_ordering)
File "../utils/data_utils.py", line 16, in normalization
X = (X - 0.5) / 0.5
MemoryError
Anybody help?
Approximately how many epochs did pix2pix take to produce the example image?
Also, are the default settings the ones you used to get the result?
Line 177 using tensorflow I get this error message on running:
Input 'input_sizes' of 'Conv2DBackpropInput' Op has type float32 that does not match expected type of int32.
Possibly input tensor needs to be converted to float32 or int32?
Hi,
Thnks for your good job.
I am trying to run the VGG_deconv.py flowed the README. When I was loading the weight, I have encountered issue that
File "VGG_deconv.py", line 173, in
model = load_model('./Data/vgg16_weights.h5')
File "VGG_deconv.py", line 86, in load_model
model = VGG_16(weights_path)
File "VGG_deconv.py", line 72, in VGG_16
model.load_weights(weights_path)
File "/home/zhuwei/anaconda3/envs/theano2/lib/python2.7/site-packages/keras/models.py", line 719, in load_weights
topology.load_weights_from_hdf5_group(f, layers)
File "/home/zhuwei/anaconda3/envs/theano2/lib/python2.7/site-packages/keras/engine/topology.py", line 3056, in load_weights_from_hdf5_group
layer_names = [n.decode('utf8') for n in f.attrs['layer_names']]
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "/home/zhuwei/anaconda3/envs/theano2/lib/python2.7/site-packages/h5py/_hl/attrs.py", line 60, in getitem
attr = h5a.open(self._id, self._e(name))
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py/h5a.pyx", line 77, in h5py.h5a.open
KeyError: "Can't open attribute (can't locate attribute: 'layer_names')"
So I replaced the vgg16_weights.h5 with vgg16_weights_th_dim_ordering_th_kernels.h5 from https://github.com/fchollet/deep-learning-models/releases eliminated the error. And can run the forward pass. But I encountered another issue that
Traceback (most recent call last):
File "VGG_deconv.py", line 184, in
plot_deconv(img_index, data, Dec, target_layer, feat_map)
File "/home/zhuwei/visualization/DeepLearningImplementations/DeconvNet/utils.py", line 404, in plot_deconv
X_deconv = Dec.get_deconv(data[img_index], target_layer, feat_map=feat_map)
File "/home/zhuwei/visualization/DeepLearningImplementations/DeconvNet/KerasDeconv.py", line 187, in get_deconv
X_out = self._backward_pass(X, target_layer, d_switch, feat_map)
File "/home/zhuwei/visualization/DeepLearningImplementations/DeconvNet/KerasDeconv.py", line 135, in _backward_pass
"Invalid layer name: %s \n Can only handle maxpool and conv" % target_layer)
ValueError: Invalid layer name: conv2d_13
Can only handle maxpool and conv
I change the layer name since that was defined in the new weight files. Can you give me some hint what's going on?
Hi,
I had to fix a couple of things in the code , I presume keras latest version changed some variable definitions, but I haven't tried with older keras versions so I'm not sure about that.
Anyway, in the Wasserstein gan code:
in utiles/data_utils.py the beta1 parameter to the Adam solver needs to be changed to beta_1
in /model/models_WGAN.py happens an error in conv2d_init function caused by dim_ordering variable. putting dim_ordering=None seems to fix it, so I suggest:
def conv2D_init(shape, name=None,dim_ordering=None): return initializations.normal(shape, scale=0.02, name=name)
I'm trying out Colorful scripts. It looks like the training script does not work with Keras2. Simply downgrading keras to 1.2 etc.. brings new issues. I'd appreciate if the scripts can be upgraded to Keras 2.
Hi, for line 76 in DeepLearningImplementations/WGAN-GP/src/model/train_wgan_GP.py:
should it be:
X_hat = X_fake + epsilon * (X_real - X_fake)
instead of
X_hat = X_real + epsilon * (X_fake - X_real)?
Hi,
I' m testing your WGAN on MNIST. with theano everything is ok, then today I've tried tensorflow backend with subpixel generator. Using 32 or lower batch size is working, but if I try 64/128 batch size I get this error:
InvalidArgumentError (see above for traceback): Conv2DSlowBackpropInput: input and out_backprop must have the same batch size [[Node: conv2d_transpose_4 = Conv2DBackpropInput[T=DT_FLOAT, data_format="NHWC", padding="SAME", strides=[1, 2, 2, 1], use_cudnn_on_gpu=true, _device="/job:localhost/replica:0/task:0/gpu:0"](conv2d_transpose_4/output_shape, transpose_4, Relu_12)]]
Here is the current namespace and parameters:
Namespace(backend='tensorflow', batch_size=64, bn_mode=2, clamp_lower=-0.01, clamp_upper=0.01, disc_iterations=20, discriminator='discriminator', dset='mnist', generator='subpixel', img_dim=64, lr_D=5e-05, lr_G=5e-05, n_batch_per_epoch=200, nb_epoch=400, noise_dim=100, noise_scale=0.5, opt_D='RMSprop', opt_G='RMSprop', use_mbd=False)
Experiment parameters:
opt_G RMSprop
opt_D RMSprop
noise_dim 100
noise_scale 0.5
generator subpixel
disc_iterations 20
nb_epoch 400
bn_mode 2
batch_size 64
n_batch_per_epoch 200
image_dim_ordering tf
lr_G 5e-05
img_dim 64
lr_D 5e-05
dset mnist
discriminator discriminator
use_mbd False
clamp_lower -0.01
clamp_upper 0.01
I am trying replicate your work on tensorflow as backend. The Decovnet seems pretty generic code however i am getting error at
self.x = K.T.tensor4('x')
what exactly can be changed here for tensorflow to make the same code work.
Hello @tdeboissiere ,
I can not train with a dataset generated from 68x68 images dimensions or other dimenisions like 128x128. The only dimension that works it is 64x64, with other dimensions it gives me this error:
**Traceback (most recent call last):
File "C:\Anaconda3\envs\py35\lib\site-packages\theano\compile\function_module.py", line 884, in call
self.fn() if output_subset is None else
ValueError: GpuReshape: trying to reshape an array of total size 5769216 into an array of total size 2894624.
During handling of the above exception, another exception occurred:
ValueError: GpuReshape: trying to reshape an array of total size 5769216 into an array of total size 2894624.
Apply node that caused the error: GpuReshape{2}(GpuElemwise{add,no_inplace}.0, TensorConstant{[9248 313]})
Toposort index: 1562
Inputs types: [GpuArrayType(float32, (False, False, False, False)), TensorType(int32, vector)]
Inputs shapes: [(2, 36, 256, 313), (2,)]
Inputs strides: [(11538432, 320512, 1252, 4), (4,)]
Inputs values: ['not shown', array([9248, 313])]
Outputs clients: [[InplaceGpuDimShuffle{0,1,x,x}(GpuReshape{2}.0)]]**
I have as backend Theano and I use the GPU to train.
I thiiiink pix2pix's data_utils is missing load_data
# Load and rescale data
X_full_train, X_sketch_train, X_full_val, X_sketch_val = data_utils.load_data(dset, image_dim_ordering)
AttributeError 'module' object has no attribute 'load_data'
Any ideas? Thanks for making this!
Hello?
Thanks for uploading keras based pix2pix. I had an error but fixed it with tensorflow backend option.
And could you upload codes for testing?
Thanks,
In the codes, a loss objective named with Wasserstein is defined as follows.
return K.mean(y_true * y_pred)
After reading the original paper, we know WGAN wants to minimize the Wasserstein Distance:
the difference of expectation of generated samples and expectation of real samples. And why K.mean(y_true * y_pred)
could implement such distance?
Hi, thanks for reimplementing the densenets. I took a look at your structure diagram and noticed you used max pooling in transition layers. We used avg pooling instead. Max pooling might work too though. Just to let you know :)
Cheers,
@tdeboissiere Just wanted to tell you excellent repository.
I am running the run_cifar10.py
example on the DenseNet architecture but the accuracy is low. Do you get similar results? Please see the output:
Epoch 1/30, Time: 51.1712930202
Validation loss: 1.9541955759 accuracy: 0.3231
Epoch 2/30, Time: 48.110555172
Validation loss: 1.8552568697 accuracy: 0.3467
Epoch 3/30, Time: 48.1387000084
Validation loss: 1.80415105343 accuracy: 0.3602
Epoch 4/30, Time: 48.2201020718
Validation loss: 1.76553211613 accuracy: 0.3693
Epoch 5/30, Time: 48.2158961296
Validation loss: 1.7347150177 accuracy: 0.3793
Epoch 6/30, Time: 48.209141016
Validation loss: 1.70514687557 accuracy: 0.388
Epoch 7/30, Time: 48.237156868
Validation loss: 1.67561238804 accuracy: 0.3969
Epoch 8/30, Time: 48.1645870209
Validation loss: 1.65338623161 accuracy: 0.4058
Epoch 9/30, Time: 48.2082428932
Validation loss: 1.6369724762 accuracy: 0.4104
Epoch 10/30, Time: 48.1478528976
Validation loss: 1.62344400311 accuracy: 0.4158
Epoch 11/30, Time: 48.1710720062
Validation loss: 1.61286505413 accuracy: 0.4184
Epoch 12/30, Time: 48.1577467918
Validation loss: 1.6039566658 accuracy: 0.4221
Epoch 13/30, Time: 48.1328320503
Validation loss: 1.59814694672 accuracy: 0.4249
Epoch 14/30, Time: 48.1533429623
Validation loss: 1.59282479839 accuracy: 0.427
Epoch 15/30, Time: 48.1005380154
Validation loss: 1.58933777313 accuracy: 0.4292
Epoch 16/30, Time: 48.1664721966
Validation loss: 1.55802340374 accuracy: 0.4383
Epoch 17/30, Time: 48.1234638691
Validation loss: 1.55658948803 accuracy: 0.4395
Epoch 18/30, Time: 48.195486784
Validation loss: 1.55546182899 accuracy: 0.4394
Epoch 19/30, Time: 48.1643540859
Validation loss: 1.55441089878 accuracy: 0.4399
Epoch 20/30, Time: 48.1657791138
Validation loss: 1.5535571804 accuracy: 0.4409
Epoch 21/30, Time: 48.129434824
Validation loss: 1.55240019016 accuracy: 0.4407
Epoch 22/30, Time: 48.1452748775
Validation loss: 1.55181030369 accuracy: 0.4411
Epoch 23/30, Time: 48.1575331688
Validation loss: 1.55042634773 accuracy: 0.4435
Epoch 24/30, Time: 48.1651659012
Validation loss: 1.55020442104 accuracy: 0.4435
Epoch 25/30, Time: 48.1427268982
Validation loss: 1.55003917351 accuracy: 0.4442
Epoch 26/30, Time: 48.1740958691
Validation loss: 1.54997017498 accuracy: 0.4446
Epoch 27/30, Time: 48.1708450317
Validation loss: 1.54985166111 accuracy: 0.4442
Epoch 28/30, Time: 48.1398389339
Validation loss: 1.54980517941 accuracy: 0.444
Epoch 29/30, Time: 48.1378748417
Validation loss: 1.54972298145 accuracy: 0.4439
Epoch 30/30, Time: 48.1508190632
Validation loss: 1.54960639267 accuracy: 0.444
In DeepLearningImplementations/pix2pix/src/model/models.py
, what is the function of minb_disc()
?
It seems that no matter what is inputted, the output always be 1. So MBD layer is useless.
Hi,
Firstly thank for sharing your code. I having trouble running the INFOGAN for mnist dataset with generator as deconv and batchsize as 64. You can find stack trace at https://gist.github.com/mridulbirla/1952e9227253980e1c118120220f8977 .
It looks like it is getting error in # transposed conv blocks. Do you know how to resolve this error.
I would like see a clear definition of Wasserstein loss that gets rid of "y_true" or "y_pred", because these remind me conventional entropy loss.
When trying your VGG_deconv.py example, I am running into the following runtime error:
RuntimeError: Could not set tensorNd descriptor: CUDNN_STATUS_BAD_PARAMdim=4 Apply node that caused the error: GpuDnnConv{algo='small', inplace=True}(GpuContiguous.0, GpuContiguous.0, GpuAllocEmpty.0, GpuDnnConvDesc{border_mode='valid', subsample=(1, 1), conv_mode='conv', precision='float32'}.0, Constant{1.0}, Constant{0.0})
Toposort index: 18
Inputs types: [CudaNdarrayType(float32, 4D), CudaNdarrayType(float32, 4D), CudaNdarrayType(float32, 4D), <theano.gof.type.CDataType object at 0x7fa76f598748>, Scalar(float32), Scalar(float32)]
Inputs shapes: [(0, 3, 226, 226), (64, 3, 3, 3), (0, 64, 224, 224), 'No shapes', (), ()]
Inputs strides: [(153228, 51076, 226, 1), (27, 9, 3, 1), (3211264, 50176, 224, 1), 'No strides', (), ()]
Inputs values: [b'CudaNdarray([])', 'not shown', b'CudaNdarray([])', <capsule object NULL at 0x7fa76bbeeb70>, 1.0, 0.0]
Inputs name: ('image', 'kernel', 'output', 'descriptor', 'alpha', 'beta')
Any idea why there should be a need to set the tensorNd descriptor given that I am using images?? Is there a workaround or patch you did to bypass this?
It seems that you minimize the disc_loss_real first and then minimize the disc_loss_gen, however, according to the original paper, you should do the optimization of both simultaneously. Since this allow the optimizer to find the gradient of whole function in a global space, instead of following either the direction of the loss_real or loss_gen.
The validation images generated during training appear to be in much better quality than the same images using the saved model(Using the saved model from the same epoch). I think it is due to some error on my testing code. I would be glad if you could help me out here -
from scipy.misc import imsave
img_path = os.path.join('path/to/input/image.jpg')
img = cv2.imread(img_path)
img = img[:, :, ::-1] # GBR to RGB
data = normalization(np.expand_dims(img, 0).transpose(0, 3, 1, 2)).transpose(0, 2, 3, 1)
out = generator_model.predict(data) # generator_model is already loaded with weights
out = inverse_normalization(out)
print out.shape # (256, 256, 3)
out=out[0, :, :, :]
print out.shape # (256, 256, 3)
imsave('path/to/output/image.jpg', out)
I think it has something to do with .asarray(np.float32)
and np.uint8
.
Hi,
In the line 131 of DeepLearningImplementations/DenseNet/run_cifar10.py
for batch_idx in arr_splits[:10]:
why are splits restricted to 10 ?
Something is wrong when running ./pix2pix/src/model/ function DCGAN
DCGAN_output = discriminator_model(list_gen_patch)
Traceback (most recent call last):
File "<ipython-input-110-8d91cd362eab>", line 2, in <module>
patch_size=64, image_dim_ordering='th')
File "<ipython-input-109-a71e3069eff8>", line 25, in DCGAN
DCGAN_output = discriminator_model(list_gen_patch)
File "/home/yuankun/anaconda2/lib/python2.7/site-packages/keras/engine/topology.py", line 572, in __call__
self.add_inbound_node(inbound_layers, node_indices, tensor_indices)
File "/home/yuankun/anaconda2/lib/python2.7/site-packages/keras/engine/topology.py", line 635, in add_inbound_node
Node.create_node(self, inbound_layers, node_indices, tensor_indices)
File "/home/yuankun/anaconda2/lib/python2.7/site-packages/keras/engine/topology.py", line 172, in create_node
output_tensors = to_list(outbound_layer.call(input_tensors, mask=input_masks))
File "/home/yuankun/anaconda2/lib/python2.7/site-packages/keras/engine/topology.py", line 2247, in call
output_tensors, output_masks, output_shapes = self.run_internal_graph(inputs, masks)
File "/home/yuankun/anaconda2/lib/python2.7/site-packages/keras/engine/topology.py", line 2390, in run_internal_graph
computed_mask))
File "/home/yuankun/anaconda2/lib/python2.7/site-packages/keras/engine/topology.py", line 2247, in call
output_tensors, output_masks, output_shapes = self.run_internal_graph(inputs, masks)
File "/home/yuankun/anaconda2/lib/python2.7/site-packages/keras/engine/topology.py", line 2420, in run_internal_graph
shapes = to_list(layer.get_output_shape_for(computed_tensors[0]._keras_shape))
File "/home/yuankun/anaconda2/lib/python2.7/site-packages/keras/layers/core.py", line 821, in get_output_shape_for
assert input_shape[-1] and input_shape[-1] == self.input_dim
AssertionError
Hello, love this library so far! How would I go about using this with a keras Image generator? Doesn't seem to be working as intended
I am trying to reproduce the results from the pix2pix model and the facades dataset. However the results always look kind of messed up. The following image was generated after more than 300 epochs of training. These monochrome areas keep on appearing in every image.
Any hints what might have gone wrong? I use the used the exact same code here from GitHub.
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.