We use brew in this chapter to simplify the process of building our LeNet network. We begin by first initializing the model using ModelHelper, which was introduced in the previous chapter:
# Create the model helper for the train model
train_model = model_helper.ModelHelper(name="mnist_lenet_train_model")
We then add inputs to the training network using our add_model_inputs method:
# Specify the input is from the train lmdb
data, label = add_model_inputs(
train_model,
batch_size=64,
db=os.path.join(data_folder, "mnist-train-nchw-lmdb"),
db_type="lmdb",
)
Training data is usually stored in a database (DB) so that it can be accessed efficiently. Reading from a DB is usually faster than reading from thousands of individual files on the filesystem. For every training image in the MNIST dataset, the DB stores the grayscale pixel...