|
configs/etri.yaml파일 생성
DEVICE : cuda # device used for training and evaluation (cpu, cuda, cuda0, cuda1, ...)
SAVE_DIR : 'output' # output folder name used for saving the model, logs and inference results
MODEL:
NAME : DDRNet # name of the model you are using
BACKBONE : DDRNet-23slim # model variant
PRETRAINED : 'C:/semantic-segmentation/DDRNet-23slim.pth' # backbone model's weight
DATASET:
NAME : ETRI # dataset name to be trained with (camvid, cityscapes, ade20k)
ROOT : 'data/etri' # dataset root path
IGNORE_LABEL : 255
TRAIN:
IMAGE_SIZE : [512, 512] # training image size in (h, w)
BATCH_SIZE : 2 # batch size used to train
EPOCHS : 200 # number of epochs to train
EVAL_INTERVAL : 20 # evaluation interval during training
AMP : false # use AMP in training
DDP : false # use DDP training
LOSS:
NAME : OhemCrossEntropy # loss function name (ohemce, ce, dice)
CLS_WEIGHTS : false # use class weights in loss calculation
OPTIMIZER:
NAME : adamw # optimizer name
LR : 0.01 # initial learning rate used in optimizer
WEIGHT_DECAY : 0.01 # decay rate used in optimizer
SCHEDULER:
NAME : warmuppolylr # scheduler name
POWER : 0.9 # scheduler power
WARMUP : 10 # warmup epochs used in scheduler
WARMUP_RATIO : 0.1 # warmup ratio
EVAL:
MODEL_PATH : 'output/etri/best.pth' # trained model file path
IMAGE_SIZE : [1024, 1024] # evaluation image size in (h, w)
MSF:
ENABLE : false # multi-scale and flip evaluation
FLIP : true # use flip in evaluation
SCALES : [0.5, 0.75, 1.0, 1.25, 1.5, 1.75] # scales used in MSF evaluation
TEST:
MODEL_PATH : 'output/etri/best.pth' # trained model file path
FILE : 'data/etri/test' # filename or foldername
IMAGE_SIZE : [1024, 1024] # inference image size in (h, w)
OVERLAY : true # save the overlay result (image_alpha+label_alpha)
models/ddrnet.py 클래스 개수 보완 (DDRNet.init_pretrained())
학습 결과
DDRNet의 원본은 클래스의 수가 12이고 ETRI는 42개의 클래스를 가진 데이터셋.
가중치를 가져온다 하여도 해당 클래스의 학습에 도움이 되는가에 대해서는 불확실.
Evaluating이 20Epoch마다 진행되는 이유는 내부 코드의 기본값이 Evaluating을 20Epoch마다 진행되도록 되어있기 때문
다음 학습으로 동일한 환경에 1Epoch마다 Evaluating을 진행할 때로 재학습 예정.
학습되어있는 모델로 추론 돌린 결과.
추론 명령어
python .\tools\infer.py --cfg .\configs\etri.yaml
이미지 한장에 대한 순수 추론 시간
Elapsed time : 8.76ms ~ 10.39ms
추론 이미지 사이즈 : Train : [1024x1664], 외부 Test : [1024x2048]
간단한 형태의 클래스는 어느정도 인식하는 것을 확인 가능.
원본 모델과의 비교는 데이터셋이 일치하지 않아 비교 불가.