Google Universal Image Embedding前五名方案小结

info
竞赛地址leaderboard: https://www.kaggle.com/competitions/google-universal-image-embedding/leaderboard
个人博客位置http://myhz0606.com/article/guie

leaderboard排名

indexScorepaper&code
10.728https://arxiv.org/abs/2210.08473https://github.com/ShihaoShao-GH/1st-Place-Solution-in-Google-Universal-Image-Embedding
20.709https://github.com/rainbow-xiao/ECCV2022-ILR-workshophttps://arxiv.org/pdf/2210.08735.pdf
30.692未公开
40.688https://github.com/IvanAer/G-Universal-CLIP
50.688github: https://github.com/riron1206/kaggle-Google-Universal-Image-Embedding-Competition-5th-Place-Solution paper: https://arxiv.org/abs/2210.09495

TL, DR

base model 建议

  • 预训练模型的训练数据越大,质量越高最后的效果越好。前五名都用到了CLIPVIT-H模型作为base model
  • Arcface作为优化目标。(backbone后接两层fc,最后一层fc的特征作为优化目标)

data engineering 建议

  • 好的数据集对结果影响很大,大家都认为product10K数据集最好,GLDv-2其次。
  • 数据做好类别均衡有益于提升效果。

trick 建议

  • LP-FT或交替训练head和backbone效果更好。backbone权重的更新幅度(即学习率)需要低于head。
  • 多尺度训练有助于提升效果
  • ensemble、TTS有助于提升效果。(需要更多算力)

1st method

github: https://github.com/LouieShao/1st-Place-Solution-in-Google-Universal-Image-Embedding

Paper: https://arxiv.org/abs/2210.08473

先尝试off-the-shelf (直接用现成模型提特征不训练)方法

modelinput_sizenum_classespublic_score
swin_large_patch4_window12_384_in22k384218430.405
swin_large_patch4_window7_224_in22k224218430.400
swinv2_large_window12_192_22k192218430.392
convnext_xlarge_in22k224218430.385
swinv2_large_window12to24_192to384_22kft1k38410000.384
swinv2_large_window12to16_192to256_22kft1k25610000.382
convnext_xlarge_384_in22ft1k38410000.382
convnext_large_384_in22ft1k38410000.375
convnext_large_in22k224218430.371
convnext_base_384_in22ft1k38410000.371
beit_large_patch16_224_in22k224218430.136

consensus:

  • 预训练模型所用的数据规模越大越好(和我之前得出的结论一致)

因此作者采用CLIP作为base model(VIT-L Laion-400M 31ep)

indexMethodtraningScoreImprovement
1VIT-L Laion-400M 31epFalse0.4990
2+用GLDv2数据集finetune fc层 (6 epoch), 优化目标为arcface (margin设置成0.5, s=30)True0.566%
3+ 用更多数据训练(Products-10K [2], Shopee [3], MET Artwork Dataset [4], Alibaba goods [5], H&M Personalized Fashion [6], GPR1200 [7], GLDv2-Full [8], DeepFashion Consumer-to-shop Clothes Retrieval Benchmark part)True0.615%
4+ 交替训练fc和backbone (先用上面方法训练fc,在固定fc仅训练backbone,此时学习率降低10倍,训练3个epoch)True0.654%
5+ 用交替训练的方法在products-10k上微调(作者发现这个数据集对结果影响最大)True0.6712.1%
6+ ensemble 不同分辨率下的模型(240, 280)True0.6800.9%
7+replace backbone(替换为Laion2b训练的VIT-H,重复2-5这几步)True0.7032.3%
8+fine-tuning on 280True0.7050.2%
9+再次在280上交替训练fc和backbone (更少的epoch和学习率)True0.7231.8%
10+再次在290上交替训练fc和backbone (patch overlap为4个pixel)True0.7280.5%

几个比较重要的结论:

  • 预训练模型所用数据集越大越好(base model)
  • 微调阶段的数据集越多越好,数据质量越高越好
  • arcface作为优化目标可行
  • fc和backbone交替训练的方法比LP-FT
  • 在更高分辨率微调结合overlap patch有益于进一步提升精度。(即多尺度方法)

LP-FT方法:同时微调FC和backbone但分配不同的学习率。
作者这个交替训练的方法是:先固定backbone训练FC,在固定FC训练backbone

其他细节:

  • 作者用了2个FC,最后一个投影到64维作为检索,这个64维度的向量用arcface计算loss
  • 两个FC之间用了dropout层,ratio=0.2
  • SGD with momentum as our optimizer, and an L2 weights decay rate of 1.5e-4

2nd method

github: https://github.com/rainbow-xiao/ECCV2022-ILR-workshop

paper: https://arxiv.org/pdf/2210.08735.pdf

第二名的模型架构与第一名相同

  • open_clip_torch: Vit-H14-224-visual as backbone
  • fc with dropout rate=0.2 as neck
  • arcface head.

一些trick

  • 数据balance。maximum_image_perclass=100, minimum_image_perclass=3, 并resample到30

  • 动态margin。设置arcface的 init m=0.1, 随后 m= m+0.1 *(cur_ep-1), max_m = 0.8.

  • 分层学习率(stratified lr)。作者说这个trick取得了非常大的提升。作者用1e-4训练fc。用1e-4 * 0.001训练backbone。backbone只训练两个epoch,随后固定,再单独训练FC1个epoch。

    没有用ensemble和高分辨率微调取得了0.713的效果。

4st-method

github: https://github.com/IvanAer/G-Universal-CLIP

第四名的方案太过暴力,落地成本过大。

模型架构

用了2个CLIP架构:ViT-L-14-336ViT-H-14

其中ViT-L-14-336架构用不同参数训练4个模型,ViT-H-14架构用不同参数训练了5个模型,总计9个模型。先按照架构合并特征,再concatenate,最后PCA将为到64.

训练数据:

作者仅用了Google Landmarks 2020Products-10k

训练pipeline

在这里插入图片描述

推理pipeline

在这里插入图片描述

5st method

github: https://github.com/riron1206/kaggle-Google-Universal-Image-Embedding-Competition-5th-Place-Solution
paper: https://arxiv.org/abs/2210.09495

模型架构

backbone: 采用了CLIP Vit-H14-224-visual as backbone

head: BatchNorm1d(num_features=1024+3, affine=False) -> Linear(num_features=1024+3, out_features=64)

loss: ArcFace(scale=30.0, margin=0.5)

在这里插入图片描述

作者此处直接将原图按照宽高比resize后与feature map进行拼接,来捕获多尺度特征,感觉不太优雅,特征跨度太大。

训练数据

DatasetClassesSamples
GLDv25000249350
Products10k9691141931
GPR1200 landmark2002000
GPR1200 face2002000
GPR1200 instre2002000
GPR1200 sketch2002000
GPR1200 sop2002000
Food1011013030

trick

  • TTA (Test Time Augmentation). 简单来说就是对推理图片进行数据增强,如flip,center crop等,最后再将这些特征取平均作为图片的特征。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值