config package

Submodules

config.configs module

class config.configs.Config

Bases: config.default.DefaultConfig

must set data dir here

self.DATA_DIR = 'path to your dir'

self.PRETRAIN_PATH = 'path to your pretrained resnet 50 model'

self.CLASSNUM training class number, default set CUB as 200

self.TEST_WEIGHT testing weight set here

self.TRAIN_BN_MOM BatchNorm momentum

self.HARD_FACTOR not used

self.LOSS_TYPE set your loss function here, default set softmax means softmax cross entropy

config.default module

It is NOT RECOMMENDED for developers to modify the base class directly. Instead, they should re derive a new configuration class in configs.py

class config.default.DefaultConfig

Bases: object

Base configuration class for perparameter settings. All new configuration should be derived from this class.

PROJECT_NAME: project name

LOG_DIR: log directory

OUTPUT_DIR: saved model directory

DEVICE_ID: GPU IDs, i.e. "0,1,2" for multiple GPUs

LOG_PERIOD = 50 : iteration of displaying training log

CHECKPOINT_PERIOD : saving model period

EVAL_PERIOD = 10 : validation period

MAX_EPOCHS = 200 :max training epochs

DATA_DIR : dataset path

DATALOADER_NUM_WORKERS : number of dataloader workers

GROUP_SAMPLING = 'on' : enable for the group-wise learning

SAMPLER = 'triplet': batch sampler, option: 'triplet','softmax'

BATCH_SIZE : MxN, M: number of classes, N: number of images of per class

NUM_IMG_PER_ID : N, number of images of per class

INPUT_SIZE : HxW set as 600*600 in other work for high performance

MODEL_NAME :backbone name, option: 'resnet50',

LAST_STRIDE : the stride of the last layer of resnet50

PRETRAIN_CHOICE : 'imagenet', load image net pretraining model

PRETRAIN_PATH : pretrained weight path, should be automatically downloaded if not specify

LOSS_TYPE: option: 'triplet+softmax','softmax+center','triplet+softmax+center'

LOSS_LABELSMOOTH : using labelsmooth, option: 'on', 'off'

COS_LAYER : using cosface for learning default False

OPTIMIZER = SGD / Adam

BASE_LR :base learning rate

CE_LOSS_WEIGHT :weight of softmax loss

TRIPLET_LOSS_WEIGHT: setting for improve performance default:unused

CENTER_LOSS_WEIGHT : setting for improve performance default:unused

CENTER_LR: learning rate for the weights of center loss,setting for improve performance default:unused

MARGIN : triplet loss margin, setting for improve performance default:unused

self.STEPS :learning rate decay steps, can be modified

self.GAMMA : decay factor of learning rate

self.WARMUP_EPOCHS : warm up epochs, can be disabled

self.WARMUP_METHOD : option: 'linear','constant'

# configuration for graph module

GRAPH_OPTION : option: 'on','off', set for on if use this module

LEARNABLE_TRANSFORM : option 'all', 'single'

GRAPH_METHOD : option: 'dynamic','static' # set for static with average aggregation

configuration for test script

self.FEAT_NORM

self.FLIP_FEATS : using fliped feature for testing, option: 'on', 'off', enable this for higher performance

Module contents

class config.Config

Bases: config.default.DefaultConfig

must set data dir here

self.DATA_DIR = 'path to your dir'

self.PRETRAIN_PATH = 'path to your pretrained resnet 50 model'

self.CLASSNUM training class number, default set CUB as 200

self.TEST_WEIGHT testing weight set here

self.TRAIN_BN_MOM BatchNorm momentum

self.HARD_FACTOR not used

self.LOSS_TYPE set your loss function here, default set softmax means softmax cross entropy