chore: related #21

This commit is contained in:
Andre Henriques 2023-09-27 13:55:29 +01:00
parent bad53a13e6
commit b2d3b3c677

View File

@ -32,7 +32,7 @@ model = keras.Sequential([
{{- if eq .LayerType 1}} {{- if eq .LayerType 1}}
layers.Rescaling(1./255), layers.Rescaling(1./255),
{{- else if eq .LayerType 2 }} {{- else if eq .LayerType 2 }}
layers.Dense({{ .Shape }}, activation="relu"), layers.Dense({{ .Shape }}, activation="sigmoid"),
{{- else if eq .LayerType 3}} {{- else if eq .LayerType 3}}
layers.Flatten(), layers.Flatten(),
{{- else }} {{- else }}
@ -41,7 +41,17 @@ model = keras.Sequential([
{{- end }} {{- end }}
]) ])
model.compile(loss=losses.SparseCategoricalCrossentropy(), optimizer=tf.keras.optimizers.Adam()) model.compile(
loss=losses.SparseCategoricalCrossentropy(),
optimizer=tf.keras.optimizers.Adam(),
metrics=['accuracy'])
his = model.fit(dataset, validation_data= dataset_validation, epochs=100) his = model.fit(dataset, validation_data= dataset_validation, epochs=50)
acc = his.history["accuracy"]
f = open("accuracy.val", "w")
f.write(str(acc[-1]))
f.close()
model.save("model.keras")