Issue 1:
Hello everyone,

First of all I'ld like to thank for the great job you are doing here.

I was working on autoencoder examples at http://blog.keras.io/building-autoencoders-in-keras.html. When I came to CNN autoencoder, I'm stucked. Did anybody run CNN autoencoder(s) w/ Theano?

The example uses TensorFlow whereas I want to use Theano. This is what I have got so far:

= Versions

Python 2.7 (from WinPython) running on Windows 7

Theano - latest code from github

Keras - latest code from github

= CNN Autoencoder /w functional API

Sample Code: https://gist.github.com/zakkum42/71c1ac9577a6eb2b6260dcdf7efd27d7

Output/Error:

Using Theano backend.
(60000L, 1L, 28L, 28L)
(10000L, 1L, 28L, 28L)
ERROR (theano.gof.opt): Optimization failure due to: local_abstractconv_check
ERROR (theano.gof.opt): node: AbstractConv2d{border_mode='half', subsample=(1, 1), filter_flip=True, imshp=(None, None, None, None), kshp=(16, 1, 3, 3)}(input_1, convolution2d_1_W)
ERROR (theano.gof.opt): TRACEBACK:
ERROR (theano.gof.opt): Traceback (most recent call last):
File "D:\PYTHON2-DEV\WinPython\python-2.7.10.amd64\lib\site-packages\theano-0.8.2-py2.7.egg\theano\gof\opt.py", line 1772, in process_node
replacements = lopt.transform(node)
File "D:\PYTHON2-DEV\WinPython\python-2.7.10.amd64\lib\site-packages\theano-0.8.2-py2.7.egg\theano\tensor\nnet\opt.py", line 402, in local_abstractconv_check
node.op.__class__.__name__)
AssertionError: AbstractConv2d Theano optimization failed: there is no implementation available supporting the requested options. Did you exclude both "conv_dnn" and "conv_gemm" from the optimizer? If on GPU, is cuDNN available and does the GPU support it? If on CPU, do you have a BLAS library installed Theano can link against?

Question: Is the case that the original example is for TensorFlow only?

= CNN Autoencoder /w Sequential Model

Sample Code: https://gist.github.com/zakkum42/b251165232298425617944ab01e4cde6/7b350b4a56fb62768cf306484f0adf7f3455fb88

Output/Error:

Using Theano backend.
Traceback (most recent call last):
File "D:\PYTHON2-DEV\Li_ws\CSE555\src\som\keras_cnn_ae_sequential.py", line 59, in <module>
('x_train shape:', (60000L, 1L, 28L, 28L))
(60000L, 'trai validation_data=(x_test, x_test))
File "D:\PYTHON2-DEV\WinPython\python-2.7.10.amd64\lib\site-packages\keras-1.0.3-py2.7.egg\keras\models.py", line 408, in fit
sample_weight=sample_weight)
File "D:\PYTHON2-DEV\WinPython\python-2.7.10.amd64\lib\site-packages\keras-1.0.3-py2.7.egg\keras\engine\training.py", line 994, in fit
batch_size=batch_size)
File "D:\PYTHON2-DEV\WinPython\python-2.7.10.amd64\lib\site-packages\keras-1.0.3-py2.7.egg\keras\engine\training.py", line 925, in _standardize_user_data
exception_prefix='model target')
File "D:\PYTHON2-DEV\WinPython\python-2.7.10.amd64\lib\site-packages\keras-1.0.3-py2.7.egg\keras\engine\training.py", line 104, in standardize_input_data
str(array.shape))
Exception: Error when checking model target: expected convolution2d_7 to have shape (None, 1, 24, 24) but got array with shape (60000L, 1L, 28L, 28L)
n samples')
(10000L, 'test samples')

Based on the generated graph, convolution2d_7 accepts shape (None, 1, 24, 24), but the input is not converted to this shape.

Any suggestions on any of the two implementations?

Thank you in advance

K.

Issue 2:
Please make sure that the boxes below are checked before you submit your issue.

If your issue is an implementation question, please ask your question on StackOverflow or on the Keras Slack channel instead of opening a GitHub issue.

Thank you!

Check that you are up-to-date with the master branch of Keras. You can update with:

pip install git+git://github.com/keras-team/keras.git --upgrade --no-deps

Check that your version of TensorFlow is up-to-date. The installation instructions can be found here.

Provide a link to a GitHub Gist of a Python script that can reproduce your issue (or just copy the script here if it is short).

Introduction

I'm currently following the Plural Sight course on setting up Keras and using it for Object Detection. However with the second script I'm running into an AssertionError:

Code used for the course:

# deep_circles.py
# Defines a network that can find separate circles of data
#

# Imports
from sklearn.datasets import make_circles
import numpy as np
import matplotlib.pyplot as plt
import os
os.environ["TF_CPP_MIN_LOG_LEVEL"]="2"

# Helper functions

