AN 1011: TinyML Applications in Altera FPGAs Using LiteRT for Microcontrollers
ID
848984
Date
4/07/2025
Public
2.3.3. Training Model
Feed the training data into the model in batches and validate the model on the validation set after each epoch to monitor performance. Using the Matplotlib library, you can display the training and validation accuracy in a line graph.
# Train and Validate the Model epochs = 10 history = model.fit(x_train, y_train, epochs=epochs, batch_size=128, validation_data = (x_test, y_test), verbose=1) # Display the Training Progress def summary_history(history): plt.figure(figsize = (10,6)) plt.plot(history.history['accuracy'], color = 'blue', label = 'train') plt.plot(history.history['val_accuracy'], color = 'red', label = 'val') plt.legend() plt.title('Accuracy') plt.show() summary_history(history)
Figure 3. Training and Validation Logs
Figure 4. Training and Validation Accuracy per Epoches