Skip to content

Latest commit

 

History

History
156 lines (128 loc) · 4.56 KB

File metadata and controls

156 lines (128 loc) · 4.56 KB

[AI Tech 3기 Level 1 P Stage] Image Classification

https://stages.ai/competitions/104/overview/description

Team 커피사조 (CV-04) ☕

김나영 이승현 이재홍 이현진 전성휴
Github Github Github Github Github

Final Score 🏅

  • Public F1 0.7771 → Private F1 0.7564
  • Public acc 82.4603 → Private acc 81.4127
  • Public 3위 → Private 7위

image

Wrap Up Report 📑

[CV-04] Wrap Up Report.pdf


Competition Process

Time Line 🗓️

image

Experiments 📈

Model 실험

  • EfficientNet b0~b4 (+ pruned)
  • ECA-NFNet l0~l2
  • ResNet 18~50
  • SEResNet 50
  • ResNeXt 50/101 32x4d/8d
  • RegNet X/Y 16/32
  • Vision Transformer base/small (patch 16 input size 224)
  • Swin Transformer base/small (patch 4 window 7 input size 224)
  • MNASNet 100
  • MobileNet V3 small
  • Shufflenet V2

Loss + Optimizer 실험

  • Optimizer
  • Adam
  • AdamP
  • AdamW
  • RAdam
  • madgrad
  • Loss
  • Cross Entropy Loss
  • CE + F1 Loss
  • CE + Label Smoothing Loss
  • Symmetric Cross Entropy Loss
  • F1 Loss
  • Focal Loss

Augmentation 실험

  • color scale transforms
  • ColorJitter, RandomBrightnessContrast
  • CLAHE
  • shape distortion
  • Random HorizontalFlip
  • Random Shift
  • Center Crop
  • Resize
  • 얼굴 영역 중앙 배치 및 일정/랜덤 확대/축소 (deepface를 통해 얻은 bbox 정보 사용)
  • image mixing augmentation
  • CutMix (반반/패치)
  • Mixup

Final Model 💻

Model Loss Optimizer Augmentation Valid F1
efficientnet-b3 Focal Adam CenterCrop, HorizontalFlip, RandomShift,
Oversampling, CutMix, CLAHE
0.8059
regnetx_032 CE + Label Smoothing Loss RAdam CenterCrop, HorizontalFlip, RandomShift 0.8146
eca_nfnet_l2 Focal Adam CenterCrop, HorizontalFlip, RandomShift,
CLAHE
0.8258
resnext50_32x4d Focal Adam CenterCrop, HorizontalFlip, RandomShift 0.8104
swin_small_patch4_window7_224 Focal Adam CenterCrop, HorizontalFlip, RandomShift 0.7959

Guidelines to restore our experiments 🔬

Requirements ⚙

(TODO)
torch, numpy, pil, pandas, matplotlib 등 버젼 명시

Folder Structure 📂

level1-cv-04/
│
├── 📝 main.py 
├── 📝 inference.py 
├── 📝 args.py 
│
├── 📂 data/ - default directory for storing input data
├── 📂 submission/ - default directory for storing output data
│
├── 📂 model_utils/ - models
│   ├── 📝 model.py
│   └── 📝 custom_module.py
│
├── 📂 trainer/ - trainers
│   ├── 📝 train.py
│   └── 📝 validation.py
│
└── 📂 utils/ - small utility functions
    ├── 📝 util.py
    ├── 📝 augmentation.py
    ├── 📝 dataset.py
    └── 📝 loss.py

Code usage ✒

  • (TODO: 아래 내용 수정, 보완 및 정리 예정)

필수적으로 바꿔야 하는 부분

  • utils/util.py 에서 wandb_init 함수의 wandb.init 부분
    • 이니셜 수정
  • data/final_train_df.csv 에서 img_path 칼럼 부분을 자신의 환경에 맞게 경로 설정(혹은 utils/dataset.py의 데이터로더 부분에서 처리)

python, torch 버전

  • conda 가상환경(선택)
conda create -n 가상환경 이름 python=3.8
  • torch install
# conda
conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch
# pip
pip3 install torch torchvision torchaudio

학습 실행 예시

python main.py --model "efficientnet_b3" --resize 224 224 ; python main.py --model "resnet18" --resize 256 256

추론 예시(Single model)

python main.py --inference True --save_path "저장된 모델 경로" --model "efficientnet_b3" --resize 224 224