you made this useless program which has 1% accuracy
# Install necessary libraries (if not already)
!pip install opencv-python-headless
!pip install tensorflow
!pip install kaggle

import cv2
import numpy as np
import tensorflow as tf
from tensorflow.keras.layers import Input, Conv2D, MaxPooling2D, UpSampling2D, concatenate
from tensorflow.keras.models import Model
from sklearn.model_selection import train_test_split
import matplotlib.pyplot as plt
from google.colab import files
import os

# Set up Kaggle API credentials
os.environ['KAGGLE_USERNAME'] = 'saisai6567'
os.environ['KAGGLE_KEY'] = 'a26b5bb35240ac0aa00506ef1db25bb9'

# Download the dataset from Kaggle
!kaggle datasets download -d kpgeek/kitti-roadlane-detection-dataset-224-x-224
!unzip -oq kitti-roadlane-detection-dataset-224-x-224.zip -d kitti_road

######################################################################
# 1. Define U-Net Model
######################################################################

def unet_model(input_size=(224, 224, 3)):
    inputs = Input(input_size)
    conv1 = Conv2D(64, 3, activation='relu', padding='same')(inputs)
    conv1 = Conv2D(64, 3, activation='relu', padding='same')(conv1)
    pool1 = MaxPooling2D(pool_size=(2, 2))(conv1)

    conv2 = Conv2D(128, 3, activation='relu', padding='same')(pool1)
    conv2 = Conv2D(128, 3, activation='relu', padding='same')(conv2)
    pool2 = MaxPooling2D(pool_size=(2, 2))(conv2)

    conv3 = Conv2D(256, 3, activation='relu', padding='same')(pool2)
    conv3 = Conv2D(256, 3, activation='relu', padding='same')(conv3)
    pool3 = MaxPooling2D(pool_size=(2, 2))(conv3)

    conv4 = Conv2D(512, 3, activation='relu', padding='same')(pool3)
    conv4 = Conv2D(512, 3, activation='relu', padding='same')(conv4)
    pool4 = MaxPooling2D(pool_size=(2, 2))(conv4)

    conv5 = Conv2D(1024, 3, activation='relu', padding='same')(pool4)
    conv5 = Conv2D(1024, 3, activation='relu', padding='same')(conv5)

    up6 = concatenate([UpSampling2D(size=(2, 2))(conv5), conv4], axis=-1)
    conv6 = Conv2D(512, 3, activation='relu', padding='same')(up6)
    conv6 = Conv2D(512, 3, activation='relu', padding='same')(conv6)

    up7 = concatenate([UpSampling2D(size=(2, 2))(conv6), conv3], axis=-1)
    conv7 = Conv2D(256, 3, activation='relu', padding='same')(up7)
    conv7 = Conv2D(256, 3, activation='relu', padding='same')(conv7)

    up8 = concatenate([UpSampling2D(size=(2, 2))(conv7), conv2], axis=-1)
    conv8 = Conv2D(128, 3, activation='relu', padding='same')(up8)
    conv8 = Conv2D(128, 3, activation='relu', padding='same')(conv8)

    up9 = concatenate([UpSampling2D(size=(2, 2))(conv8), conv1], axis=-1)
    conv9 = Conv2D(64, 3, activation='relu', padding='same')(up9)
    conv9 = Conv2D(64, 3, activation='relu', padding='same')(conv9)

    conv10 = Conv2D(1, 1, activation='sigmoid')(conv9)

    model = Model(inputs=[inputs], outputs=[conv10])
    model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])

    return model

# Load the U-Net model
unet = unet_model()

######################################################################
# 2. Load Dataset - ensuring filenames are matched correctly
######################################################################


