Lines Matching full:model

41 def calculate_model_size(model):  argument
42 print(model.summary())
45 for v in model.trainable_variables
47 print("Model size:", sum(var_sizes) / 1024, "KB")
52 model = tf.keras.Sequential([
73 model.load_weights("./netmodels/CNN/weights.h5")
74 return model, model_path
79 model = tf.keras.Sequential([
89 return model, model_path
101 if args.model == "CNN":
102 model, model_path = build_cnn(seq_length)
103 elif args.model == "LSTM":
104 model, model_path = build_lstm(seq_length)
106 print("Please input correct model name.(CNN LSTM)")
107 return model, model_path
111 model, argument
120 """Trains the model."""
121 calculate_model_size(model)
124 model.compile(
140 model.fit(
147 loss, acc = model.evaluate(test_data)
148 pred = np.argmax(model.predict(test_data), axis=1)
155 # Convert the model to the TensorFlow Lite format without quantization
156 converter = tf.lite.TFLiteConverter.from_keras_model(model)
159 # Save the model to disk
160 open("model.tflite", "wb").write(tflite_model)
162 # Convert the model to the TensorFlow Lite format with quantization
163 converter = tf.lite.TFLiteConverter.from_keras_model(model)
167 # Save the model to disk
170 basic_model_size = os.path.getsize("model.tflite")
171 print("Basic model is %d bytes" % basic_model_size)
173 print("Quantized model is %d bytes" % quantized_model_size)
180 parser.add_argument("--model", "-m")
196 model, model_path = build_net(args, seq_length) variable
199 train_net(model, model_path, train_len, train_data, valid_len, valid_data,
200 test_len, test_data, args.model)