llien30 / pytorch_template

Pytorch Implementation example of Image Classification with flowers recognition dataset

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Image Classification Template

project for pytorch implementation example of image classification

Requirements

  • python >= 3.7
  • pytorch >= 1.0
  • pyyaml
  • scikit-learn
  • wandb
  • pre-commit (for pre-commit formatting, type check and testing)

Please run pip install -r requirements.txt to install the necessary packages.

Dataset

Flowers Recognition Dataset Download the dataset from HERE

Directory Structure

.
├── FOR_AOLAB_MEMBERS.md
├── LICENSE
├── README.md
├── dataset/
│   └── flowers/
├── requirements.txt
├── .gitignore
├── .pre-commit-config
└── src/
    ├── csv
    ├── libs/
    ├── utils
    ├── notebook/
    ├── result/
    ├── scripts/
    │   └── experiment.sh
    ├── train.py
    └── evaluate.py

Features

  • configuration class using dataclasses.dataclass (libs/config.py)

    • type check.
    • detection of unnecessary / extra parameters in a specified configuration.
    • dataclass is an immutable object, which prevents the setting from being changed by mistake.
  • automatically generating configuration files (utils/make_configs.py)

    • e.g.) run this command
    python utils/make_configs.py --model resnet18 resnet30 resnet50 --learning_rate 0.001 0.0001

    then you can get all of the combinations with model and learning_rate (total 6 config files) while the other parameters are set by default as described in libs/config.py.

  • running all the experiments by running shell scripts (scripts/experiment.sh)

  • support type annotation (typing)

  • code formatting with black, isort and flake8

Experiment

Please see scripts/experiment.sh for the detail. You can set configurations and run all the experiments by the below command.

sh scripts/experiment.sh

Formatting

  • black
  • flake8
  • isort

TODO

  • pytorch implementation of image classification
  • configuration class using dataclasses.dataclass
  • auto generation of config yaml files
  • shell script to run all the experiment
  • support typing (type annotation)
  • test code (run testing with pre-commit check)
  • mypy (pre-commit check)
  • formatting (pre-commit isort, black and flake8)
  • calculate cyclomatic complexity / expression complexity / cognitive complexity (flake8 extension)
  • CI for testing using GitHub Actions

License

This repository is released under the MIT License

About

Pytorch Implementation example of Image Classification with flowers recognition dataset

License:MIT License


Languages

Language:Python 99.2%Language:Shell 0.8%