def load_data(image_dir, mask_dir, img_size=(224, 224)):
    images = []
    masks = []

    image_files = sorted(os.listdir(image_dir))  # Ensure consistent order
    mask_files = {os.path.splitext(os.path.basename(f))[0].replace('gt_', ''): f for f in os.listdir(mask_dir)}

    print(f"Total image files: {len(image_files)}, Total mask files: {len(mask_files)}")

    for img_file in image_files:
        img_path = os.path.join(image_dir, img_file)
        img_name, _ = os.path.splitext(img_file)

        if img_name in mask_files:
            mask_path = os.path.join(mask_dir, mask_files[img_name])

            img = cv2.imread(img_path)
            if img is None:
                print(f"Error loading image: {img_path}")
                continue

            img = cv2.resize(img, img_size)
            images.append(img)

            mask = cv2.imread(mask_path, cv2.IMREAD_GRAYSCALE)
            if mask is None:
                print(f"Error loading mask: {mask_path}")
                continue

            mask = cv2.resize(mask, img_size)
            masks.append(mask)
        else:
            print(f"Missing file: {img_path} or {os.path.join(mask_dir, mask_files.get(img_name, ''))}")

    if not images or not masks:
        print("No images or masks loaded. Check your dataset.")
        return None, None

    images = np.array(images)
    masks = np.array(masks)
    images = images.astype('float32') / 255.0
    masks = masks.astype('float32') / 255.0
    masks = np.expand_dims(masks, axis=-1)
    return images, masks



# Paths updated as per directory structure provided
train_image_dir = '/content/kitti_road/data_road_224/training/image_2'
train_mask_dir = '/content/kitti_road/data_road_224/training/gt_image_2'

# Load training data
train_images, train_masks = load_data(train_image_dir, train_mask_dir)

# Debug: Check dataset size after loading
if train_images is not None and train_masks is not None:
    print(f"Loaded {len(train_images)} images and {len(train_masks)} masks")
else:
    print("Failed to load images or masks.")

# Split the dataset into training and validation sets
if train_images is not None and train_masks is not None:
    train_images, val_images, train_masks, val_masks = train_test_split(train_images, train_masks, test_size=0.2, random_state=42)

    # Check sizes of the datasets
    print(f"Training images: {train_images.shape}, Validation images: {val_images.shape}")
    print(f"Training masks: {train_masks.shape}, Validation masks: {val_masks.shape}")

    # Train the U-Net model
    unet.fit(train_images, train_masks, validation_data=(val_images, val_masks), epochs=10, batch_size=16)

######################################################################
# 3. Define Functions
######################################################################

# Function to dehaze the image using the method described in the paper
def dehaze_image(image):
    # Step 1: Apply Improved Retinex Algorithm
    def retinex_ssr(img, sigma):
        img = img.astype(np.float32) + 1.0
        retinex = np.log10(img) - np.log10(cv2.GaussianBlur(img, (0, 0), sigma))
        return retinex

    def retinex_msr(img, sigma_list):
        msr = np.zeros_like(img, dtype=np.float32)  # Ensure correct dtype
        for sigma in sigma_list:
            msr += retinex_ssr(img, sigma)  # Accumulate in float32 format
        msr = msr / len(sigma_list)
        return msr

    sigma_list = [15, 80, 250]
    img_msr = retinex_msr(image, sigma_list)
    img_msr = np.uint8(cv2.normalize(img_msr, None, 0, 255, cv2.NORM_MINMAX))

    # Step 2: Apply Hessian Matrix for Lane Line Strengthening
    gray = cv2.cvtColor(img_msr, cv2.COLOR_BGR2GRAY)
    hessian = cv2.cornerHarris(gray, 2, 3, 0.04)
    hessian = cv2.dilate(hessian, None)
    img_msr[hessian > 0.01 * hessian.max()] = [0, 0, 255]

    return img_msr

# Preprocess the image for segmentation
def preprocess_image_segmentation(image):
    image = cv2.resize(image, (224, 224))
    image = image.astype('float32') / 255.0
    image = np.expand_dims(image, axis=0)
    return image

# Perform road segmentation using U-Net
def segment_road(image, model):
    image = preprocess_image_segmentation(image)
    mask = model.predict(image)
    mask = (mask[0] > 0.5).astype('uint8') * 255
    mask = cv2.resize(mask, (original_width, original_height), interpolation=cv2.INTER_NEAREST)
    return mask

