how many batches to wait before logging training status
name
str
resnet18_arc
dir name for trained model
arc_scale
float
30.0
arcface scale
arc_margin
float
0.4
arcface margin
n_splits
int
5
number for K-Fold validation
k_index
int
4
number of K-Fold validation
data_dir
str
_
image data path
model_dir
str
_
model saving path
Advanced inference
python inference.py --batch_size 32 ...
inference Arguments
Argument
DataType
Default
Help
dataset
str
CustomTestDataset
dataset augmentation type
batch_size
int
64
input batch size for validing
model
str
CustomModel_Arc
model type
augmentation
str
Augmentation_384
data augmentation type
data_dir
str
_
image data path
model_dir
str
_
model loading path
output_dir
str
_
inference file saving path
Code Structure
├── baseline # our code
│ ├── train.py # to train your data
│ ├── inference.py # to inference
│ ├── model.py # our CustomModel
│ ├── loss.py
│ ├── dataset.py
│ ├── transform.py
│ ├── utils.py
│ └── create_crop_images.py # to create crop image
└── crop_data # crop box information
Detail
Model
imagenet pretrained resnet18을 사용하였고, arcface loss를 사용하기 위해 마지막 fc layer을 바꿔 주었다.
Dataset
사람의 얼굴에 더 집중하기 위해 이미지를 crop하여 사용하였다
1차 crop: 마스크를 착용한 사람에서 face를 잘 detect하지 못하는 경우가 많았다. 그래서 우리 조는 마스크를 착용한 데이터셋을 사용해 학습한 모델을 사용하여 1차적으로 이미지를 크롭하였다. 18900개중 539개를 제외하고 crop했다. 특히 마스크를 잘못 착용한 데이터에서 얼굴 검출이 잘 안되었다.
2차 crop: face crop에 성능이 좋다고 알려진 Retinaface를 이용해 2차 crop을 해주었고, box가 너무 작게 예측된(잘못 예측된) 것들을 걸러내니 2장이 남아 직접 box labeling하여 사용하였다.
Train detail
arcface loss를 이용하였을 때 훨씬 더 빠른 학습 속도를 보였고, margin parameter는 0.4를 주었다.
arcface loss와 함께 사용할 다양한 loss(eg. BCE, focal, f1 loss ...)를 실험을 해보았는데, weight 주지 않고, label smoothing을 주지 않은 focal loss가 가장 성능이 좋아 focal loss를 사용하였다.($\gamma$=2)
trainset overfitting이 SGD를 사용하였을 때 안정적이어서 SGD를 사용했다. (momentum=0.9, weight_decay=5e-4)
TTA: 다양한 transform을 적용하여 실험을 진행해보았다. 데이터 자체가 워낙 정형화 되어있는 탓인지 horizontal flip만 준게 가장 성능이 좋았다.