This repository impletments the classification for Kuzushiji-MNIST in Pytorch with model ResNet & ResMLP.
(1) Get in the project folder in the terminal.
(2) Run
wget http://codh.rois.ac.jp/kmnist/dataset/kmnist/kmnist-train-imgs.npz
wget http://codh.rois.ac.jp/kmnist/dataset/kmnist/kmnist-train-labels.npz
wget http://codh.rois.ac.jp/kmnist/dataset/kmnist/kmnist-test-imgs.npz
wget http://codh.rois.ac.jp/kmnist/dataset/kmnist/kmnist-test-labels.npz
You will need install these packages to run the specific functions.
For basic functions, such as loading data and displaying images:
pip install numpy
pip install matplotlib
pip install seaborn
pip install pandas
For Unsupervised Model, PCA and Evaluation:
pip install -U scikit-learn
Run ./unsupervised.ipynb
You will need GPU and PyTorch packages to run the following code.
Results will be stored in ./log
Model parameters will be stored in ./models
Available model names:
ResMLP-12, ResMLP-24, ResNet-18, ResNet-34
To train and test the model:
python classification.py --model [model name] --gpu [GPU No.] --train 1 --test 1 --train_batch [train batch size] --test_batch [test batch size] --epoch [number of train epoch]
Only to test the model
python classification.py --model [model name] --gpu [GPU No.] --test_batch [test batch size]
For ResMLP-12
python classification.py --model ResMLP-12 --gpu 0 --train 1 --test 1 --train_batch 64 --test_batch 500 --epoch 30
For ResMLP-24
python classification.py --model ResMLP-24 --gpu 0 --train 1 --test 1 --train_batch 64 --test_batch 500 --epoch 30
For ResNet-18
python classification.py --model ResNet-18 --gpu 0 --train 1 --test 1 --train_batch 64 --test_batch 500 --epoch 30
For ResNet-34
python classification.py --model ResNet-34 --gpu 0 --train 1 --test 1 --train_batch 64 --test_batch 500 --epoch 30