|
import os |
|
from yacs.config import CfgNode as CN |
|
|
|
|
|
_C = CN() |
|
|
|
_C.LOG_DIR = 'runs/' |
|
_C.GPUS = (0,1) |
|
_C.WORKERS = 8 |
|
_C.PIN_MEMORY = False |
|
_C.PRINT_FREQ = 20 |
|
_C.AUTO_RESUME =False |
|
_C.NEED_AUTOANCHOR = False |
|
_C.DEBUG = False |
|
_C.num_seg_class = 2 |
|
|
|
|
|
_C.CUDNN = CN() |
|
_C.CUDNN.BENCHMARK = True |
|
_C.CUDNN.DETERMINISTIC = False |
|
_C.CUDNN.ENABLED = True |
|
|
|
|
|
|
|
_C.MODEL = CN(new_allowed=True) |
|
_C.MODEL.NAME = '' |
|
_C.MODEL.STRU_WITHSHARE = False |
|
_C.MODEL.HEADS_NAME = [''] |
|
_C.MODEL.PRETRAINED = "" |
|
_C.MODEL.PRETRAINED_DET = "" |
|
_C.MODEL.IMAGE_SIZE = [640, 640] |
|
_C.MODEL.EXTRA = CN(new_allowed=True) |
|
|
|
|
|
|
|
_C.LOSS = CN(new_allowed=True) |
|
_C.LOSS.LOSS_NAME = '' |
|
_C.LOSS.MULTI_HEAD_LAMBDA = None |
|
_C.LOSS.FL_GAMMA = 0.0 |
|
_C.LOSS.CLS_POS_WEIGHT = 1.0 |
|
_C.LOSS.OBJ_POS_WEIGHT = 1.0 |
|
_C.LOSS.SEG_POS_WEIGHT = 1.0 |
|
_C.LOSS.BOX_GAIN = 0.05 |
|
_C.LOSS.CLS_GAIN = 0.5 |
|
_C.LOSS.OBJ_GAIN = 1.0 |
|
_C.LOSS.DA_SEG_GAIN = 0.2 |
|
_C.LOSS.LL_SEG_GAIN = 0.2 |
|
_C.LOSS.LL_IOU_GAIN = 0.2 |
|
|
|
|
|
|
|
_C.DATASET = CN(new_allowed=True) |
|
_C.DATASET.DATAROOT = '/home/zwt/bdd/bdd100k/images/100k' |
|
_C.DATASET.LABELROOT = '/home/zwt/bdd/bdd100k/labels/100k' |
|
_C.DATASET.MASKROOT = '/home/zwt/bdd/bdd_seg_gt' |
|
_C.DATASET.LANEROOT = '/home/zwt/bdd/bdd_lane_gt' |
|
_C.DATASET.DATASET = 'BddDataset' |
|
_C.DATASET.TRAIN_SET = 'train' |
|
_C.DATASET.TEST_SET = 'val' |
|
_C.DATASET.DATA_FORMAT = 'jpg' |
|
_C.DATASET.SELECT_DATA = False |
|
_C.DATASET.ORG_IMG_SIZE = [720, 1280] |
|
|
|
|
|
_C.DATASET.FLIP = True |
|
_C.DATASET.SCALE_FACTOR = 0.25 |
|
_C.DATASET.ROT_FACTOR = 10 |
|
_C.DATASET.TRANSLATE = 0.1 |
|
_C.DATASET.SHEAR = 0.0 |
|
_C.DATASET.COLOR_RGB = False |
|
_C.DATASET.HSV_H = 0.015 |
|
_C.DATASET.HSV_S = 0.7 |
|
_C.DATASET.HSV_V = 0.4 |
|
|
|
|
|
|
|
|
|
_C.TRAIN = CN(new_allowed=True) |
|
_C.TRAIN.LR0 = 0.001 |
|
_C.TRAIN.LRF = 0.2 |
|
_C.TRAIN.WARMUP_EPOCHS = 3.0 |
|
_C.TRAIN.WARMUP_BIASE_LR = 0.1 |
|
_C.TRAIN.WARMUP_MOMENTUM = 0.8 |
|
|
|
_C.TRAIN.OPTIMIZER = 'adam' |
|
_C.TRAIN.MOMENTUM = 0.937 |
|
_C.TRAIN.WD = 0.0005 |
|
_C.TRAIN.NESTEROV = True |
|
_C.TRAIN.GAMMA1 = 0.99 |
|
_C.TRAIN.GAMMA2 = 0.0 |
|
|
|
_C.TRAIN.BEGIN_EPOCH = 0 |
|
_C.TRAIN.END_EPOCH = 240 |
|
|
|
_C.TRAIN.VAL_FREQ = 1 |
|
_C.TRAIN.BATCH_SIZE_PER_GPU =24 |
|
_C.TRAIN.SHUFFLE = True |
|
|
|
_C.TRAIN.IOU_THRESHOLD = 0.2 |
|
_C.TRAIN.ANCHOR_THRESHOLD = 4.0 |
|
|
|
|
|
|
|
_C.TRAIN.SEG_ONLY = False |
|
_C.TRAIN.DET_ONLY = False |
|
_C.TRAIN.ENC_SEG_ONLY = False |
|
_C.TRAIN.ENC_DET_ONLY = False |
|
|
|
|
|
_C.TRAIN.DRIVABLE_ONLY = False |
|
_C.TRAIN.LANE_ONLY = False |
|
_C.TRAIN.DET_ONLY = False |
|
|
|
|
|
|
|
|
|
_C.TRAIN.PLOT = True |
|
|
|
|
|
_C.TEST = CN(new_allowed=True) |
|
_C.TEST.BATCH_SIZE_PER_GPU = 24 |
|
_C.TEST.MODEL_FILE = '' |
|
_C.TEST.SAVE_JSON = False |
|
_C.TEST.SAVE_TXT = False |
|
_C.TEST.PLOTS = True |
|
_C.TEST.NMS_CONF_THRESHOLD = 0.001 |
|
_C.TEST.NMS_IOU_THRESHOLD = 0.6 |
|
|
|
|
|
def update_config(cfg, args): |
|
cfg.defrost() |
|
|
|
|
|
if args.modelDir: |
|
cfg.OUTPUT_DIR = args.modelDir |
|
|
|
if args.logDir: |
|
cfg.LOG_DIR = args.logDir |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cfg.freeze() |
|
|