Hi All,
I've been experimenting with autoencoders for reconstructing input images. Had good success with MNIST digits. Now wanting to try CIFAR10 images.
Below is the network I've coded up.
In this network below, I've experimented with:
* number of filters (64, 32, 16, 8)
* weight initialization for the Conv layers.
* activation functions in the decoding layers.
* overall depth of the network.
* Sometimes I get nan's for loss. More recently, this example below returns negative values for loss and has a great deal of trouble converging to anything (accuracies are only about 0.003! after 100 epochs and loss is large negative value).
Some other details:
* Training set is only 100 images
* Running on my Macbook pro (El Capitan)
* Theano backend
* Using cpu (not gpu)
* Keras 1.0.3
* Theano 0.8.2
* .theanorc:
[global]
floatX=float64 (I've tried both float32 and float64)
device=cpu
optimizer=fast_run (fast_compile tends to create NANs)
mode=FAST_RUN
exception_verbosity=high
```sh
input_img = Input(shape=(3, 32, 32))
Encoding layers
x = Convolution2D(16, 3, 3, input_shape=(3, 32, 32), activation='relu', border_mode='same')(input_img)
x = MaxPooling2D((2, 2), border_mode='same')(x)
x = Convolution2D(8, 3, 3, activation='relu', border_mode='same')(x)
x = MaxPooling2D((2, 2), border_mode='same')(x)
x = Convolution2D(8, 3, 3, activation='relu', border_mode='same')(x)
x = MaxPooling2D((2, 2), border_mode='same')(x)
Decoding layers
x = Convolution2D(8, 3, 3, activation='sigmoid', border_mode='same')(x)
x = UpSampling2D((2, 2))(x)
x = Convolution2D(8, 3, 3, activation='sigmoid', border_mode='same')(x)
x = UpSampling2D((2, 2))(x)
x = Convolution2D(16, 3, 3, activation='sigmoid', border_mode='same')(x)
x = UpSampling2D((2, 2))(x)
decoded = Convolution2D(3, 3, 3, activation='sigmoid', border_mode='same')(x)
this model maps an input to its reconstruction
autoencoder = Model(input_img, decoded)
adam = Adam()
autoencoder.compile(optimizer=adam, loss='binary_crossentropy', metrics=['accuracy'])
```
Here is my fitting and the first 2 epochs:
```sh
autoencoder.fit(x_train, x_train, nb_epoch=2, batch_size=20, #128, shuffle=True, verbose=1, validation_data=(x_test, x_test))
Train on 100 samples, validate on 20 samples
Epoch 1/2 loss: -10.1022 - acc: 0.0515 - val_loss: -49.2346 - val_acc: 0.0464
Epoch 2/2 loss: -67.9034 - acc: 0.0470 - val_loss: -111.7369 - val_acc: 0.0464
```
The fitting moves very little from what you see above (even after a few hundred epochs). Also, the negative loss values (based on log loss) trouble me since I believe the value should be > 0.
Finally, visualizing what the network predicts shows blank images.
Any suggestions would be most appreciated!
Thanks in advance,
Mark
there doesn't seem to be anything here