返回列表

[ 31th solution ] noisy student, knowledge distillation

473. PetFinder.my - Pawpularity Contest | petfinder-pawpularity-score

开始: 2021-09-23 结束: 2022-01-14 计算机视觉 数据算法赛
[第31名方案] Noisy Student 与知识蒸馏

[第31名方案] Noisy Student 与知识蒸馏

作者: SeHwanJoo | 排名: 31st | 发布时间: 2022-01-15

感谢所有参与这次比赛的人,以及主办方举办了如此精彩的比赛。

很高兴能冲到第31名,我也因此成为了竞赛大师。在这次比赛中,我想学习多模态、Noisy Student 和知识蒸馏。

概述

我的解决方案参考了这篇论文:
Self-training with Noisy Student improves ImageNet classification

  1. 训练单模型
  2. 集成模型以预测并标记外部数据
  3. 使用外部数据 + Petfinder 数据训练单模型

步骤1. 训练单模型

模型架构

我使用了 fastai 和 timm 库。模型结构如下:

class cust_fastai_model(nn.Module):     

    def __init__(self, model_name='swin_large_patch4_window7_224', emb=True):
        super().__init__()
        self.emb = emb
        self.backbone = create_model(model_name, 
                           pretrained=False, num_classes=0)
        image_num_features = self.backbone.num_features
        self.image_fc = nn.Sequential(
            nn.Dropout(0.3), nn.Linear(image_num_features, 128)
        )
        self.custom_head = nn.Sequential(
            nn.Dropout(0.4), nn.Linear(128, 1)
        )
    def forward(self, image):
        emb = self.backbone(image)
        emb = self.image_fc(emb)
        out = self.custom_head(emb)
        if self.emb:
            return torch.cat([out, emb], dim=1)
        else:
            return out

单模型性能

模型名称 图像尺寸 CV分数
swin_large_patch4_window7_22422417.4291008
swin_base_patch4_window7_22422417.62332115
swin_large_patch4_window12_38438417.51918907
tf_efficientnet_b5_ns45617.70378685
vit_large_patch16_22422417.63189049
eca_nfnet_l238417.58191376

步骤2. 集成模型用于预测和标记外部数据

计算关于 TTA 的 CV 分数

TTA 次数CV分数
117.22635913
217.20699514
317.2165909
417.20069566
517.21008584
617.20981791
717.1992845
817.19996605
917.21487459
1017.2102797

然后,我使用 TTA 7 来预测和标记外部数据。

外部数据

  1. COCO cat and dog
  2. Petfinder adopt dataset
  3. Kaggle cat and dog dataset

步骤3. 使用外部数据训练单模型

单模型性能

模型名称图像尺寸CV分数
swin_large_patch4_window7_22422417.