This paper introduces a negative margin loss to metric learning based few-shot learning methods. The negative margin loss significantly outperforms regular softmax loss, and achieves state-of-the-art accuracy on three standard few-shot classification benchmarks with few bells and whistles. These results are contrary to the common practice in the metric learning field, that the margin is zero or positive. To understand why the negative margin loss performs well for the few-shot classification, we analyze the discriminability of learned features w.r.t different margins for training and novel classes, both empirically and theoretically. We find that although negative margin reduces the feature discriminability for training classes, it may also avoid falsely mapping samples of the same novel class to multiple peaks or clusters, and thus benefit the discrimination of novel classes. Code is available at https://github.com/bl0/negative-margin.few-shot.
@inproceedings{liu2020negative,
title={Negative margin matters: Understanding margin in few-shot classification},
author={Liu, Bin and Cao, Yue and Lin, Yutong and Li, Qi and Zhang, Zheng and Long, Mingsheng and Hu, Han},
booktitle={European Conference on Computer Vision},
pages={438--455},
year={2020}
}
It consists of two steps:
Step1: Base training
Step2: Meta Testing:
${WORK_DIR}/${CONFIG}/best_accuracy_mean.pth
in default.# base training
python ./tools/classification/train.py \
configs/classification/neg_margin/cub/neg-margin_cosine_conv4_1xb64_cub_5way-1shot.py
# meta testing
python ./tools/classification/test.py \
configs/classification/neg_margin/cub/neg-margin_cosine_conv4_1xb64_cub_5way-1shot.py \
work_dir/neg-margin_cosine_conv4_1xb64_cub_5way-1shot/best_accuracy_mean.pth
Note:
Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log |
---|---|---|---|---|---|---|---|---|
conv4 | 84x84 | 64 | 5 | 1 | 64.08 | 0.48 | ckpt | log |
conv4 | 84x84 | 64 | 5 | 5 | 80.69 | 0.34 | ⇑ | ⇑ |
resnet12 | 84x84 | 64 | 5 | 1 | 78.54 | 0.46 | ckpt | log |
resnet12 | 84x84 | 64 | 5 | 5 | 90.19 | 0.24 | ⇑ | ⇑ |
Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log |
---|---|---|---|---|---|---|---|---|
conv4 | 84x84 | 64 | 5 | 1 | 51.15 | 0.42 | ckpt | log |
conv4 | 84x84 | 64 | 5 | 5 | 67.32 | 0.37 | ⇑ | ⇑ |
resnet12 | 84x84 | 64 | 5 | 1 | 61.7 | 0.46 | ckpt | log |
resnet12 | 84x84 | 64 | 5 | 5 | 78.03 | 0.33 | ⇑ | ⇑ |
Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log |
---|---|---|---|---|---|---|---|---|
conv4 | 84x84 | 64 | 5 | 1 | 54.07 | 0.49 | ckpt | log |
conv4 | 84x84 | 64 | 5 | 5 | 70.25 | 0.41 | ⇑ | ⇑ |
resnet12 | 84x84 | 64 | 5 | 1 | 65.88 | 0.53 | ckpt | log |
resnet12 | 84x84 | 64 | 5 | 5 | 81.06 | 0.39 | ⇑ | ⇑ |
Вы можете оставить комментарий после Вход в систему
Неприемлемый контент может быть отображен здесь и не будет показан на странице. Вы можете проверить и изменить его с помощью соответствующей функции редактирования.
Если вы подтверждаете, что содержание не содержит непристойной лексики/перенаправления на рекламу/насилия/вульгарной порнографии/нарушений/пиратства/ложного/незначительного или незаконного контента, связанного с национальными законами и предписаниями, вы можете нажать «Отправить» для подачи апелляции, и мы обработаем ее как можно скорее.
Опубликовать ( 0 )