# plot the data on a figure
def plot_data(pl, X, y):
# plot class where y==0
pl.plot(X[y==0, 0], X[y==0,1], 'ob', alpha=0.5)
# plot class where y==1
pl.plot(X[y==1, 0], X[y==1,1], 'xr', alpha=0.5)
pl.legend(['0', '1'])
return pl

# Common function that draws the decision boundaries
def plot_decision_boundary(model, X, y):

amin, bmin = X.min(axis=0) - 0.1
amax, bmax = X.max(axis=0) + 0.1
hticks = np.linspace(amin, amax, 101)
vticks = np.linspace(bmin, bmax, 101)

aa, bb = np.meshgrid(hticks, vticks)
ab = np.c_[aa.ravel(), bb.ravel()]

# make prediction with the model and reshape the output so contourf can plot it
c = model.predict(ab)
Z = c.reshape(aa.shape)

plt.figure(figsize=(12, 8))
# plot the contour
plt.contourf(aa, bb, Z, cmap='bwr', alpha=0.2)
# plot the moons of data
plot_data(plt, X, y)

return plt

# Generate some data blobs. Data will be either 0 or 1 when 2 is number of centers.
# X is a [number of samples, 2] sized array. X[sample] contains its x,y position of the sample in the space
# ex: X[1] = [1.342, -2.3], X[2] = [-4.342, 2.12]
# y is a [number of samples] sized array. y[sample] contains the class index (ie. 0 or 1 when there are 2 centers)
# ex: y[1] = 0 , y[1] = 1
X, y = make_circles(n_samples=1000, factor=.6, noise=0.1, random_state=42)
#pl = plot_data(plt, X, y)
#pl.show()

# Split the data into Training and Test sets
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=42)

# Create the keras model
from keras.models import Sequential
from keras.layers import Dense
from keras.optimizers import Adam

# Simple Sequential model
model = Sequential()
model.add(Dense(4, input_shape=(2,), activation="tanh", name="Hidden-1"))
model.add(Dense(4, activation="tanh", name="Hidden-2"))
# Add a Dense Fully Connected Layer with 1 neuron. Using input_shape = (2,) says the input will
# be arrays of the form (*,2). The first dimension will be an unspecified
# number of batches (rows) of data. The second dimension is 2 which are the X, Y positions of each data element.
# The sigmoid activation function is used to return 0 or 1, signifying the data
# cluster the position is predicted to belong to.
model.add(Dense(1, activation="sigmoid", name="output_layer"))
model.summary()
# Compile the model. Minimize crossentopy for a binary. Maximize for accuracy
model.compile(Adam(lr=0.05), 'binary_crossentropy', metrics=['accuracy'])
from keras.utils import plot_model
plot_model(model, to_file="model.png", show_shapes=True, show_layer_names=True)

# The line above here fails

# Define early stopping callback
from keras.callbacks import EarlyStopping
my_callbacks = [EarlyStopping(monitor='val_acc', patience=5, mode='max')]
# Fit the model with the data from make_blobs. Make 100 cycles through the data.
# Set verbose to 0 to supress progress messages
model.fit(X_train, y_train, epochs=100, verbose=1, callbacks=my_callbacks, validation_data=(X_test, y_test))
# Get loss and accuracy on test data
eval_result = model.evaluate(X_test, y_test)
# Print test accuracy
print("\n\nTest loss:", eval_result[0], "Test accuracy:", eval_result[1])
# Plot the decision boundary
plot_decision_boundary(model, X, y).show()

There's already a duplicate of this issue but it was closed without a fix: #12538

I mean honestly wtf, hacking code into the Keras library without actually commiting it != a fix 😄

@ymodak, you asked for a way to reproduce this error. All this information should be enough for this.

My environment

OS: Windows 10

Python install: MiniConda with 3.6

CUDA: Yes

Commands I ran:

conda create -n POMP2 python=3.6
activate POMP2

conda install tensorflow-gpu
conda install keras

conda install scikit-learn matplotlib pydot

Note: graphviz is automatically installed.

My investigation

I already tried to figure out what's going on and it seems that at some point a file named dot.bat is called which returned exit code 1.

Path of dot.bat: C:\Users\******\AppData\Local\conda\conda\pkgs\graphviz-2.38-hfd603c8_2\Library\bin\dot.bat

If I check out that file it calls dot.exe

Path of dot.exe: C:\Users\********\AppData\Local\conda\conda\pkgs\graphviz-2.38-hfd603c8_2\Library\bin\graphviz\dot.exe

When you check out the screenshot, you can see on the bottom the commands that are being used to call dot.bat:

['dot.bat', '-Tps', 'C:\\Users\\********\\AppData\\Local\\Temp\\tmpd7q3ltxy'] return code: 1

If I however check the Temp directory to see if there's a file named tmpd7q3ltxy. There is none.

Question

Does anyone have any idea what's going on here?