<jupyter_start><jupyter_text>Lane Boundary Segmentation  Setting up Colab You can delete this "Setting up Colab" section if you work locally and do not want to use Google Colab<jupyter_code>colab_nb = 'google.colab' in str(get_ipython())
if colab_nb:
  from google.colab import drive
  drive.mount('/content/drive')
if colab_nb:
  %cd drive/My\ Drive/aad/code/exercises/lane_detection
if colab_nb:
  !pip install segmentation-models-pytorch
  !pip install albumentations --upgrade<jupyter_output><empty_output><jupyter_text>Loading data<jupyter_code>import os
os.environ['CUDA_VISIBLE_DEVICES'] = '0'

import numpy as np
import cv2
import matplotlib.pyplot as plt
import re
import sys
sys.path.append("../../util")<jupyter_output><empty_output><jupyter_text>If you have collected data yourself in a folder "data" using `collect_data.py` and you want to use it for training, set the boolean in the next cell to `True`<jupyter_code>own_data = False
if own_data:
    from seg_data_util import sort_collected_data
    # copy and sort content of 'data' into 'data_lane_segmentation' folder:
    sort_collected_data()
    # Since data was copied, you can remove files in 'data' directory afterwards
else:
    # if you stopped the download before completion, please delete the 'data_lane_segmentation' folder and run this cell again
    from seg_data_util import download_segmentation_data
    download_segmentation_data()<jupyter_output><empty_output><jupyter_text>Independent of what you chose, you will have a directory 'data_lane_segmentation' now<jupyter_code>DATA_DIR = "data_lane_segmentation"

x_train_dir = os.path.join(DATA_DIR, 'train')
y_train_dir = os.path.join(DATA_DIR, 'train_label')

x_valid_dir = os.path.join(DATA_DIR, 'val')
y_valid_dir = os.path.join(DATA_DIR, 'val_label')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08585580627407816, 'fraction_numerical': 0.001100715465052284, 'mean_word_length': 5.992307692307692, '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': '489085', 'license': 'CC-BY-4.0', 'n_tokens_mistral': 612, 'n_tokens_neox': 605, 'n_words': 173, 'path': 'code/exercises/lane_detection/lane_segmentation.ipynb', 'repo_name': 'thomasfermi/Algorithms-for-Automated-Driving', 'size': '1817'}