TakeruEndo / kaggle_Cassava

0 stars 1 forks source link

8. 有用なNotebook #8

Open TakeruEndo opened 3 years ago

TakeruEndo commented 3 years ago

[ ] https://www.kaggle.com/piantic/cnn-or-transformer-pytorch-xla-tpu-for-cassava [ ] https://www.kaggle.com/tanlikesmath/cassava-pytorch-xla-tpu-starter-training

TakeruEndo commented 3 years ago

Ensemble classifier!?!?

class EnsembleClassifier(nn.Module):
    def __init__ (self, pretrained=False):
        super().__init__()
        self.model1 = timm.create_model("resnext50_32x4d", pretrained=pretrained)
        self.model2 = timm.create_model("tf_efficientnet_b7_ns", pretrained=pretrained)

    def forward(self, x): 
        x1 = self.model1(x)
        x2 = self.model2(x)
        return x1 * 0.5 + x2 * 0.5