# Combine the original image with the segmentation mask
def highlight_road(image, mask):
    contours, _ = cv2.findContours(mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
    highlighted_image = cv2.drawContours(image.copy(), contours, -1, (0, 255, 0), 3)
    return highlighted_image

######################################################################
# 4. Upload and Process the Image
######################################################################

uploaded = files.upload()
image_path = list(uploaded.keys())[0]
image = cv2.imread(image_path)
original_height, original_width = image.shape[:2]

# Dehaze the image
dehazed_image = dehaze_image(image)

# Segment the road in the dehazed image
road_mask = segment_road(dehazed_image, unet)
highlighted_image = highlight_road(dehazed_image, road_mask)

# Display the result
plt.figure(figsize=(15, 15))
plt.subplot(1, 3, 1)
plt.title("Original Image")
plt.imshow(cv2.cvtColor(image, cv2.COLOR_BGR2RGB))
plt.axis('off')

plt.subplot(1, 3, 2)
plt.title("Dehazed Image")
plt.imshow(cv2.cvtColor(dehazed_image, cv2.COLOR_BGR2RGB))
plt.axis('off')

plt.subplot(1, 3, 3)
plt.title("Road Highlighted")
plt.imshow(cv2.cvtColor(highlighted_image, cv2.COLOR_BGR2RGB))
plt.axis('off')

plt.show()




use similar file upload display structure but use this unet lane segmentation logic in it with not changing above dataset
‘’‘IMPORTING PYTHON LIBRARIES’‘’
import numpy as np
import pickle
import pandas as pd
import matplotlib.pyplot as plt


from sklearn.utils import shuffle
from sklearn.model_selection import train_test_split
‘’‘IMPORTING TENSORFLOW LIBRARIES’‘’
from tensorflow.python.keras.models import Sequential
from tensorflow.python.keras.layers import Activation, Dropout, UpSampling2D, Concatenate
from tensorflow.python.keras.layers import Conv2DTranspose, Conv2D, MaxPooling2D,merge, Add
from tensorflow.python.keras.layers.normalization import BatchNormalization
from tensorflow.python.keras.preprocessing.image import ImageDataGenerator
from tensorflow.python.keras import regularizers
from keras.callbacks import ModelCheckpoint
import tensorflow as tf
tf.compat.v1.disable_v2_behavior()
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/python/compat/v2_compat.py:96: disable_resource_variables (from tensorflow.python.ops.variable_scope) is deprecated and will be removed in a future version.
Instructions for updating:
non-resource variables are not supported in the long term
Using TensorFlow backend.
‘’‘LOADING GOOGLE DRIVE’‘’
from google.colab import drive
drive.mount(‘/content/drive’)
Drive already mounted at /content/drive; to attempt to forcibly remount, call drive.mount(“/content/drive”, force_remount=True).
‘’‘READING THE DATASET’‘’



train_labels = pickle.load(open(“/content/drive/My Drive/ML_project/Lane_Detection/full_CNN_labels.p”, “rb” ))
train_images = pickle.load(open(“/content/drive/My Drive/ML_project/Lane_Detection/full_CNN_train.p”, “rb” ))
train_images = np.array(train_images)
train_labels = np.array(train_labels)/255
def conv_block(X,kernal_size,num_of_filter,stride):

‘’‘
This function defines the convolution block used in the model.
First layer is a 1x1 colvolution layer.
Second layer is a batch normalization layer.
third layer is (kernal_size x kernal_size) convolution layer
forth layer is batch normalization
fifth layer is (kernal_size x kernal_size) convolution layer
sixth layer is batch normalization

We call this multiple number of times to implement UNET structure
‘’’


out_put = Conv2D(num_of_filter[0], strides = (stride,stride), kernel_size=(1,1), padding=‘same’, activation=‘relu’, kernel_initializer = tf.keras.initializers.he_uniform())(X)
out_put = BatchNormalization(axis=3)(out_put)
#out_put = Dropout(0.2)(out_put)

out_put = Conv2D(num_of_filter[1], strides = (stride,stride), kernel_size=(kernal_size,kernal_size), padding=‘same’, activation=‘relu’, kernel_initializer = tf.keras.initializers.he_uniform())(out_put)
out_put = BatchNormalization(axis=3)(out_put)
#out_put = Dropout(0.2)(out_put)

out_put = Conv2D(num_of_filter[2], strides = (stride,stride), kernel_size=(kernal_size,kernal_size), padding=‘same’, activation=‘relu’, kernel_initializer = tf.keras.initializers.he_uniform())(out_put)
out_put = BatchNormalization(axis=3)(out_put)
#out_put = Dropout(0.2)(out_put)


return out_put
def De_conv_block(X,kernal_size,num_of_filter):

‘’‘
In this function, we try to implement the transpose convolution layer.
‘’’

x = UpSampling2D((2, 2))(X)
y1 = Conv2DTranspose(num_of_filter, (kernal_size, kernal_size), activation=‘relu’, padding=‘same’)(x)

return y1
‘’‘PRE-PROCESSING’‘’


train_images, train_labels = shuffle(train_images, train_labels)
# Test size may be 10% or 20%
X_train, X_val, y_train, y_val = train_test_split(train_images, train_labels, test_size=0.2)

# Batch size, epochs and pool size below are all paramaters to fiddle with for optimization
batch_size = 128
epochs = 10
pool_size = (2, 2)
input_shape = X_train.shape[1:]
‘’‘MODEL DEFINiTION’‘’


tf.compat.v1.reset_default_graph()

X_input = tf.keras.Input(input_shape)
‘’‘Block 1 Convolution’‘’
down1 = conv_block(X_input,3,[32,32,32],1)
pool = MaxPooling2D((2, 2), padding=‘same’)(down1)

‘’‘Block 2 Convolution’‘’
down2 = conv_block(pool,3,[64,64,64],1)
pool = MaxPooling2D((2, 2), padding=‘same’)(down2)

‘’‘Block 3 Convolution’‘’
down3 = conv_block(pool,3,[128,128,128],1)
pool = MaxPooling2D((2, 2), padding=‘same’)(down3)

‘’‘Block 4 Convolution’‘’
down4 = conv_block(pool,3,[256,256,256],1)
pool = MaxPooling2D((2, 2), padding=‘same’)(down4)

‘’‘Equilizer’‘’
eq = Conv2D(512, strides = (1,1), kernel_size=(1,1), padding=‘same’, activation=‘relu’, kernel_initializer = tf.keras.initializers.he_uniform())(pool)


‘’‘Block 1 Deconvolve’‘’
up1 = De_conv_block(eq,3,256)
up1 = conv_block(up1,3,[256,256,256],1)
up1 = Add()([up1,down4])

‘’‘Block 1 Deconvolve’‘’
up2 = De_conv_block(up1,3,128)
up2 = conv_block(up2,3,[128,128,128],1)
up2 = Add()([up2,down3])

‘’‘Block 1 Deconvolve’‘’
up3 = De_conv_block(up2,3,64)
up3 = conv_block(up3,3,[64,64,64],1)
up3 = Add()([up3,down2])

‘’‘Block 1 Deconvolve’‘’
up4 = De_conv_block(up3,3,32)
up4 = conv_block(up4,3,[32,32,32],1)
up4 = Add()([up4,down1])

out1 = Conv2D(16, strides = (1,1), kernel_size=(3,3), padding=‘same’, activation=‘relu’, kernel_initializer = tf.keras.initializers.he_uniform())(up4)
out2 = Conv2D(8, strides = (1,1), kernel_size=(3,3), padding=‘same’, activation=‘relu’, kernel_initializer = tf.keras.initializers.he_uniform())(out1)
out3 = Conv2D(1, strides = (1,1), kernel_size=(3,3), padding=‘same’, activation=‘sigmoid’, kernel_initializer = tf.keras.initializers.he_uniform())(out2)
‘’‘MODEL COMBINITION’‘’

encoder = tf.keras.Model(X_input, out3, name=‘encoder’)
encoder.summary()
Model: “encoder”

Layer (type) Output Shape Param # Connected to
==================================================================================================
input_1 (InputLayer) [(None, 80, 160, 3)] 0

conv2d (Conv2D) (None, 80, 160, 32) 128 input_1[0][0]

batch_normalization (BatchNorma (None, 80, 160, 32) 128 conv2d[0][0]

conv2d_1 (Conv2D) (None, 80, 160, 32) 9248 batch_normalization[0][0]

batch_normalization_1 (BatchNor (None, 80, 160, 32) 128 conv2d_1[0][0]

conv2d_2 (Conv2D) (None, 80, 160, 32) 9248 batch_normalization_1[0][0]

batch_normalization_2 (BatchNor (None, 80, 160, 32) 128 conv2d_2[0][0]

max_pooling2d (MaxPooling2D) (None, 40, 80, 32) 0 batch_normalization_2[0][0]

conv2d_3 (Conv2D) (None, 40, 80, 64) 2112 max_pooling2d[0][0]

batch_normalization_3 (BatchNor (None, 40, 80, 64) 256 conv2d_3[0][0]

conv2d_4 (Conv2D) (None, 40, 80, 64) 36928 batch_normalization_3[0][0]

batch_normalization_4 (BatchNor (None, 40, 80, 64) 256 conv2d_4[0][0]

conv2d_5 (Conv2D) (None, 40, 80, 64) 36928 batch_normalization_4[0][0]

batch_normalization_5 (BatchNor (None, 40, 80, 64) 256 conv2d_5[0][0]

max_pooling2d_1 (MaxPooling2D) (None, 20, 40, 64) 0 batch_normalization_5[0][0]

conv2d_6 (Conv2D) (None, 20, 40, 128) 8320 max_pooling2d_1[0][0]

batch_normalization_6 (BatchNor (None, 20, 40, 128) 512 conv2d_6[0][0]

conv2d_7 (Conv2D) (None, 20, 40, 128) 147584 batch_normalization_6[0][0]

batch_normalization_7 (BatchNor (None, 20, 40, 128) 512 conv2d_7[0][0]

conv2d_8 (Conv2D) (None, 20, 40, 128) 147584 batch_normalization_7[0][0]

batch_normalization_8 (BatchNor (None, 20, 40, 128) 512 conv2d_8[0][0]

max_pooling2d_2 (MaxPooling2D) (None, 10, 20, 128) 0 batch_normalization_8[0][0]

conv2d_9 (Conv2D) (None, 10, 20, 256) 33024 max_pooling2d_2[0][0]

batch_normalization_9 (BatchNor (None, 10, 20, 256) 1024 conv2d_9[0][0]

conv2d_10 (Conv2D) (None, 10, 20, 256) 590080 batch_normalization_9[0][0]

batch_normalization_10 (BatchNo (None, 10, 20, 256) 1024 conv2d_10[0][0]

conv2d_11 (Conv2D) (None, 10, 20, 256) 590080 batch_normalization_10[0][0]

batch_normalization_11 (BatchNo (None, 10, 20, 256) 1024 conv2d_11[0][0]

max_pooling2d_3 (MaxPooling2D) (None, 5, 10, 256) 0 batch_normalization_11[0][0]

conv2d_12 (Conv2D) (None, 5, 10, 512) 131584 max_pooling2d_3[0][0]

up_sampling2d (UpSampling2D) (None, 10, 20, 512) 0 conv2d_12[0][0]

conv2d_transpose (Conv2DTranspo (None, 10, 20, 256) 1179904 up_sampling2d[0][0]

conv2d_13 (Conv2D) (None, 10, 20, 256) 65792 conv2d_transpose[0][0]

batch_normalization_12 (BatchNo (None, 10, 20, 256) 1024 conv2d_13[0][0]

conv2d_14 (Conv2D) (None, 10, 20, 256) 590080 batch_normalization_12[0][0]

batch_normalization_13 (BatchNo (None, 10, 20, 256) 1024 conv2d_14[0][0]

conv2d_15 (Conv2D) (None, 10, 20, 256) 590080 batch_normalization_13[0][0]

batch_normalization_14 (BatchNo (None, 10, 20, 256) 1024 conv2d_15[0][0]

add (Add) (None, 10, 20, 256) 0 batch_normalization_14[0][0]
batch_normalization_11[0][0]

up_sampling2d_1 (UpSampling2D) (None, 20, 40, 256) 0 add[0][0]

conv2d_transpose_1 (Conv2DTrans (None, 20, 40, 128) 295040 up_sampling2d_1[0][0]

conv2d_16 (Conv2D) (None, 20, 40, 128) 16512 conv2d_transpose_1[0][0]

batch_normalization_15 (BatchNo (None, 20, 40, 128) 512 conv2d_16[0][0]

conv2d_17 (Conv2D) (None, 20, 40, 128) 147584 batch_normalization_15[0][0]

batch_normalization_16 (BatchNo (None, 20, 40, 128) 512 conv2d_17[0][0]

conv2d_18 (Conv2D) (None, 20, 40, 128) 147584 batch_normalization_16[0][0]

batch_normalization_17 (BatchNo (None, 20, 40, 128) 512 conv2d_18[0][0]

add_1 (Add) (None, 20, 40, 128) 0 batch_normalization_17[0][0]
batch_normalization_8[0][0]

up_sampling2d_2 (UpSampling2D) (None, 40, 80, 128) 0 add_1[0][0]

conv2d_transpose_2 (Conv2DTrans (None, 40, 80, 64) 73792 up_sampling2d_2[0][0]

conv2d_19 (Conv2D) (None, 40, 80, 64) 4160 conv2d_transpose_2[0][0]

batch_normalization_18 (BatchNo (None, 40, 80, 64) 256 conv2d_19[0][0]

conv2d_20 (Conv2D) (None, 40, 80, 64) 36928 batch_normalization_18[0][0]

batch_normalization_19 (BatchNo (None, 40, 80, 64) 256 conv2d_20[0][0]

conv2d_21 (Conv2D) (None, 40, 80, 64) 36928 batch_normalization_19[0][0]

batch_normalization_20 (BatchNo (None, 40, 80, 64) 256 conv2d_21[0][0]

add_2 (Add) (None, 40, 80, 64) 0 batch_normalization_20[0][0]
batch_normalization_5[0][0]

up_sampling2d_3 (UpSampling2D) (None, 80, 160, 64) 0 add_2[0][0]

conv2d_transpose_3 (Conv2DTrans (None, 80, 160, 32) 18464 up_sampling2d_3[0][0]

conv2d_22 (Conv2D) (None, 80, 160, 32) 1056 conv2d_transpose_3[0][0]

batch_normalization_21 (BatchNo (None, 80, 160, 32) 128 conv2d_22[0][0]

conv2d_23 (Conv2D) (None, 80, 160, 32) 9248 batch_normalization_21[0][0]

batch_normalization_22 (BatchNo (None, 80, 160, 32) 128 conv2d_23[0][0]

conv2d_24 (Conv2D) (None, 80, 160, 32) 9248 batch_normalization_22[0][0]

batch_normalization_23 (BatchNo (None, 80, 160, 32) 128 conv2d_24[0][0]

add_3 (Add) (None, 80, 160, 32) 0 batch_normalization_23[0][0]
batch_normalization_2[0][0]

conv2d_25 (Conv2D) (None, 80, 160, 16) 4624 add_3[0][0]

conv2d_26 (Conv2D) (None, 80, 160, 8) 1160 conv2d_25[0][0]

conv2d_27 (Conv2D) (None, 80, 160, 1) 73 conv2d_26[0][0]
==================================================================================================
Total params: 4,982,625
Trainable params: 4,976,865
Non-trainable params: 5,760

‘’‘Data Augmentation’‘’


datagen = ImageDataGenerator(channel_shift_range=0.2)
datagen.fit(X_train)
‘’‘Compiling and training the model’‘’

encoder.compile(optimizer=‘Adam’, loss=‘mean_squared_error’)
history = encoder.fit_generator(datagen.flow(X_train, y_train, batch_size=batch_size), steps_per_epoch=len(X_train)/batch_size,epochs=epochs, verbose=1, validation_data=(X_val, y_val))
‘’‘Saving the model’‘’

encoder.save(‘/content/drive/My Drive/ML_project/Lane_Detection/final_model.h5’)

import numpy as np
import pickle
import pandas as pd
import matplotlib.pyplot as plt
import cv2


from sklearn.utils import shuffle
from sklearn.model_selection import train_test_split



from tensorflow.python.keras.models import Sequential
from tensorflow.python.keras.layers import Activation, Dropout, UpSampling2D, Concatenate
from tensorflow.python.keras.layers import Conv2DTranspose, Conv2D, MaxPooling2D,merge, Add
from tensorflow.python.keras.layers.normalization import BatchNormalization
from tensorflow.python.keras.preprocessing.image import ImageDataGenerator
from tensorflow.python.keras import regularizers
from keras.callbacks import ModelCheckpoint
import tensorflow as tf
tf.compat.v1.disable_v2_behavior()


WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/python/compat/v2_compat.py:96: disable_resource_variables (from tensorflow.python.ops.variable_scope) is deprecated and will be removed in a future version.
Instructions for updating:
non-resource variables are not supported in the long term
Using TensorFlow backend.

‘’‘Loading google drive’‘’
from google.colab import drive
drive.mount(‘/content/drive’)

Go to this URL in a browser: https://accounts.google.com/o/oauth2/auth?client_id=947318989803-6bn6qk8qdgf4n4g3pfee6491hc0brc4i.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&scope=email https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdocs.test https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.photos.readonly https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fpeopleapi.readonly

Enter your authorization code:
··········
Mounted at /content/drive

‘’‘Load Test Image’‘’
img = plt.imread(‘/content/drive/My Drive/ML_project/Lane_Detection/solidWhiteRight.jpg’)
np.shape(img)
img = cv2.resize(img,(160,80))


plt.imshow(img)

<matplotlib.image.AxesImage at 0x7f69c01cffd0>


‘’‘Simple Unet Test’‘’
Simple_model = tf.keras.models.load_model(‘/content/drive/My Drive/ML_project/Lane_Detection/Simple_U_Saved_model.h5’)
Simple_model.trainable = False

WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/init_ops.py:97: calling Zeros.init (from tensorflow.python.ops.init_ops) with dtype is deprecated and will be removed in a future version.
Instructions for updating:
Call initializer instance with the dtype argument instead of passing it to the constructor
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/init_ops.py:97: calling Ones.init (from tensorflow.python.ops.init_ops) with dtype is deprecated and will be removed in a future version.
Instructions for updating:
Call initializer instance with the dtype argument instead of passing it to the constructor
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/resource_variable_ops.py:1666: calling BaseResourceVariable.init (from tensorflow.python.ops.resource_variable_ops) with constraint is deprecated and will be removed in a future version.
Instructions for updating:
If using Keras pass *_constraint arguments to layers.
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/init_ops.py:97: calling GlorotUniform.init (from tensorflow.python.ops.init_ops) with dtype is deprecated and will be removed in a future version.
Instructions for updating:
Call initializer instance with the dtype argument instead of passing it to the constructor

pred = Simple_model.predict(np.expand_dims(img,0))


plt.imshow(pred[0,:,:,0])

<matplotlib.image.AxesImage at 0x7f69b3f9d518>








‘’‘Complex Unet Test’‘’
Complex_model = tf.keras.models.load_model(‘/content/drive/My Drive/ML_project/Lane_Detection/final_big_Unet_model.h5’)
Complex_model.trainable = False


pred2 = Complex_model.predict(np.expand_dims(img,0))


plt.imshow(pred2[0,:,:,0])

<matplotlib.image.AxesImage at 0x7f69b3028cc0>
It’s clear that you’re putting in a lot of effort into building your lane detection model using U-Net. Let’s take a closer look at your code and see where we can make improvements to help you achieve better results.