<jupyter_start><jupyter_text>Training: resnet34<jupyter_code>learn = ConvLearner(data, models.resnet34, metrics=error_rate)
learn.fit_one_cycle(4)
learn.save('stage-1')<jupyter_output><empty_output><jupyter_text>Results<jupyter_code>interp = ClassificationInterpretation.from_learner(learn)
interp.plot_top_losses(9, figsize=(15,11))<jupyter_output><empty_output><jupyter_text>Unfreezing, fine-tuning, and learning rates<jupyter_code>learn.load('stage-1')
learn.unfreeze()
learn.lr_find()
learn.recorder.plot()
learn.fit_one_cycle(2, max_lr=slice(5e-6,5e-4))
learn.save('stage-2')<jupyter_output><empty_output><jupyter_text>Generate submission<jupyter_code>learn.load('stage-2')
preds = learn.TTA(is_test=True)[0]
top_3 = np.argsort(preds.numpy())[:, ::-1][:, :3]
n, _ = top_3.shape
labels = []
for i in range(n):
    labels.append(' '.join([learn.data.train_ds.ds.classes[idx] for idx in top_3[i]]))
learn.data.test_dl.dl.dataset[0][0]
labels[0]
key_ids = [path.stem for path in learn.data.test_dl.dl.dataset.x]
os.makedirs(f'subs', exist_ok=True)
sub = pd.DataFrame({'key_id': key_ids, 'word': labels})
sub.head()
name = 'first_sub'
sub.to_csv(f'subs/{name}.csv.gz', index=False, compression='gzip')
pd.read_csv(f'subs/{name}.csv.gz').head()
# !kaggle competitions submit -c quickdraw-doodle-recognition -f subs/{name}.csv.gz -m "{name}"<jupyter_output>Successfully submitted to Quick, Draw! Doodle Recognition Challenge
{'fraction_non_alphanumeric': 0.17369901547116737, 'fraction_numerical': 0.01969057665260197, 'mean_word_length': 8.180645161290322, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '103568', 'license': 'MIT', 'n_tokens_mistral': 586, 'n_tokens_neox': 572, 'n_words': 78, 'path': 'first_submission.ipynb', 'repo_name': 'chicm/draw', 'size': '1422'}