Skip to content

Latest commit

 

History

History
84 lines (66 loc) · 2.68 KB

README.md

File metadata and controls

84 lines (66 loc) · 2.68 KB

Classification Model with Pytorch

Quick start

Note : Use Python 3.6 or newer

   Use Pytorch 1.7.1 or newer

  1. Download kaggle intel datasets
  2. Use folder_rename in utils/data_preprocess.py to label each class folder.

  The train/test dataset directory structure is like following(folder name: label-class):

.
├── seg_train
│   ├── 0-buildings
│   │   ├── 0.jpg
│   │   ├── 4.jpg
│   │   ├── ...
│   │   └── 20054.jpg
│   ├── 1-forest
│   │   ├── 8.jpg
│   │   ├── 23.jpg
│   │   ├── ...
│   │   └── 20051.jpg
│   ...
│   ├── 5-street
│   │   ├── 8.jpg
│   │   ├── 23.jpg
│   │   ├── ...
│   │   └── 20051.jpg
└── seg_test
    ├── 0-buildings
    │   ├── 20057.jpg
    │   ├── 20060.jpg
    │   ├── ...
    │   └── 24322.jpg
    ├── 1-forest
    │   ├── 20056.jpg
    │   ├── 20062.jpg
    │   ├── ...
    │   └── 24324.jpg
    ...
    └── 5-street
        ├── 20066.jpg
        ├── 20067.jpg
        ├── ...
        └── 24332.jpg

Use MobileNetV2 as an example, more models will be updated.

  1. Train (Use absolute path if have any path error)
  • Using single GPU:

  modify yaml file path in tools/train.py as '../cfg/mobilenet_v2/intel_bs256.yml' and run train.py in IDE.

  or run in terminal directly:

 python tools/train.py --yml ./cfg/mobilenet_v2/intel_bs256.yml
  • Using multiple GPUs(DDP train mode):

  modify yaml file path in tools/train.py as '../cfg/mobilenet_v2/intel_bs1024.yml' and run train.py in IDE.

  1. Infer (Use absolute path if have any path error)

  modify test.model_path as your weights path in yaml file you use. 

  modify yaml file path in tools/infer.py as '../cfg/mobilenet_v2/intel_bs256.yml' and run infer.py

  or run in terminal directly:

 python tools/infer.py --yml ./cfg/mobilenet_v2/intel_bs256.yml
  1. Use TensorboardX
  tensorboard --logdir=log_dir

TensorBoard 2.6.0 at http://localhost:6006/