Classify MNIST digits.
First, install dependencies
# clone project
git clone https://github.com/charlesincharge/caltech-ee148-spring2021-hw03
# install project (conda environment recommended)
cd caltech-ee148-spring2021-hw03
pip install -e .
pip install -r requirements.txt
Next, navigate to any file and run it.
# module folder
cd project
# run module
python lit_image_classifier.py
This project is setup as a package which means you can now easily import any file into any other file like so:
from project.datasets.mnist import mnist
from project.lit_image_classifier import LitImageClassifier
from pytorch_lightning import Trainer
# model
model = LitImageClassifier()
# data
train, val, test = mnist()
# train
trainer = Trainer()
trainer.fit(model, train, val)
# test using the best model!
trainer.test(test_dataloaders=test)