<jupyter_start><jupyter_text>Install FastAIhttps://github.com/fastai/fastaiIn short, `conda activate` the python environement, and run:  ```bashconda install -c fastai -c pytorch -c anaconda fastai gh anaconda```Note: For more details about the modelling approach, please refer to:  https://github.com/fastai/fastbook/blob/master/01_intro.ipynb<jupyter_code>from fastai.vision.all import *
path = untar_data(URLs.CAMVID_TINY)
def acc_camvid(inp, targ, void_code=0):
    targ = targ.squeeze(1)
    mask = targ != void_code
    return (inp.argmax(dim=1)[mask] == targ[mask]).float().mean()
def get_y(o, path=path):
    return path / "labels" / f"{o.stem}_P{o.suffix}"
dls = SegmentationDataLoaders.from_label_func(
    path,
    bs=8,
    fnames=get_image_files(path / "images"),
    label_func=get_y,
    codes=np.loadtxt(path / "codes.txt", dtype=str),
)
dls.one_batch()[0].shape[-2:], get_c(dls)
learn = unet_learner(dls, resnet50, metrics=acc_camvid)
learn.fine_tune(20)
learn.show_results(max_n=6, figsize=(7,8))
learn.export("./fastai_unet.pkl")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1519925857275255, 'fraction_numerical': 0.013901760889712697, 'mean_word_length': 5.428571428571429, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '465649', 'license': 'MIT-0', 'n_tokens_mistral': 439, 'n_tokens_neox': 427, 'n_words': 75, 'path': 'notebook/01_U-net_Modelling.ipynb', 'repo_name': 'aws-samples/amazon-sagemaker-endpoint-deployment-of-fastai-model-with-torchserve', 'size': '1079'}