Skip to content

Commit

Permalink
add models folder
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminhon committed Aug 7, 2020
1 parent 1e7ead1 commit 1f0fdcd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions modelmaker/resources/templates/default/models/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
save trained models here
13 changes: 11 additions & 2 deletions modelmaker/resources/templates/default/scripts/train.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import numpy as np
from tensorflow import keras
from {{ package_name }}.models import SimpleClassification
Expand Down Expand Up @@ -46,7 +47,7 @@ def _generate_random_shape(img_size):

# training parameters
batch_size = 32
epochs = 50
epochs = 5

# generate training data
train_data = ShapesClassDatagen(400, batch_size)
Expand All @@ -63,4 +64,12 @@ def _generate_random_shape(img_size):
model.fit(train_data, steps_per_epoch=len(train_data), epochs=epochs)

# save model
model.save("/Users/benjaminhon/simple_model")
model_folder = os.path.join(
os.path.dirname(
os.path.dirname(
os.path.realpath(__file__)
)
),
"models"
)
model.save(os.path.join(model_folder, 'simple_model'))

0 comments on commit 1f0fdcd

Please sign in to comment.