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()
|
2019-09-20 18:48:15 +08:00
|
|
|
_C.MODEL.DIST_BACKEND = 'dp'
|
2020-01-20 21:33:37 +08:00
|
|
|
_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
|
2019-08-23 07:49:03 +08:00
|
|
|
_C.MODEL.WITH_IBN = False
|
2020-01-17 18:55:57 +08:00
|
|
|
# If use SE block
|
|
|
|
_C.MODEL.WITH_SE = False
|
2019-08-23 07:49:03 +08:00
|
|
|
# Global Context Block configuration
|
|
|
|
_C.MODEL.STAGE_WITH_GCB = (False, False, False, False)
|
|
|
|
_C.MODEL.GCB = CN()
|
|
|
|
_C.MODEL.GCB.ratio = 1./16.
|
2020-01-20 21:33:37 +08:00
|
|
|
# If use ImageNet pretrain model
|
2019-08-20 09:36:47 +08:00
|
|
|
_C.MODEL.PRETRAIN = True
|
|
|
|
# Pretrain model path
|
2019-01-10 18:39:31 +08:00
|
|
|
_C.MODEL.PRETRAIN_PATH = ''
|
2020-01-20 21:33:37 +08:00
|
|
|
_C.MODEL.META_ARCHITECTURE = 'Baseline'
|
2019-08-23 07:49:03 +08:00
|
|
|
|
2020-01-20 21:33:37 +08:00
|
|
|
|
|
|
|
# ---------------------------------------------------------------------------- #
|
|
|
|
# REID HEADS options
|
|
|
|
# ---------------------------------------------------------------------------- #
|
|
|
|
_C.MODEL.REID_HEADS = CN()
|
|
|
|
_C.MODEL.REID_HEADS.NAME = "BaselineHeads"
|
|
|
|
# Number of identity classes
|
|
|
|
_C.MODEL.REID_HEADS.NUM_CLASSES = 751
|
|
|
|
|
|
|
|
_C.MODEL.REID_HEADS.MARGIN = 0.3
|
|
|
|
_C.MODEL.REID_HEADS.SMOOTH_ON = False
|
|
|
|
|
|
|
|
# Path (possibly with schema like catalog:// or detectron2://) to a checkpoint file
|
|
|
|
# to be loaded to the model. You can find available models in the model zoo.
|
|
|
|
_C.MODEL.WEIGHTS = ""
|
|
|
|
|
|
|
|
# Values to be used for image normalization
|
|
|
|
_C.MODEL.PIXEL_MEAN = [0.485*255, 0.456*255, 0.406*255]
|
|
|
|
# Values to be used for image normalization
|
|
|
|
_C.MODEL.PIXEL_STD = [0.229*255, 0.224*255, 0.225*255]
|
2019-08-20 09:36:47 +08:00
|
|
|
#
|
2020-01-20 21:33:37 +08:00
|
|
|
|
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]
|
2020-01-20 21:33:37 +08:00
|
|
|
|
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
|
2020-01-20 21:33:37 +08:00
|
|
|
|
2019-01-10 18:39:31 +08:00
|
|
|
# Value of padding size
|
2019-08-07 16:54:50 +08:00
|
|
|
_C.INPUT.DO_PAD = True
|
2019-09-04 00:05:03 +08:00
|
|
|
_C.INPUT.PADDING_MODE = 'constant'
|
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
|
2020-01-17 18:55:57 +08:00
|
|
|
_C.INPUT.BRIGHTNESS = 0.4
|
|
|
|
_C.INPUT.CONTRAST = 0.4
|
2019-09-04 00:05:03 +08:00
|
|
|
# Random erasing
|
2020-01-17 18:55:57 +08:00
|
|
|
_C.INPUT.RE = CN()
|
|
|
|
_C.INPUT.RE.DO = True
|
|
|
|
_C.INPUT.RE.PROB = 0.5
|
2020-01-20 21:33:37 +08:00
|
|
|
_C.INPUT.RE.MEAN = [0.485, 0.456, 0.406]
|
2020-01-17 18:55:57 +08:00
|
|
|
# Cutout
|
|
|
|
_C.INPUT.CUTOUT = CN()
|
|
|
|
_C.INPUT.CUTOUT.DO = False
|
|
|
|
_C.INPUT.CUTOUT.PROB = 0.5
|
|
|
|
_C.INPUT.CUTOUT.SIZE = 64
|
|
|
|
_C.INPUT.CUTOUT.MEAN = [0, 0, 0]
|
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
|
2019-08-21 09:35:34 +08:00
|
|
|
_C.DATASETS.NAMES = ("market1501",)
|
2019-08-13 13:52:25 +08:00
|
|
|
# List of the dataset names for testing
|
2020-01-20 21:33:37 +08:00
|
|
|
_C.DATASETS.TEST = ("market1501",)
|
2019-01-10 18:39:31 +08:00
|
|
|
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# DataLoader
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
_C.DATALOADER = CN()
|
|
|
|
# Sampler for data loading
|
|
|
|
_C.DATALOADER.SAMPLER = 'softmax'
|
2019-09-04 00:05:03 +08:00
|
|
|
# Number of instance for each person
|
|
|
|
_C.DATALOADER.NUM_INSTANCE = 4
|
2019-09-20 18:48:15 +08:00
|
|
|
_C.DATALOADER.NUM_WORKERS = 8
|
2019-01-10 18:39:31 +08:00
|
|
|
|
|
|
|
# ---------------------------------------------------------------------------- #
|
|
|
|
# Solver
|
|
|
|
# ---------------------------------------------------------------------------- #
|
|
|
|
_C.SOLVER = CN()
|
2019-09-04 00:05:03 +08:00
|
|
|
_C.SOLVER.DIST = False
|
|
|
|
|
2019-08-20 09:36:47 +08:00
|
|
|
_C.SOLVER.OPT = "adam"
|
2019-01-10 18:39:31 +08:00
|
|
|
|
2020-01-20 21:33:37 +08:00
|
|
|
_C.SOLVER.MAX_ITER = 40000
|
2019-01-10 18:39:31 +08:00
|
|
|
|
|
|
|
_C.SOLVER.BASE_LR = 3e-4
|
2019-09-04 00:05:03 +08:00
|
|
|
_C.SOLVER.BIAS_LR_FACTOR = 1
|
2019-01-10 18:39:31 +08:00
|
|
|
|
|
|
|
_C.SOLVER.MOMENTUM = 0.9
|
|
|
|
|
|
|
|
_C.SOLVER.WEIGHT_DECAY = 0.0005
|
|
|
|
_C.SOLVER.WEIGHT_DECAY_BIAS = 0.
|
|
|
|
|
|
|
|
_C.SOLVER.GAMMA = 0.1
|
|
|
|
_C.SOLVER.STEPS = (30, 55)
|
|
|
|
|
2019-09-20 18:48:15 +08:00
|
|
|
_C.SOLVER.WARMUP_FACTOR = 0.1
|
|
|
|
_C.SOLVER.WARMUP_ITERS = 10
|
2019-01-10 18:39:31 +08:00
|
|
|
_C.SOLVER.WARMUP_METHOD = "linear"
|
|
|
|
|
2020-01-20 21:33:37 +08:00
|
|
|
_C.SOLVER.CHECKPOINT_PERIOD = 5000
|
|
|
|
|
|
|
|
_C.SOLVER.LOG_PERIOD = 30
|
2019-01-10 18:39:31 +08:00
|
|
|
# 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()
|
2020-01-20 21:33:37 +08:00
|
|
|
|
|
|
|
_C.TEST.EVAL_PERIOD = 50
|
2019-01-10 18:39:31 +08:00
|
|
|
_C.TEST.IMS_PER_BATCH = 128
|
2019-09-04 00:05:03 +08:00
|
|
|
_C.TEST.NORM = True
|
2019-01-10 18:39:31 +08:00
|
|
|
_C.TEST.WEIGHT = ""
|
|
|
|
|
|
|
|
# ---------------------------------------------------------------------------- #
|
|
|
|
# Misc options
|
|
|
|
# ---------------------------------------------------------------------------- #
|
2020-01-17 18:55:57 +08:00
|
|
|
_C.OUTPUT_DIR = "logs/"
|
2020-01-20 21:33:37 +08:00
|
|
|
|
|
|
|
# Benchmark different cudnn algorithms.
|
|
|
|
# If input images have very different sizes, this option will have large overhead
|
|
|
|
# for about 10k iterations. It usually hurts total time, but can benefit for certain models.
|
|
|
|
# If input images have the same or similar sizes, benchmark is often helpful.
|
|
|
|
_C.CUDNN_BENCHMARK = False
|
|
|
|
|