Computer Vision News - June 2021
9 ConvNets using Julia and the Flux machine learning framework train calls the functions that were defined above and it trains our model. It stops when the model achieves 99% accuracy (early-exiting) or after performing 20 steps. More specifically, it performs the following steps: • Loads the MNIST dataset. • Builds our ConvNet model (as described above). • Loads the train and test data sets as well as our model onto a GPU (if available). • Defines a loss function that calculates the crossentropy between our prediction and the ground truth. • Sets the ADAM optimiser to train the model with learning rate args.lr . • Runs the training loop. For each step (or epoch), it executes the following: ᇶ Calls Flux.train! function to execute one training step. ᇶ If any of the parameters of our model is NaN , then the training process is terminated.
Made with FlippingBook
RkJQdWJsaXNoZXIy NTc3NzU=