Commit 009f122c authored by Bannier Delphine's avatar Bannier Delphine
Browse files

add model

parent 85e62c1d
......@@ -9,6 +9,7 @@ from tensorflow.keras.layers import Dense
from tensorflow.keras.layers import Flatten
from tensorflow.keras.layers import Input
from tensorflow.keras.layers import concatenate
from tensorflow.keras.layers import GaussianNoise
......@@ -61,6 +62,17 @@ def create_mlp(dim, regress=True):
# return our model
return model
def create_mlp2(dim,regress = True):
model = Sequential()
model.add(GaussianNoise(0.2, input_shape=(dim,)))
model.add(Dense(8, activation="relu"))
model.add(Dense(4, activation="relu"))
# add dense for regression
model.add(Dense(1))
return model
def create_hybrid(nb_attributes,shape=(240,240,1)):
# create cnn and mlp models
mlp = create_mlp(nb_attributes)
......@@ -69,4 +81,14 @@ def create_hybrid(nb_attributes,shape=(240,240,1)):
x = Dense(4, activation="relu")(combinedInput)
x = Dense(1, activation="linear")(x)
model = Model(inputs=[mlp.input, cnn.input], outputs=x)
return model
def create_hybrid2(nb_attributes,shape=(240,240,1)):
# create cnn and mlp models
mlp = create_mlp2(nb_attributes)
cnn = create_cnn(*shape)
combinedInput = concatenate([mlp.output, cnn.output])
x = Dense(4, activation="relu")(combinedInput)
x = Dense(1, activation="linear")(x)
model = Model(inputs=[mlp.input, cnn.input], outputs=x)
return model
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment