followmejoy / resnet50-and-drn50-with-Pytorch

Resnet50 and Drn_a_50 in Fashion MNIST

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Resnet50 and drn_a_50 wiht fashion MNIST

Pytorch 4.1 is suppoted on branch 0.4 now.

Support Arc:

Support Code and model:

Fashion MNIST Test

System top1 top5 Parameters
Resnet50 93.02 99.75 23.5M
Drn_a_50 93.83 99.93 23.5M

Contents

  1. Installation
  2. Datasets
  3. Training
  4. Evaluation
  5. Models

Installation

  • Install PyTorch-0.4.1 by selecting your environment on the website and running the appropriate command.
  • Clone this repository. This repository is mainly based on drn and fashion-mnist, a huge thank to them.
    • Note: Currently only support Python 3+.

Datasets

The Fashion MNIST dataset is downloaded from the links below, which is stored in the same format as the original MNIST data.

name content examples link
train-images-idx3-ubyte.gz training set images 60,000 http://fashion-mnist.s3-website.eu-central-1.amazonaws.com/train-images-idx3-ubyte.gz
train-labels-idx3-ubyte.gz training set labels 60,000 http://fashion-mnist.s3-website.eu-central-1.amazonaws.com/train-labels-idx1-ubyte.gz
t10k-images-idx3-ubyte.gz testing set images 10,000 http://fashion-mnist.s3-website.eu-central-1.amazonaws.com/t10k-images-idx3-ubyte.gz
t10k-labels-idx3-ubyte.gz testing set labels 10,000 http://fashion-mnist.s3-website.eu-central-1.amazonaws.com/t10k-labels-idx1-ubyte.gz
  • Note:
    • The Fashion MNIST data are processed by instructions in https://github.com/zalandoresearch/fashion-mnist, and the processed dataset in this repo is located in './data/processed'.
    • In this repo, the training set is divided into two parts: one is for training with size 50,000 and the other is for evaluating with size 10,000.
    • The processed evaluating dataset is located in './data/processed/val-set' with the name 'test.pth', while the testing dataset is located in './data/processed/test-set' with the name 'test.pth'. Before you train or test the net, you should move the according 'test.pth' to './data/processed'.
    • MNIST data is also supported in this repo, and the data can be downloaded and processed automatically if you set --data MNIST in train script.

Training

  • To train drn_a_50 Net using the train script simply specify the parameters listed in train_drn.py as a flag or manually change them. To train resnet50 is in the same way except using the 'train-resnet50.py' script.
python train-drn.py 
  • Note:
    • --patience :early stopping
    • --batch_size : batch size
    • --nepochs: max epochs
    • --nworkers: number of workers
    • --seed : random seed
    • --data : FashionMNIST or MNIST

Evaluation

  • You can test the drn_a_50 Net with the code below, and to test resnet50 is as the same except using 'test-resnet50.py'.
python test-drn.py 
  • Note:
    • --data: FashionMNIST or MNIST
    • --batch_size : Batch size
    • -p : print frequency (default: 10)

About

Resnet50 and Drn_a_50 in Fashion MNIST


Languages

Language:Python 100.0%