Courseware and learning materials
A download.sh script is provided to download the MNIST dataset into the mnist/ folder.
Run it from the repository root:
source download.shIf you encounter any issue with dataset downloading during the first run of the demos, you can manually move the files in the assets/ directory to the mnist/ folder.
This repository is a Julia project. The Project.toml declares all dependencies required to run the demos.
Prerequisites:
- Julia (tested with version 1.12)
- Git (to clone the repo)
- Internet access (optional, to download the MNIST dataset)
Get the sources and instantiate the environment:
# Clone and enter the repo
git clone https://github.com/CFDML/MechanicsX-lecture.git
cd MechanicsX-lecture
# Start Julia with this project and install dependencies
julia --project=.
# In the Julia REPL (Pkg mode)
# press ] to enter pkg mode, then run:
(MechanicsX-lecture) pkg> instantiate
(MechanicsX-lecture) pkg> statusThe mnist/ folder contains two runnable examples:
mnist/mlp.jl: a simple multilayer perceptron working on flattened 28×28 images.mnist/conv.jl: a small CNN (LeNet-style) operating on 28×28 images.
Both scripts will:
cdinto their own directory, so all paths are relative tomnist/.- Download the MNIST dataset into
mnist/on first run usingMLDatasets. - Train for a small number of epochs and print periodic metrics.
- Render a sample image using
ImageCore.
Simply run from the repo root:
# MLP demo
julia --project=. mnist/mlp.jl
# CNN demo
julia --project=. mnist/conv.jlAfterwards, you are encouraged to run the scripts using Visual Studio Code with the Julia extension. You may modify hyperparameters, model architecture, and training loops to experiment with different settings.
- Terminal image not displayed: ensure your terminal supports true color; you can comment out the visualization lines without affecting training.
- Version conflicts: run
pkg> instantiateagain to re-sync withProject.toml. - The first epoch may be a bit slower due to JIT compilation.
See LICENSE in this repository.