/image-classification-level1-34

Mask Image Classification

Primary LanguageJupyter Notebook

image-classification-level1-34

Code for image-classification Competition by AiStage To read the detailed report, please, refer to team report

Requirements

  1. pytorch 1.6.0
  2. torchvision 0.7.0
  3. pandas 1.1.5
  4. opencv-python 4.5.1.48
  5. scikit-learn 0.24.1
  6. matplotlib 3.2.1

Hardware

The following specs were to create original solution.

  • GPU : Tesla V100 (32GB) (1GPU for 1Server)
  • CPU : 8 X vCPU
  • RAM : 90G

Dataset

Downloab and extract train.tag.gz to Data/input directory.

$ wget -d https://aistages-prod-server-public.s3.amazonaws.com/app/Competitions/000074/data/train.tar.gz
$ tar -zxvf train.tar.gz

Crop images

$ python crop.py
$ python eval_crop.py

Train

Train models

To train models, run follwing commands. You can choose multi-tasking model or multi-class model to train.

$ python train_by_CLASS.py SM_CHANNEL_TRAIN=[train image dir] SM_MODEL_DIR=[model saving dir]
$ python train_multitask.py SM_CHANNEL_TRAIN=[train image dir] SM_MODEL_DIR=[model saving dir]

You can add arguments (label, optimizer, criterion, resize, epochs, and more) for more detailed train.

Pretrained models

You can download pretrained model that used for my trian from Link

Grad_cam

You can watch how your model learning visually by using grad_cam.ipynb

Inference

If trained weights are prepared, you can create submission files that contains label of images.

$ python inference.py