Skip to content

Commit

Permalink
Input au lieu de Flatten
Browse files Browse the repository at this point in the history
  • Loading branch information
serge committed Sep 24, 2020
1 parent 01b40e4 commit c373ba8
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions main_tensorflow.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python3-
#!/usr/bin/env python3

########################################################################
# This file is part of AI Example.
Expand Down Expand Up @@ -120,11 +120,11 @@ def get_data(data_file, train, test):
print(x_train.shape, y_train.shape, x_test.shape, y_test.shape)
# (16000, 16) (16000,) (4000, 16) (4000,)

# Keras veut un array de shape 3 avec GPU! car c'est censé être des images
x_train = np.expand_dims(x_train, axis=2)
x_test = np.expand_dims(x_test, axis=2)
print(x_train.shape, y_train.shape, x_test.shape, y_test.shape)
# (16000, 16, 1) (16000,) (4000, 16, 1) (4000,)
# ## Keras veut un array de shape 3 avec GPU! car c'est censé être des images
# #x_train = np.expand_dims(x_train, axis=2)
# #x_test = np.expand_dims(x_test, axis=2)
# #print(x_train.shape, y_train.shape, x_test.shape, y_test.shape)
# ## (16000, 16, 1) (16000,) (4000, 16, 1) (4000,)

return [x_train, y_train, x_test, y_test]

Expand Down Expand Up @@ -166,7 +166,8 @@ def build_the_model():
"""

print("\nBuild the model ...")
model = keras.Sequential([ keras.layers.Flatten(input_shape=(16, 1)),
# Flatten transforme les images en vecteur colonne/ligne
model = keras.Sequential([ keras.layers.Input(shape=(16,)), #Dense(input_shape=(16, 1)),
keras.layers.Dense(128, activation='relu'),
keras.layers.Dense(26, activation='softmax') ])
return model
Expand Down

0 comments on commit c373ba8

Please sign in to comment.