# simple (public 3rd and private 29th) place solution

Acknowledgements
Thanks to Kaggle for organizing this competition.
I learned a tremendous amount of tricks in this competition and it would not have been able if it wasn’t for all this generous sharing of top solutions and extremely talented teammates (
[@cdeotte](https://www.kaggle.com/cdeotte)
[@hanson0910](https://www.kaggle.com/hanson0910)
and
[@zlanan](https://www.kaggle.com/zlanan)
) i was lucky to have along the way. thanks to my well collaborative team mates.
Together we learned a lot
💪
We did not have any magic there, only diverse models with highest CV
our aim was to design an ensemble using top pytorch + tensorflow models with different image size,different TTA and diverse models (it worked well on public lb and also on private)
our  32nd place submission uses,
model 1 -> nf-resnet50:
[0.897, 0.903, 0.899. 0.8932, 0.8946]
model 2 ->ResNext50(image size 512):
[0.891, 0.897, 0.892, 0.886, 0.892]
model 3 -> 0.8913 vit.  + 0.886 +0.884 +0.883 noisy tf B4. Intentionally trained three relatively low CV noisy tf B4 but works, quite strange.
model 4 and 5 ->
(tf_efficientnet_b4_ns + Vit-B16) with 2019 years of data, so CV has no reference value but it's around 0.9
model 6 ->
not sure what the CV is for 512 image size efficientnet-b0
(tensorflow model)
but public lb was  0.895
model 7 ->
tf_efficientnet_b4_ns_fold_0_8: cv 0.8914
tf_efficientnet_b4_ns_fold_0_5: cv 0.8932
only 1 fold of vit base from this notebook :
[ViT - Pytorch xla (TPU) for leaf disease](https://www.kaggle.com/mobassir/vit-pytorch-xla-tpu-for-leaf-disease)
vit_base_patch16_384_fold_4: cv0.89175
only 2 fold of vit large from this notebook :
[Faster Pytorch TPU baseline for CLD(cv 0.9)](https://www.kaggle.com/mobassir/faster-pytorch-tpu-baseline-for-cld-cv-0-9)
vit_large_patch16_384_fold_2: cv 0.89568
vit_large_patch16_384_fold_1: cv 0.89826
used following tta (3 step):
def get_inference_transforms(image_size = image_size):
    return Compose([
            RandomResizedCrop(image_size, image_size),
            Transpose(p=0.5),
            HorizontalFlip(p=0.5),
            VerticalFlip(p=0.5),
            HueSaturationValue(hue_shift_limit=0.2, sat_shift_limit=0.2, val_shift_limit=0.2, p=0.5),
            RandomBrightnessContrast(brightness_limit=(-0.1,0.1), contrast_limit=(-0.1, 0.1), p=0.5),
            Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225], max_pixel_value=255.0, p=1.0),
            ToTensorV2(p=1.0),
        ], p=1.)
and for vit large :
inference_transforms = albumentations.Compose([
    #albumentations.RandomResizedCrop(image_size, image_size),
    albumentations.Resize(image_size, image_size),
    albumentations.Transpose(p=0.5),
    albumentations.HorizontalFlip(p=0.5),
    albumentations.VerticalFlip(p=0.5),
    albumentations.HueSaturationValue(hue_shift_limit=0.2, sat_shift_limit=0.2, val_shift_limit=0.2, p=0.5),
    albumentations.RandomBrightnessContrast(brightness_limit=(-0.1,0.1), contrast_limit=(-0.1, 0.1), p=0.5),
 ])
[@zlanan](https://www.kaggle.com/zlanan)
found these as best augmentations :
RandomResizedCrop(CFG['img_size'], CFG['img_size']),
        Transpose(p=0.4),
        HorizontalFlip(p=0.4),
        VerticalFlip(p=0.4),
        ShiftScaleRotate(p=0.3),
        MedianBlur(blur_limit=7,always_apply=False, p=0.3),
        IAAAdditiveGaussianNoise(scale=(0, 0.15*255),p=0.5),
        HueSaturationValue(hue_shift_limit=0.2, sat_shift_limit=0.2, val_shift_limit=0.2, p=0.4),
        RandomBrightnessContrast(brightness_limit=(-0.1,0.1), contrast_limit=(-0.1, 0.1), p=0.4),
        Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225], max_pixel_value=255.0, p=1.0),
        CoarseDropout(p=1.0),
        Cutout(p=0.4),
we blended all  models that had cv close to 0.9 or more than that, with that we got public lb 0.8978 and
private lb 0.9019
(but couldn't select it because of low lb score)
![](assets/459ff8440f27b27963cee02e.jpeg)
Final note
we did observe a rise on both LB with lighter TTA, but also a drop. we did observe a improve with different image size model but also a drop. we can not say anything is really useful, except
avg ensemble.
some of our early experiment results can be found here :
[https://docs.google.com/spreadsheets/d/1HSMuTrMmwB5-8GXeJ-h68xeOIEeffcRo2W6HcmfXCzs/edit#gid=0](https://docs.google.com/spreadsheets/d/1HSMuTrMmwB5-8GXeJ-h68xeOIEeffcRo2W6HcmfXCzs/edit#gid=0)
thank you for reading