<jupyter_start><jupyter_text>Land Use and Land Cover Classification<jupyter_code>%reload_ext autoreload
%autoreload 2
%matplotlib inline
from fastai.vision import *  
from fastai.metrics import error_rate 
import zipfile
import urllib.request 
import os 
data_path = os.getcwd()
path = datapath4file(data_path+'/2750')<jupyter_output><empty_output><jupyter_text>Training: resnet50<jupyter_code>tfms = get_transforms(flip_vert=True, max_warp = 0.)
data = ImageDataBunch.from_folder(path, train = ".", 
                                  valid_pct=0.2, 
                                  ds_tfms = tfms, 
                                  size=224, bs = 32).normalize(imagenet_stats)<jupyter_output><empty_output><jupyter_text>Viewing our data:<jupyter_code>data.show_batch(rows=3, figsize=(12,8))<jupyter_output><empty_output><jupyter_text>Model Architecture and Training<jupyter_code>learn = cnn_learner(data, models.resnet50, metrics=error_rate)
print(learn.summary())
learn.lr_find()
learn.recorder.plot(suggestion=True)
lr = 3.63E-03
learn.fit_one_cycle(6, slice(lr))
learn.lr_find()
learn.recorder.plot()
learn.unfreeze()
learn.fit_one_cycle(3, slice(1e-6, lr/10))
#learn.save('resnet50_mod_02')
learn.freeze()
learn.lr_find()
learn.recorder.plot()
#learn.load('resnet50_mod_02')
learn.fit_one_cycle(1, slice(1e-5/2))
#learn.save('resnet50_mod_03')
interp = ClassificationInterpretation.from_learner(learn)
losses,idxs = interp.top_losses()
len(data.valid_ds)==len(losses)==len(idxs)
#interp.plot_top_losses(9, figsize=(15,11))
interp.plot_confusion_matrix(figsize=(6,6), dpi=100)
interp.most_confused(min_val=5)
learn.export()
learn.show_results(rows=3, figsize=(10,10))
learn = load_learner(path)
#learn
learn.data.classes
img = data.train_ds[5403][0];img
learn.predict(img)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13543394140409065, 'fraction_numerical': 0.038695411829740185, 'mean_word_length': 5.830188679245283, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '405618', 'license': 'MIT', 'n_tokens_mistral': 736, 'n_tokens_neox': 691, 'n_words': 91, 'path': 'Land Cover/landcover_classification/notebooks/sentinel_classification.ipynb', 'repo_name': 'Cpt-Karthik/Realate', 'size': '1809'}