AN 1011: TinyML Applications in Altera FPGAs Using LiteRT for Microcontrollers
ID
848984
Date
9/29/2025
Public
1. Overview
2. Preparing LiteRT Inference Model
3. Generating Nios® V Processor System
4. Generating Arm Processor System
5. Programming and Running
6. Nios® V Processor with TinyML Design Example
7. Appendix
8. Document Revision History for the AN 1011: TinyML Applications in Altera FPGAs Using LiteRT for Microcontrollers
2.2.1. Preparing Dataset
Apply the following Python commands to load the MNIST dataset. The Matplotlib library allows you to display random MNIST samples.
# Load the MNIST Train and Test Dataset mnist = tf.keras.datasets.mnist (x_train, y_train), (x_test, y_test) = mnist.load_data() rows, cols = 28, 28 # Display Random Samples fig = plt.figure(figsize=(9,9)) for i in range(8): ind = random.randint(0, len(x_train)) plt.subplot(3,3,i+1) plt.imshow(x_train[ind], cmap="gray", interpolation=None) plt.title(y_train[ind])
Figure 1. Example of MNIST Samples