fast-reid/config/defaults.py

125 lines
4.0 KiB
Python
Raw Normal View History

2019-01-10 18:39:31 +08:00
from yacs.config import CfgNode as CN
# -----------------------------------------------------------------------------
# Convention about Training / Test specific parameters
# -----------------------------------------------------------------------------
# Whenever an argument can be either used for training or for testing, the
# corresponding name will be post-fixed by a _TRAIN for a training parameter,
# or _TEST for a test-specific parameter.
# For example, the number of images during training will be
# IMAGES_PER_BATCH_TRAIN, while the number of images for testing will be
# IMAGES_PER_BATCH_TEST
# -----------------------------------------------------------------------------
# Config definition
# -----------------------------------------------------------------------------
_C = CN()
2019-08-20 09:36:47 +08:00
# -----------------------------------------------------------------------------
# MODEL
# -----------------------------------------------------------------------------
2019-01-10 18:39:31 +08:00
_C.MODEL = CN()
_C.MODEL.DEVICE = "cuda"
2019-08-20 09:36:47 +08:00
# Model backbone
2019-08-13 13:52:25 +08:00
_C.MODEL.BACKBONE = 'resnet50'
2019-08-20 09:36:47 +08:00
# Last stride for backbone
2019-01-10 18:39:31 +08:00
_C.MODEL.LAST_STRIDE = 1
2019-08-20 09:36:47 +08:00
# If use IBN block
_C.MODEL.IBN = False
# If use imagenet pretrain model
_C.MODEL.PRETRAIN = True
# Pretrain model path
2019-01-10 18:39:31 +08:00
_C.MODEL.PRETRAIN_PATH = ''
2019-08-20 09:36:47 +08:00
# Checkpoint for continuing training
_C.MODEL.CHECKPOINT = ''
#
2019-01-10 18:39:31 +08:00
# -----------------------------------------------------------------------------
# INPUT
# -----------------------------------------------------------------------------
_C.INPUT = CN()
# Size of the image during training
2019-04-21 13:38:55 +08:00
_C.INPUT.SIZE_TRAIN = [256, 128]
2019-01-10 18:39:31 +08:00
# Size of the image during test
2019-04-21 13:38:55 +08:00
_C.INPUT.SIZE_TEST = [256, 128]
2019-01-10 18:39:31 +08:00
# Random probability for image horizontal flip
2019-08-07 16:54:50 +08:00
_C.INPUT.DO_FLIP = True
_C.INPUT.FLIP_PROB = 0.5
2019-01-10 18:39:31 +08:00
# Values to be used for image normalization
_C.INPUT.PIXEL_MEAN = [0.485, 0.456, 0.406]
# Values to be used for image normalization
_C.INPUT.PIXEL_STD = [0.229, 0.224, 0.225]
# Value of padding size
2019-08-07 16:54:50 +08:00
_C.INPUT.DO_PAD = True
_C.INPUT.PADDING_MODE = 'zeros'
2019-01-10 18:39:31 +08:00
_C.INPUT.PADDING = 10
2019-08-07 16:54:50 +08:00
# Random lightning and contrast change
2019-08-13 13:52:25 +08:00
_C.INPUT.DO_LIGHTING = False
2019-08-07 16:54:50 +08:00
_C.INPUT.MAX_LIGHTING = 0.2
_C.INPUT.P_LIGHTING=0.75
2019-08-14 14:50:44 +08:00
2019-01-10 18:39:31 +08:00
# -----------------------------------------------------------------------------
# Dataset
# -----------------------------------------------------------------------------
_C.DATASETS = CN()
2019-08-13 13:52:25 +08:00
# List of the dataset names for training
_C.DATASETS.NAMES = ("market1501",)
2019-08-13 13:52:25 +08:00
# List of the dataset names for testing
_C.DATASETS.TEST_NAMES = "market1501"
2019-01-10 18:39:31 +08:00
# -----------------------------------------------------------------------------
# DataLoader
# -----------------------------------------------------------------------------
_C.DATALOADER = CN()
# Number of data loading threads
_C.DATALOADER.NUM_WORKERS = 8
# Sampler for data loading
_C.DATALOADER.SAMPLER = 'softmax'
# Number of instance for one batch
_C.DATALOADER.NUM_INSTANCE = 16
# ---------------------------------------------------------------------------- #
# Solver
# ---------------------------------------------------------------------------- #
_C.SOLVER = CN()
2019-08-20 09:36:47 +08:00
_C.SOLVER.OPT = "adam"
2019-01-10 18:39:31 +08:00
_C.SOLVER.LOSSTYPE = ("softmax",)
2019-01-10 18:39:31 +08:00
_C.SOLVER.MAX_EPOCHS = 50
_C.SOLVER.BASE_LR = 3e-4
_C.SOLVER.BIAS_LR_FACTOR = 2
_C.SOLVER.MOMENTUM = 0.9
_C.SOLVER.MARGIN = 0.3
_C.SOLVER.WEIGHT_DECAY = 0.0005
_C.SOLVER.WEIGHT_DECAY_BIAS = 0.
_C.SOLVER.GAMMA = 0.1
_C.SOLVER.STEPS = (30, 55)
_C.SOLVER.WARMUP_FACTOR = 1.0 / 3
_C.SOLVER.WARMUP_ITERS = 500
_C.SOLVER.WARMUP_METHOD = "linear"
_C.SOLVER.CHECKPOINT_PERIOD = 50
_C.SOLVER.LOG_PERIOD = 100
_C.SOLVER.EVAL_PERIOD = 50
# Number of images per batch
# This is global, so if we have 8 GPUs and IMS_PER_BATCH = 16, each GPU will
# see 2 images per batch
_C.SOLVER.IMS_PER_BATCH = 64
# This is global, so if we have 8 GPUs and IMS_PER_BATCH = 16, each GPU will
# see 2 images per batch
_C.TEST = CN()
_C.TEST.IMS_PER_BATCH = 128
_C.TEST.WEIGHT = ""
# ---------------------------------------------------------------------------- #
# Misc options
# ---------------------------------------------------------------------------- #
2019-07-29 20:57:19 +08:00
_C.OUTPUT_DIR = ""