softmax_triplet.yaml 4.1 KB
Newer Older
W
weishengyu 已提交
1 2 3 4 5 6
# global configs
Global:
  checkpoints: null
  pretrained_model: null
  output_dir: "./output/"
  device: "gpu"
H
HydrogenSulfate 已提交
7
  save_interval: 40
W
weishengyu 已提交
8
  eval_during_train: True
W
dbg  
weishengyu 已提交
9
  eval_interval: 10
W
weishengyu 已提交
10
  epochs: 120
11
  print_batch_step: 20
W
weishengyu 已提交
12
  use_visualdl: False
H
HydrogenSulfate 已提交
13
  eval_mode: "retrieval"
H
HydrogenSulfate 已提交
14
  retrieval_feature_from: "features" # 'backbone' or 'features'
H
HydrogenSulfate 已提交
15
  re_ranking: False
W
weishengyu 已提交
16 17 18 19 20 21 22 23 24 25
  # used for static mode and model export
  image_shape: [3, 256, 128]
  save_inference_dir: "./inference"

# model architecture
Arch:
  name: "RecModel"
  infer_output_key: "features"
  infer_add_softmax: False
  Backbone:
W
weishengyu 已提交
26
    name: "ResNet50_last_stage_stride1"
H
HydrogenSulfate 已提交
27
    pretrained: https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/others/resnet50-19c8e357_torch2paddle.pdparams
W
dbg  
weishengyu 已提交
28
    stem_act: null
W
weishengyu 已提交
29
  BackboneStopLayer:
W
dbg  
weishengyu 已提交
30
    name: "flatten"
W
dbg  
weishengyu 已提交
31 32
  Neck:
    name: BNNeck
H
HydrogenSulfate 已提交
33
    num_features: &feat_dim 2048
H
HydrogenSulfate 已提交
34 35 36 37 38 39 40 41
    weight_attr:
      initializer:
        name: Constant
        value: 1.0
    bias_attr:
      initializer:
        name: Constant
        value: 0.0
H
HydrogenSulfate 已提交
42
      learning_rate: 1.0e-20 # NOTE: Temporarily set lr small enough to freeze the bias to zero
W
weishengyu 已提交
43 44
  Head:
    name: "FC"
H
HydrogenSulfate 已提交
45
    embedding_size: *feat_dim
H
HydrogenSulfate 已提交
46
    class_num: 751
H
HydrogenSulfate 已提交
47 48 49 50 51
    weight_attr:
      initializer:
        name: Normal
        std: 0.001
    bias_attr: False
W
weishengyu 已提交
52 53 54 55 56 57

# loss function config for traing/eval process
Loss:
  Train:
    - CELoss:
        weight: 1.0
W
weishengyu 已提交
58
        epsilon: 0.1
W
dbg  
weishengyu 已提交
59
    - TripletLossV2:
W
weishengyu 已提交
60
        weight: 1.0
W
weishengyu 已提交
61
        margin: 0.3
H
HydrogenSulfate 已提交
62 63
        normalize_feature: False
        feature_from: "backbone"
W
weishengyu 已提交
64 65 66 67 68 69 70 71
  Eval:
    - CELoss:
        weight: 1.0

Optimizer:
  name: Adam
  lr:
    name: Piecewise
W
dbg  
weishengyu 已提交
72 73
    decay_epochs: [30, 60]
    values: [0.00035, 0.000035, 0.0000035]
W
weishengyu 已提交
74 75
    warmup_epoch: 10
    warmup_start_lr: 0.0000035
H
HydrogenSulfate 已提交
76 77
    by_epoch: True
    last_epoch: 0
W
weishengyu 已提交
78 79 80 81 82 83 84 85
  regularizer:
    name: 'L2'
    coeff: 0.0005

# data loader for train and eval
DataLoader:
  Train:
    dataset:
H
HydrogenSulfate 已提交
86 87 88
        name: "Market1501"
        image_root: "./dataset/"
        cls_label_path: "bounding_box_train"
H
HydrogenSulfate 已提交
89
        backend: "pil"
W
weishengyu 已提交
90 91
        transform_ops:
          - ResizeImage:
