keras2sql icon indicating copy to clipboard operation
keras2sql copied to clipboard

Add support for convolutions

Open antoinecarme opened this issue 8 years ago • 2 comments

Sample use case : simple convnet on the MNIST dataset

keras example : https://github.com/keras-team/keras/blob/master/examples/mnist_cnn.py

used layers and activation functions :

model.add(Conv2D(32, kernel_size=(3, 3),
                 activation='relu',
                 input_shape=input_shape))
model.add(Conv2D(64, (3, 3), activation='relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Dropout(0.25))
model.add(Flatten())
model.add(Dense(128, activation='relu'))
model.add(Dropout(0.5))
model.add(Dense(num_classes, activation='softmax'))

antoinecarme avatar Feb 16 '18 21:02 antoinecarme

Added a primary implementation which works for small models.

Main pain points (to be solved):

  1. The second Conv2D layer
  2. the Flatten layer is too large (depends on the number of filters used in convolutions : 32 and 64). This layer works for small number of filters (in the jupyter notebook , we use 8 and 0)
  3. When the size of Flatter layer goes above 1000, we have some issues with the databases support for wide tables. => create separate issue (at least for some experiments. May not be solvable).
  4. The Dense layer leads to a very large model and SQL code. Need to perform some feature selection (make sparse models) and some simplification of the SQL code (non-used columns can be deleted).

antoinecarme avatar Feb 22 '18 11:02 antoinecarme

Another possibility is to perform a compression (exact or approximate) of the model.

new issue => #5

antoinecarme avatar Jul 07 '18 19:07 antoinecarme