<jupyter_start><jupyter_text>Size 128<jupyter_code>tfms = get_transforms(do_flip=True, max_rotate=15, flip_vert=False, max_lighting=0.1, max_zoom=1.05, max_warp=0., xtra_tfms=[rand_crop(), rand_zoom(1, 1.5), symmetric_warp(magnitude=(-0.2, 0.2))])
data = (src.transform(tfms, size=128, resize_method=ResizeMethod.SQUISH)
        .databunch(bs=128).normalize(imagenet_stats))
learn = cnn_learner(data, se_resnext50_32x4d, pretrained=True, cut=-2,
                    split_on=lambda m: (m[0][3], m[1]), 
                    metrics=[error_rate, f_score])
learn.loss_func = FocalLoss()
learn.lr_find()
learn.recorder.plot(suggestion=True)
learn.fit_one_cycle(32, max_lr=slice(2e-2), wd=1e-5)
learn.save('SE_ResNext50_FL_883903')
learn.unfreeze()
learn.clip_grad();
learn.lr_find()
learn.recorder.plot(suggestion=True)
learn.load('SE_ResNext50_FL_883903');
learn.unfreeze();
learn.clip_grad();
lr = [3e-3/100, 3e-3/20, 3e-3/10]
learn.fit_one_cycle(36, lr, wd=1e-7)
learn.save('s2_SeResNext50_FL_128_942446')<jupyter_output><empty_output><jupyter_text>Size 256<jupyter_code>SZ = 256
cutout_frac = 0.20
p_cutout = 0.75
cutout_sz = round(SZ*cutout_frac)
cutout_tfm = cutout(n_holes=(1,1), length=(cutout_sz, cutout_sz), p=p_cutout)
tfms = get_transforms(do_flip=True, max_rotate=15, flip_vert=False, max_lighting=0.1,
                      max_zoom=1.05, max_warp=0.,
                      xtra_tfms=[rand_crop(), rand_zoom(1, 1.5),
                                 symmetric_warp(magnitude=(-0.2, 0.2)), cutout_tfm])
data = (src.transform(tfms, size=256, resize_method=ResizeMethod.SQUISH)
        .databunch(bs=72)
        .normalize(imagenet_stats))
learn.data = data
data.show_batch()
learn.load('s2_SeResNext50_FL_128_942446');
learn.freeze();
learn.clip_grad();
learn.loss_func = FocalLoss()
learn.lr_find()
learn.recorder.plot(suggestion=True)
learn.fit_one_cycle(24, slice(3e-3), wd=5e-6)
learn.save('SeResNxt50_FL_128t256_955163')
learn.load('SeResNxt50_FL_128t256_955163');
learn.unfreeze()
learn.clip_grad()
lr = [1e-3/200, 1e-3/20, 1e-3/10]
learn.fit_one_cycle(32, lr)
learn.save('SeResNxt50_FL_s2_128t256_968019')
learn.load('SeResNxt50_FL_s2_128t256_968019');
preds, _ = learn.get_preds(DatasetType.Test)
pred_class = torch.argmax(preds, dim=1)
pred_class += 1
pred_numpy = pred_class.numpy()
write_submission(pred_numpy, 'Res50_FLmixup_aug_128t246_969718.csv')
#LB 0.972853019760771<jupyter_output><empty_output><jupyter_text>Size 299<jupyter_code>SZ = 299
cutout_frac = 0.20
p_cutout = 0.75
cutout_sz = round(SZ*cutout_frac)
cutout_tfm = cutout(n_holes=(1,1), length=(cutout_sz, cutout_sz), p=p_cutout)
tfms = get_transforms(do_flip=True, max_rotate=15, flip_vert=False, max_lighting=0.1,
                      max_zoom=1.05, max_warp=0.,
                      xtra_tfms=[rand_crop(),
                                 symmetric_warp(magnitude=(-0.2, 0.2)), cutout_tfm])
data_299 = (src.transform(tfms, size=299, resize_method=ResizeMethod.SQUISH)
            .databunch(bs=48)
            .normalize(imagenet_stats))
learn = cnn_learner(data_299, se_resnext50_32x4d, pretrained=True, cut=-2,
                    split_on=lambda m: (m[0][3], m[1]), 
                    metrics=[error_rate, f_score])
learn.load('SeResNxt50_FL_s2_128t256_968019');
learn.freeze();
learn.clip_grad();
learn.mixup();
learn.lr_find()
learn.recorder.plot(suggestion=True)
learn.loss_func
learn.fit_one_cycle(32, slice(1e-2))
learn.save('SeResNext50_mixup_128t224t299_s1_970390')
learn.load('SeResNext50_mixup_128t224t299_s1_970390');
learn.unfreeze()
learn.clip_grad();
learn.mixup();
learn.lr_find()
learn.recorder.plot(suggestion=True)
lr = [2e-5, 2e-4, 2e-3]
learn.fit_one_cycle(64, lr)
learn.save('Se_ResNext50_mixup_aug_s2_124t256t299_976771')
preds, _ = learn.get_preds(DatasetType.Test)
pred_class = torch.argmax(preds, dim=1)
pred_class += 1
pred_numpy = pred_class.numpy()
write_submission(pred_numpy, 'Se_ResNet50_mix_aug_976771.csv')
#LB 0.980316980670933
predsTTA, _ = learn.TTA(ds_type=DatasetType.Test)
pred_class = torch.argmax(predsTTA, dim=1)
pred_class += 1
pred_numpy = pred_class.numpy()
write_submission(pred_numpy, 'Se_ResNet50_mix_aug_TTA_976771.csv')
#LB 0.979364735433383
class_name = ['Cargo', 'Military','Carrier' ,'Cruise','Tankers']

predTTA_df = pd.DataFrame(predsTTA.numpy(), columns=class_name)
preds_df = pd.DataFrame(preds.numpy(), columns=class_name)
preds_df.to_csv('Preds_SeResNeXt50_LB_980316.csv', index=False)
predTTA_df.to_csv('TTA_SeResNeXt50_LB_980316.csv', index=False)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14654601633193556, 'fraction_numerical': 0.09622599867578902, 'mean_word_length': 5.568115942028985, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '615511', 'license': 'MIT', 'n_tokens_mistral': 2186, 'n_tokens_neox': 1927, 'n_words': 226, 'path': 'Final_SeResNeXt50.ipynb', 'repo_name': 'deepchatterjeevns/AnalyticsVidhya_GameOfDeepLearning', 'size': '4531'}