Open malpeddinilesh opened 3 years ago
Hi, After a few search, I find out triplet loss more effective than softmax loss. I read this two articles: 1) https://www.franciscosalg.com/triplet-loss/ 2) https://neptune.ai/blog/how-to-choose-loss-function-for-face-recognition
I test the original code and test that with triplet loss function (all other parameter same with previous test), I achieve about %1 more accuracy.
Hi @KaiyangZhou ,
I have custom datasets with 40 to 60 unique individuals. I am applying 2-step transfer learning and fine tuning pre-trained model OSNet AIN trained on MSMT.
I have following questions:
1) I am using triplet loss. As I have 40 to 60 unique individuals so I am thinking to use triplet loss. Shall I use triplet loss or softmax? 2) After training, model is getting over-fit and not generalized. It will be helpful if you provide feedback on this. 3) As I have limited custom datasets, it would be helpful if you provide your valuable feedback on steps / pre-cautions I should be taking to avoid model over-fitting.
Following is the configurations:
Show configuration adam: beta1: 0.9 beta2: 0.999 cuhk03: classic_split: False labeled_images: False use_metric_cuhk03: False data: combineall: False height: 256 k_tfm: 1 load_train_targets: False norm_mean: [0.485, 0.456, 0.406] norm_std: [0.229, 0.224, 0.225] root: reid-data save_dir: log/mytest_diff_triplet sources: ['mytest_diff'] split_id: 0 targets: ['mytest_diff'] transforms: ['random_flip', 'color_jitter'] type: image width: 128 workers: 4 loss: name: triplet softmax: label_smooth: True triplet: margin: 0.3 weight_t: 0.5 weight_x: 1.0 market1501: use_500k_distractors: False model: load_weights: ./osnet_x1_0/model/osnet_ain_x1_0_msmt17.pth name: osnet_ain_x1_0 pretrained: True resume: rmsprop: alpha: 0.99 sampler: num_cams: 1 num_datasets: 1 num_instances: 4 train_sampler: RandomSampler train_sampler_t: RandomSampler sgd: dampening: 0.0 momentum: 0.9 nesterov: False test: batch_size: 300 dist_metric: cosine eval_freq: 20 evaluate: False normalize_feature: False ranks: [1, 5, 10, 20] rerank: False start_eval: 0 visrank: False visrank_topk: 10 train: base_lr_mult: 0.1 batch_size: 64 fixbase_epoch: 10 gamma: 0.1 lr: 0.0015 lr_scheduler: single_step max_epoch: 60 new_layers: ['classifier'] open_layers: ['classifier'] optim: amsgrad print_freq: 20 seed: 1 staged_lr: False start_epoch: 0 stepsize: [30] weight_decay: 0.0005 use_gpu: True video: pooling_method: avg sample_method: evenly seq_len: 15