Skip to content
forked from rois-codh/kmnist

Repository for Kuzushiji-MNIST Classification implemented in PyTorch

Notifications You must be signed in to change notification settings

zengmmm00/kmnist

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

96 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kuzushiji-MNIST Classification

This repository impletments the classification for Kuzushiji-MNIST in Pytorch with model ResNet & ResMLP.

Download the dataset

(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

Visualization and Unsupervised Models

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

MLP/CNN Model

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

About

Repository for Kuzushiji-MNIST Classification implemented in PyTorch

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 95.7%
  • Python 4.3%