-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.py
80 lines (68 loc) · 1.9 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# encoding: utf-8
import warnings
import numpy as np
class DefaultConfig(object):
seed = 0
# dataset options
mode = 'retrieval'
# optimization options
label_smooth = 'on'
use_center = False
sampler = 'softmax_triplet' #softmax, triplet, softmax_triplet
sampler_new = True
loss_type = 'triplet' #'triplet_center', 'triplet', 'center', 'softmax', 'softmax_triplet'
triplet_weight = 1.3
center_weight = 0.0005
optim = 'adam'
max_epoch = 150
train_batch = 128
test_batch = 32
adjust_lr = True
lr = 0.00035
gamma = 0.1
weight_decay = 5e-4
momentum = 0.9
margin = None
num_instances = 4
num_gpu = 1
#data augment
PIXEL_MEAN = [0.485, 0.456, 0.406]
PROB = 0.5
RE_PROB = 0.5
PIXEL_STD = [0.229, 0.224, 0.225]
PADDING = 10
SIZE_TRAIN = [256, 128]
SIZE_TEST = [256, 128]
NUM_CLASS = 2465
# model option
model_name = 'resnet50' # triplet, softmax_triplet, bfe, ide
last_stride = 1
pretrained_model = '/home/zhoumi/.torch/models/resnet50-19c8e357.pth'
bnneck = 'bnneck' # bnneck, no
pretrained_choice = 'imagenet' #'imagenet' or 'self'
num_parts = 6
attention = False
feat = 256
sep_bn = False
# test option
neck_feat = 'after' #before after
eval_flip = False
re_ranking = False
norm = False
crop_validation = False
# miscs
print_freq = 10
eval_step = 10
save_dir = './pytorch-ckpt/market'
workers = 1
start_epoch = 0
best_rank = -np.inf
def _parse(self, kwargs):
for k, v in kwargs.items():
if not hasattr(self, k):
warnings.warn("Warning: opt has not attribut %s" % k)
setattr(self, k, v)
def _state_dict(self):
return {k: getattr(self, k) for k, _ in DefaultConfig.__dict__.items()
if not k.startswith('_')}
opt = DefaultConfig()