473. PetFinder.my - Pawpularity Contest | petfinder-pawpularity-score
恭喜所有的获奖者。
我的方案非常简单,但在这次比赛中这是一个非常幸运的模型。它在 Private LB 上取得了 16.98523 的成绩,在 Public LB 上取得了 17.83676 的成绩。
实际上我在最后几天训练了一个高效的模型,但我太懒了,没有把它和我之前的 Swin Transformer 模型进行融合。
所以我在这分享我的方案。
这是一个输入尺寸为 384 的 Swin Large 模型,使用了 10 折交叉验证(10 folds)进行训练。
我将从 3 个部分介绍我的方案:模型、数据增强和训练策略。
class Net(nn.Module):
def __init__(self, num_classes= 1):
super().__init__()
self.model = timm.create_model('swin_large_patch4_window12_384', pretrained=True)
self._fc = nn.Sequential(nn.Linear(1536+256 , num_classes, bias=True))
self.extra_dense=nn.Sequential(nn.Linear(12,256,bias=True),
nn.GELU(),
nn.Linear(256, 256,bias=True),
nn.GELU()
)
def forward(self, x,extra):
x = self.model.forward_features(x)
extra_fm=self.extra_dense(extra)
fm=torch.cat([x,extra_fm],dim=1)
x = self._fc(fm)
return x
self.train_trans=A.Compose([
A.RandomResizedCrop(height=384,
width=384,
scale=(0.8, 1.0),
ratio=(0.9, 1.1),),
A.ShiftScaleRotate(shift_limit=0.1,
scale_limit=0.1,
rotate_limit=30,
p=1.),
A.HorizontalFlip(p=0.5),
A.Normalize()
])