diff --git a/views/py/python_model_template.py b/views/py/python_model_template.py index e782ecc..51fdbd4 100644 --- a/views/py/python_model_template.py +++ b/views/py/python_model_template.py @@ -32,7 +32,7 @@ model = keras.Sequential([ {{- if eq .LayerType 1}} layers.Rescaling(1./255), {{- else if eq .LayerType 2 }} - layers.Dense({{ .Shape }}, activation="relu"), + layers.Dense({{ .Shape }}, activation="sigmoid"), {{- else if eq .LayerType 3}} layers.Flatten(), {{- else }} @@ -41,7 +41,17 @@ model = keras.Sequential([ {{- 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")