W
dbg  
weishengyu 已提交
92
              size: [128, 256]
H
HydrogenSulfate 已提交
93
              return_numpy: False
94
              interpolation: 'bilinear'
H
HydrogenSulfate 已提交
95
              backend: "pil"
W
weishengyu 已提交
96 97
          - RandFlipImage:
              flip_code: 1
W
dbg  
weishengyu 已提交
98 99
          - Pad:
              padding: 10
H
HydrogenSulfate 已提交
100
          - RandCropImageV2:
W
dbg  
weishengyu 已提交
101
              size: [128, 256]
H
HydrogenSulfate 已提交
102 103
          - ToTensor:
          - Normalize:
W
weishengyu 已提交
104 105 106 107 108 109 110
              mean: [0.485, 0.456, 0.406]
              std: [0.229, 0.224, 0.225]
          - RandomErasing:
              EPSILON: 0.5
              sl: 0.02
              sh: 0.4
              r1: 0.3
H
HydrogenSulfate 已提交
111
              mean: [0.485, 0.456, 0.406]
W
weishengyu 已提交
112
    sampler:
W
weishengyu 已提交
113
        name: DistributedRandomIdentitySampler
W
dbg  
weishengyu 已提交
114
        batch_size: 64
W
weishengyu 已提交
115
        num_instances: 4
H
HydrogenSulfate 已提交
116
        drop_last: False
W
weishengyu 已提交
117 118
        shuffle: True
    loader:
H
HydrogenSulfate 已提交
119
        num_workers: 4
W
weishengyu 已提交
120 121 122 123
        use_shared_memory: True
  Eval:
    Query:
      dataset:
H
HydrogenSulfate 已提交
124 125 126
        name: "Market1501"
        image_root: "./dataset/"
        cls_label_path: "query"
H
HydrogenSulfate 已提交
127
        backend: "pil"
W
weishengyu 已提交
128 129
        transform_ops:
          - ResizeImage:
W
dbg  
weishengyu 已提交
130
              size: [128, 256]
H
HydrogenSulfate 已提交
131
              return_numpy: False
132
              interpolation: 'bilinear'
H
HydrogenSulfate 已提交
133
              backend: "pil"
H
HydrogenSulfate 已提交
134 135
          - ToTensor:
          - Normalize:
W
weishengyu 已提交
136 137 138 139
              mean: [0.485, 0.456, 0.406]
              std: [0.229, 0.224, 0.225]
      sampler:
        name: DistributedBatchSampler
W
dbg  
weishengyu 已提交
140
        batch_size: 128
W
weishengyu 已提交
141 142 143
        drop_last: False
        shuffle: False
      loader:
H
HydrogenSulfate 已提交
144
        num_workers: 4
W
weishengyu 已提交
145 146 147 148
        use_shared_memory: True

    Gallery:
      dataset:
H
HydrogenSulfate 已提交
149 150 151
        name: "Market1501"
        image_root: "./dataset/"
        cls_label_path: "bounding_box_test"
H
HydrogenSulfate 已提交
152
        backend: "pil"
W
weishengyu 已提交
153 154
        transform_ops:
          - ResizeImage:
W
dbg  
weishengyu 已提交
155
              size: [128, 256]
H
HydrogenSulfate 已提交
156
              return_numpy: False
157
              interpolation: 'bilinear'
H
HydrogenSulfate 已提交
158
              backend: "pil"
H
HydrogenSulfate 已提交
159 160
          - ToTensor:
          - Normalize:
W
weishengyu 已提交
161 162 163 164
              mean: [0.485, 0.456, 0.406]
              std: [0.229, 0.224, 0.225]
      sampler:
        name: DistributedBatchSampler
W
dbg  
weishengyu 已提交
165
        batch_size: 128
W
weishengyu 已提交
166 167 168
        drop_last: False
        shuffle: False
      loader:
H
HydrogenSulfate 已提交
169
        num_workers: 4
W
weishengyu 已提交
170 171 172 173 174 175 176
        use_shared_memory: True

Metric:
  Eval:
    - Recallk:
        topk: [1, 5]
    - mAP: {}