already satisfied: python-slugify in /usr/local/lib/python3.10/dist-packages (from kaggle) (8.0.4)
Requirement already satisfied: urllib3 in /usr/local/lib/python3.10/dist-packages (from kaggle) (2.0.7)
Requirement already satisfied: bleach in /usr/local/lib/python3.10/dist-packages (from kaggle) (6.1.0)
Requirement already satisfied: webencodings in /usr/local/lib/python3.10/dist-packages (from bleach->kaggle) (0.5.1)
Requirement already satisfied: text-unidecode>=1.3 in /usr/local/lib/python3.10/dist-packages (from python-slugify->kaggle) (1.3)
Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests->kaggle) (3.3.2)
Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests->kaggle) (3.7)
Dataset URL: https://www.kaggle.com/datasets/kpgeek/kitti-roadlane-detection-dataset-224-x-224
License(s): unknown
kitti-roadlane-detection-dataset-224-x-224.zip: Skipping, found more recently modified local copy (use --force to force download)
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
<ipython-input-3-88028bc57aa3> in <cell line: 97>()
95
96 train_images, train_masks = load_data(‘kitti_road/data_road_224/training’) # Update path
—> 97 val_images, val_masks = load_data(‘kitti_road/data_road_224/validation’) # Update path
98
99 # Train the U-Net model

<ipython-input-3-88028bc57aa3> in load_data(data_dir, img_size)
78 images = []
79 masks = []
—> 80 for img_file in os.listdir(data_dir):
81 if img_file.endswith(‘.png’) and ‘road’ in img_file:
82 img = cv2.imread(os.path.join(data_dir, img_file))

FileNotFoundError: [Errno 2] No such file or directory: ‘kitti_road/data_road_224/validation’



fyi
data_road_224(2 directories)
About this directory

Add Suggestion
The classic KITTI urban road dataset resized to 224 x 224 image resolution for using in transfer learning models like GoogleNet, Resnet-50, MobileNet-V2, etc, which expect the input of size 224 x 224.

testing

2 directories
training

3 directories
training(3 directories)
About this directory

Add Suggestion
gt_image_2 consist of the Labeled ground truth images and image_2 consist of original road images.

calib

289 files
gt_image_2

290 files
image_2

289 files
testing(2 directories)
About this directory

Add Suggestion
Test images directory

calib

290 files
image_2

291 files
is data structure



# 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()

# Prepare the dataset
def load_data(image_dir, mask_dir, img_size=(224, 224)):
images = []
masks = []

image_files = os.listdir(image_dir)
mask_files = {os.path.basename(f): 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)
mask_file_name = os.path.basename(img_file).replace(“image_224”, “gt_image_224”)
mask_path = os.path.join(mask_dir, mask_file_name)

if img_file in mask_files:
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 {mask_path}”)

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 = ‘kitti_road/data_road_224/training/image_2’
train_mask_dir = ‘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
print(f"Loaded {len(train_images)} images and {len(train_masks)} masks")

# Split the dataset into training and validation sets
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)

######################################################################
# 2. 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)
for sigma in sigma_list:
msr += retinex_ssr(img, sigma)
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

######################################################################
# 3. Upload and Process the Image
######################################################################

# Upload 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()
The error you’re encountering, FileNotFoundError: [Errno 2] No such file or directory: ‘kitti_road/data_road_224/validation’, suggests that the validation directory doesn’t exist. From your dataset structure description, it seems you only have training and testing directories and their subdirectories.

Here’s how you can adapt your code to update the path variables properly and split the training data for validation:

1. Load the dataset structure accurately:
- You have training images in training/image_2 and their corresponding masks in training/gt_image_2.
- There is no validation directory.

2. Split the training dataset for validation:
- Load all training images and masks.
- Split them using train_test_split to create a validation set.

Below is the corrected version of the script:

# 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()

# Prepare the dataset
def load_data(image_dir, mask_dir, img_size=(224, 224)):
images = []
masks = []

image_files = os.listdir(image_dir)
image_files = sorted(image_files) # Ensure consistent order
mask_files = os.listdir(mask_dir)
mask_files = {os.path.basename(f): f for f in mask_files}

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)
mask_file_name = img_file.replace(“umm_”, “road_”).replace(“um_”, “road_”).replace(“uu_”, “road_”).replace(“umm_000000”, “um_lane_”).replace(“umm_000001”,“um_lane_1”).replace(“umm_000002”, “um_lane_2”)
mask_path = os.path.join(mask_dir, mask_file_name)

if mask_file_name in mask_files:
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 {mask_path}”)

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 = ‘kitti_road/data_road_224/training/image_2’
train_mask_dir = ‘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
print(f"Loaded {len(train_images)} images and {len(train_masks)} masks")

# Split the dataset into training and validation sets
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)

######################################################################
# 2. 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)
for sigma in sigma_list:
msr += retinex_ssr(img, sigma)
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

######################################################################
# 3. Upload and Process the Image
######################################################################

# Upload 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()


By making these changes, the script will properly locate the images and masks, and then split the training data for validation. This way, you can train and validate your U-Net model correctly without encountering the FileNotFoundError.
Requirement already satisfied: numpy>=1.21.2 in /usr/local/lib/python3.10/dist-packages (from opencv-python-headless) (1.25.2)
Requirement already satisfied: tensorflow in /usr/local/lib/python3.10/dist-packages (2.15.0)
Requirement already satisfied: absl-py>=1.0.0 in /usr/local/lib/python3.10/dist-packages (from tensorflow) (1.4.0)
Requirement already satisfied: astunparse>=1.6.0 in /usr/local/lib/python3.10/dist-packages (from tensorflow) (1.6.3)
Requirement already satisfied: flatbuffers>=23.5.26 in /usr/local/lib/python3.10/dist-packages (from tensorflow) (24.3.25)
Requirement already satisfied: gast!=0.5.0,!=0.5.1,!=0.5.2,>=0.2.1 in /usr/local/lib/python3.10/dist-packages (from tensorflow) (0.5.4)
Requirement already satisfied: google-pasta>=0.1.1 in /usr/local/lib/python3.10/dist-packages (from tensorflow) (0.2.0)
Requirement already satisfied: h5py>=2.9.0 in /usr/local/lib/python3.10/dist-packages (from tensorflow) (3.9.0)
Requirement already satisfied: libclang>=13.0.0 in /usr/local/lib/python3.10/dist-packages (from tensorflow) (18.1.1)
Requirement already satisfied: ml-dtypes~=0.2.0 in /usr/local/lib/python3.10/dist-packages (from tensorflow) (0.2.0)
Requirement already satisfied: numpy<2.0.0,>=1.23.5 in /usr/local/lib/python3.10/dist-packages (from tensorflow) (1.25.2)
Requirement already satisfied: opt-einsum>=2.3.2 in /usr/local/lib/python3.10/dist-packages (from tensorflow) (3.3.0)
Requirement already satisfied: packaging in /usr/local/lib/python3.10/dist-packages (from tensorflow) (24.0)
Requirement already satisfied: protobuf!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.20.3 in /usr/local/lib/python3.10/dist-packages (from tensorflow) (3.20.3)
Requirement already satisfied: setuptools in /usr/local/lib/python3.10/dist-packages (from tensorflow) (67.7.2)
Requirement already satisfied: six>=1.12.0 in /usr/local/lib/python3.10/dist-packages (from tensorflow) (1.16.0)
Requirement already satisfied: termcolor>=1.1.0 in /usr/local/lib/python3.10/dist-packages (from tensorflow) (2.4.0)
Requirement already satisfied: typing-extensions>=3.6.6 in /usr/local/lib/python3.10/dist-packages (from tensorflow) (4.12.1)
Requirement already satisfied: wrapt<1.15,>=1.11.0 in /usr/local/lib/python3.10/dist-packages (from tensorflow) (1.14.1)
Requirement already satisfied: tensorflow-io-gcs-filesystem>=0.23.1 in /usr/local/lib/python3.10/dist-packages (from tensorflow) (0.37.0)
Requirement already satisfied: grpcio<2.0,>=1.24.3 in /usr/local/lib/python3.10/dist-packages (from tensorflow) (1.64.1)
Requirement already satisfied: tensorboard<2.16,>=2.15 in /usr/local/lib/python3.10/dist-packages (from tensorflow) (2.15.2)
Requirement already satisfied: tensorflow-estimator<2.16,>=2.15.0 in /usr/local/lib/python3.10/dist-packages (from tensorflow) (2.15.0)
Requirement already satisfied: keras<2.16,>=2.15.0 in /usr/local/lib/python3.10/dist-packages (from tensorflow) (2.15.0)
Requirement already satisfied: wheel<1.0,>=0.23.0 in /usr/local/lib/python3.10/dist-packages (from astunparse>=1.6.0->tensorflow) (0.43.0)
Requirement already satisfied: google-auth<3,>=1.6.3 in /usr/local/lib/python3.10/dist-packages (from tensorboard<2.16,>=2.15->tensorflow) (2.27.0)
Requirement already satisfied: google-auth-oauthlib<2,>=0.5 in /usr/local/lib/python3.10/dist-packages (from tensorboard<2.16,>=2.15->tensorflow) (1.2.0)
Requirement already satisfied: markdown>=2.6.8 in /usr/local/lib/python3.10/dist-packages (from tensorboard<2.16,>=2.15->tensorflow) (3.6)
Requirement already satisfied: requests<3,>=2.21.0 in /usr/local/lib/python3.10/dist-packages (from tensorboard<2.16,>=2.15->tensorflow) (2.31.0)
Requirement already satisfied: tensorboard-data-server<0.8.0,>=0.7.0 in /usr/local/lib/python3.10/dist-packages (from tensorboard<2.16,>=2.15->tensorflow) (0.7.2)
Requirement already satisfied: werkzeug>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from tensorboard<2.16,>=2.15->tensorflow) (3.0.3)
Requirement already satisfied: cachetools<6.0,>=2.0.0 in /usr/local/lib/python3.10/dist-packages (from google-auth<3,>=1.6.3->tensorboard<2.16,>=2.15->tensorflow) (5.3.3)
Requirement already satisfied: pyasn1-modules>=0.2.1 in /usr/local/lib/python3.10/dist-packages (from google-auth<3,>=1.6.3->tensorboard<2.16,>=2.15->tensorflow) (0.4.0)
Requirement already satisfied: rsa<5,>=3.1.4 in /usr/local/lib/python3.10/dist-packages (from google-auth<3,>=1.6.3->tensorboard<2.16,>=2.15->tensorflow) (4.9)
Requirement already satisfied: requests-oauthlib>=0.7.0 in /usr/local/lib/python3.10/dist-packages (from google-auth-oauthlib<2,>=0.5->tensorboard<2.16,>=2.15->tensorflow) (1.3.1)
Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests<3,>=2.21.0->tensorboard<2.16,>=2.15->tensorflow) (3.3.2)
Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests<3,>=2.21.0->tensorboard<2.16,>=2.15->tensorflow) (3.7)
Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests<3,>=2.21.0->tensorboard<2.16,>=2.15->tensorflow) (2.0.7)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests<3,>=2.21.0->tensorboard<2.16,>=2.15->tensorflow) (2024.6.2)
Requirement already satisfied: MarkupSafe>=2.1.1 in /usr/local/lib/python3.10/dist-packages (from werkzeug>=1.0.1->tensorboard<2.16,>=2.15->tensorflow) (2.1.5)
Requirement already satisfied: pyasn1<0.7.0,>=0.4.6 in /usr/local/lib/python3.10/dist-packages (from pyasn1-modules>=0.2.1->google-auth<3,>=1.6.3->tensorboard<2.16,>=2.15->tensorflow) (0.6.0)
Requirement already satisfied: oauthlib>=3.0.0 in /usr/local/lib/python3.10/dist-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<2,>=0.5->tensorboard<2.16,>=2.15->tensorflow) (3.2.2)
Requirement already satisfied: kaggle in /usr/local/lib/python3.10/dist-packages (1.6.14)
Requirement already satisfied: six>=1.10 in /usr/local/lib/python3.10/dist-packages (from kaggle) (1.16.0)
Requirement already satisfied: certifi>=2023.7.22 in /usr/local/lib/python3.10/dist-packages (from kaggle) (2024.6.2)
Requirement already satisfied: python-dateutil in /usr/local/lib/python3.10/dist-packages (from kaggle) (2.8.2)
Requirement already satisfied: requests in /usr/local/lib/python3.10/dist-packages (from kaggle) (2.31.0)
Requirement already satisfied: tqdm in /usr/local/lib/python3.10/dist-packages (from kaggle) (4.66.4)
Requirement already satisfied: python-slugify in /usr/local/lib/python3.10/dist-packages (from kaggle) (8.0.4)
Requirement already satisfied: urllib3 in /usr/local/lib/python3.10/dist-packages (from kaggle) (2.0.7)
Requirement already satisfied: bleach in /usr/local/lib/python3.10/dist-packages (from kaggle) (6.1.0)
Requirement already satisfied: webencodings in /usr/local/lib/python3.10/dist-packages (from bleach->kaggle) (0.5.1)
Requirement already satisfied: text-unidecode>=1.3 in /usr/local/lib/python3.10/dist-packages (from python-slugify->kaggle) (1.3)
Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests->kaggle) (3.3.2)
Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests->kaggle) (3.7)
Dataset URL: https://www.kaggle.com/datasets/kpgeek/kitti-roadlane-detection-dataset-224-x-224
License(s): unknown
kitti-roadlane-detection-dataset-224-x-224.zip: Skipping, found more recently modified local copy (use --force to force download)
Total image files: 289, Total mask files: 290
Missing file: kitti_road/data_road_224/training/image_2/image_224 (1).png or kitti_road/data_road_224/training/gt_image_2/image_224 (1).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (10).png or kitti_road/data_road_224/training/gt_image_2/image_224 (10).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (100).png or kitti_road/data_road_224/training/gt_image_2/image_224 (100).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (101).png or kitti_road/data_road_224/training/gt_image_2/image_224 (101).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (102).png or kitti_road/data_road_224/training/gt_image_2/image_224 (102).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (103).png or kitti_road/data_road_224/training/gt_image_2/image_224 (103).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (104).png or kitti_road/data_road_224/training/gt_image_2/image_224 (104).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (105).png or kitti_road/data_road_224/training/gt_image_2/image_224 (105).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (106).png or kitti_road/data_road_224/training/gt_image_2/image_224 (106).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (107).png or kitti_road/data_road_224/training/gt_image_2/image_224 (107).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (108).png or kitti_road/data_road_224/training/gt_image_2/image_224 (108).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (109).png or kitti_road/data_road_224/training/gt_image_2/image_224 (109).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (11).png or kitti_road/data_road_224/training/gt_image_2/image_224 (11).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (110).png or kitti_road/data_road_224/training/gt_image_2/image_224 (110).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (111).png or kitti_road/data_road_224/training/gt_image_2/image_224 (111).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (112).png or kitti_road/data_road_224/training/gt_image_2/image_224 (112).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (113).png or kitti_road/data_road_224/training/gt_image_2/image_224 (113).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (114).png or kitti_road/data_road_224/training/gt_image_2/image_224 (114).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (115).png or kitti_road/data_road_224/training/gt_image_2/image_224 (115).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (116).png or kitti_road/data_road_224/training/gt_image_2/image_224 (116).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (117).png or kitti_road/data_road_224/training/gt_image_2/image_224 (117).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (118).png or kitti_road/data_road_224/training/gt_image_2/image_224 (118).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (119).png or kitti_road/data_road_224/training/gt_image_2/image_224 (119).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (12).png or kitti_road/data_road_224/training/gt_image_2/image_224 (12).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (120).png or kitti_road/data_road_224/training/gt_image_2/image_224 (120).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (121).png or kitti_road/data_road_224/training/gt_image_2/image_224 (121).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (122).png or kitti_road/data_road_224/training/gt_image_2/image_224 (122).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (123).png or kitti_road/data_road_224/training/gt_image_2/image_224 (123).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (124).png or kitti_road/data_road_224/training/gt_image_2/image_224 (124).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (125).png or kitti_road/data_road_224/training/gt_image_2/image_224 (125).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (126).png or kitti_road/data_road_224/training/gt_image_2/image_224 (126).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (127).png or kitti_road/data_road_224/training/gt_image_2/image_224 (127).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (128).png or kitti_road/data_road_224/training/gt_image_2/image_224 (128).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (129).png or kitti_road/data_road_224/training/gt_image_2/image_224 (129).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (13).png or kitti_road/data_road_224/training/gt_image_2/image_224 (13).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (130).png or kitti_road/data_road_224/training/gt_image_2/image_224 (130).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (131).png or kitti_road/data_road_224/training/gt_image_2/image_224 (131).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (132).png or kitti_road/data_road_224/training/gt_image_2/image_224 (132).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (133).png or kitti_road/data_road_224/training/gt_image_2/image_224 (133).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (134).png or kitti_road/data_road_224/training/gt_image_2/image_224 (134).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (135).png or kitti_road/data_road_224/training/gt_image_2/image_224 (135).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (136).png or kitti_road/data_road_224/training/gt_image_2/image_224 (136).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (137).png or kitti_road/data_road_224/training/gt_image_2/image_224 (137).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (138).png or kitti_road/data_road_224/training/gt_image_2/image_224 (138).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (139).png or kitti_road/data_road_224/training/gt_image_2/image_224 (139).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (14).png or kitti_road/data_road_224/training/gt_image_2/image_224 (14).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (140).png or kitti_road/data_road_224/training/gt_image_2/image_224 (140).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (141).png or kitti_road/data_road_224/training/gt_image_2/image_224 (141).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (142).png or kitti_road/data_road_224/training/gt_image_2/image_224 (142).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (143).png or kitti_road/data_road_224/training/gt_image_2/image_224 (143).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (144).png or kitti_road/data_road_224/training/gt_image_2/image_224 (144).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (145).png or kitti_road/data_road_224/training/gt_image_2/image_224 (145).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (146).png or kitti_road/data_road_224/training/gt_image_2/image_224 (146).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (147).png or kitti_road/data_road_224/training/gt_image_2/image_224 (147).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (148).png or kitti_road/data_road_224/training/gt_image_2/image_224 (148).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (149).png or kitti_road/data_road_224/training/gt_image_2/image_224 (149).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (15).png or kitti_road/data_road_224/training/gt_image_2/image_224 (15).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (150).png or kitti_road/data_road_224/training/gt_image_2/image_224 (150).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (151).png or kitti_road/data_road_224/training/gt_image_2/image_224 (151).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (152).png or kitti_road/data_road_224/training/gt_image_2/image_224 (152).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (153).png or kitti_road/data_road_224/training/gt_image_2/image_224 (153).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (154).png or kitti_road/data_road_224/training/gt_image_2/image_224 (154).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (155).png or kitti_road/data_road_224/training/gt_image_2/image_224 (155).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (156).png or kitti_road/data_road_224/training/gt_image_2/image_224 (156).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (157).png or kitti_road/data_road_224/training/gt_image_2/image_224 (157).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (158).png or kitti_road/data_road_224/training/gt_image_2/image_224 (158).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (159).png or kitti_road/data_road_224/training/gt_image_2/image_224 (159).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (16).png or kitti_road/data_road_224/training/gt_image_2/image_224 (16).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (160).png or kitti_road/data_road_224/training/gt_image_2/image_224 (160).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (161).png or kitti_road/data_road_224/training/gt_image_2/image_224 (161).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (162).png or kitti_road/data_road_224/training/gt_image_2/image_224 (162).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (163).png or kitti_road/data_road_224/training/gt_image_2/image_224 (163).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (164).png or kitti_road/data_road_224/training/gt_image_2/image_224 (164).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (165).png or kitti_road/data_road_224/training/gt_image_2/image_224 (165).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (166).png or kitti_road/data_road_224/training/gt_image_2/image_224 (166).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (167).png or kitti_road/data_road_224/training/gt_image_2/image_224 (167).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (168).png or kitti_road/data_road_224/training/gt_image_2/image_224 (168).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (169).png or kitti_road/data_road_224/training/gt_image_2/image_224 (169).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (17).png or kitti_road/data_road_224/training/gt_image_2/image_224 (17).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (170).png or kitti_road/data_road_224/training/gt_image_2/image_224 (170).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (171).png or kitti_road/data_road_224/training/gt_image_2/image_224 (171).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (172).png or kitti_road/data_road_224/training/gt_image_2/image_224 (172).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (173).png or kitti_road/data_road_224/training/gt_image_2/image_224 (173).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (174).png or kitti_road/data_road_224/training/gt_image_2/image_224 (174).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (175).png or kitti_road/data_road_224/training/gt_image_2/image_224 (175).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (176).png or kitti_road/data_road_224/training/gt_image_2/image_224 (176).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (177).png or kitti_road/data_road_224/training/gt_image_2/image_224 (177).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (178).png or kitti_road/data_road_224/training/gt_image_2/image_224 (178).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (179).png or kitti_road/data_road_224/training/gt_image_2/image_224 (179).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (18).png or kitti_road/data_road_224/training/gt_image_2/image_224 (18).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (180).png or kitti_road/data_road_224/training/gt_image_2/image_224 (180).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (181).png or kitti_road/data_road_224/training/gt_image_2/image_224 (181).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (182).png or kitti_road/data_road_224/training/gt_image_2/image_224 (182).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (183).png or kitti_road/data_road_224/training/gt_image_2/image_224 (183).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (184).png or kitti_road/data_road_224/training/gt_image_2/image_224 (184).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (185).png or kitti_road/data_road_224/training/gt_image_2/image_224 (185).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (186).png or kitti_road/data_road_224/training/gt_image_2/image_224 (186).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (187).png or kitti_road/data_road_224/training/gt_image_2/image_224 (187).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (188).png or kitti_road/data_road_224/training/gt_image_2/image_224 (188).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (189).png or kitti_road/data_road_224/training/gt_image_2/image_224 (189).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (19).png or kitti_road/data_road_224/training/gt_image_2/image_224 (19).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (190).png or kitti_road/data_road_224/training/gt_image_2/image_224 (190).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (191).png or kitti_road/data_road_224/training/gt_image_2/image_224 (191).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (192).png or kitti_road/data_road_224/training/gt_image_2/image_224 (192).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (193).png or kitti_road/data_road_224/training/gt_image_2/image_224 (193).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (194).png or kitti_road/data_road_224/training/gt_image_2/image_224 (194).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (195).png or kitti_road/data_road_224/training/gt_image_2/image_224 (195).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (196).png or kitti_road/data_road_224/training/gt_image_2/image_224 (196).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (197).png or kitti_road/data_road_224/training/gt_image_2/image_224 (197).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (198).png or kitti_road/data_road_224/training/gt_image_2/image_224 (198).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (199).png or kitti_road/data_road_224/training/gt_image_2/image_224 (199).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (2).png or kitti_road/data_road_224/training/gt_image_2/image_224 (2).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (20).png or kitti_road/data_road_224/training/gt_image_2/image_224 (20).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (200).png or kitti_road/data_road_224/training/gt_image_2/image_224 (200).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (201).png or kitti_road/data_road_224/training/gt_image_2/image_224 (201).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (202).png or kitti_road/data_road_224/training/gt_image_2/image_224 (202).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (203).png or kitti_road/data_road_224/training/gt_image_2/image_224 (203).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (204).png or kitti_road/data_road_224/training/gt_image_2/image_224 (204).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (205).png or kitti_road/data_road_224/training/gt_image_2/image_224 (205).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (206).png or kitti_road/data_road_224/training/gt_image_2/image_224 (206).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (207).png or kitti_road/data_road_224/training/gt_image_2/image_224 (207).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (208).png or kitti_road/data_road_224/training/gt_image_2/image_224 (208).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (209).png or kitti_road/data_road_224/training/gt_image_2/image_224 (209).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (21).png or kitti_road/data_road_224/training/gt_image_2/image_224 (21).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (210).png or kitti_road/data_road_224/training/gt_image_2/image_224 (210).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (211).png or kitti_road/data_road_224/training/gt_image_2/image_224 (211).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (212).png or kitti_road/data_road_224/training/gt_image_2/image_224 (212).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (213).png or kitti_road/data_road_224/training/gt_image_2/image_224 (213).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (214).png or kitti_road/data_road_224/training/gt_image_2/image_224 (214).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (215).png or kitti_road/data_road_224/training/gt_image_2/image_224 (215).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (216).png or kitti_road/data_road_224/training/gt_image_2/image_224 (216).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (217).png or kitti_road/data_road_224/training/gt_image_2/image_224 (217).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (218).png or kitti_road/data_road_224/training/gt_image_2/image_224 (218).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (219).png or kitti_road/data_road_224/training/gt_image_2/image_224 (219).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (22).png or kitti_road/data_road_224/training/gt_image_2/image_224 (22).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (220).png or kitti_road/data_road_224/training/gt_image_2/image_224 (220).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (221).png or kitti_road/data_road_224/training/gt_image_2/image_224 (221).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (222).png or kitti_road/data_road_224/training/gt_image_2/image_224 (222).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (223).png or kitti_road/data_road_224/training/gt_image_2/image_224 (223).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (224).png or kitti_road/data_road_224/training/gt_image_2/image_224 (224).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (225).png or kitti_road/data_road_224/training/gt_image_2/image_224 (225).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (226).png or kitti_road/data_road_224/training/gt_image_2/image_224 (226).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (227).png or kitti_road/data_road_224/training/gt_image_2/image_224 (227).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (228).png or kitti_road/data_road_224/training/gt_image_2/image_224 (228).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (229).png or kitti_road/data_road_224/training/gt_image_2/image_224 (229).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (23).png or kitti_road/data_road_224/training/gt_image_2/image_224 (23).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (230).png or kitti_road/data_road_224/training/gt_image_2/image_224 (230).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (231).png or kitti_road/data_road_224/training/gt_image_2/image_224 (231).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (232).png or kitti_road/data_road_224/training/gt_image_2/image_224 (232).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (233).png or kitti_road/data_road_224/training/gt_image_2/image_224 (233).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (234).png or kitti_road/data_road_224/training/gt_image_2/image_224 (234).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (235).png or kitti_road/data_road_224/training/gt_image_2/image_224 (235).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (236).png or kitti_road/data_road_224/training/gt_image_2/image_224 (236).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (237).png or kitti_road/data_road_224/training/gt_image_2/image_224 (237).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (238).png or kitti_road/data_road_224/training/gt_image_2/image_224 (238).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (239).png or kitti_road/data_road_224/training/gt_image_2/image_224 (239).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (24).png or kitti_road/data_road_224/training/gt_image_2/image_224 (24).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (240).png or kitti_road/data_road_224/training/gt_image_2/image_224 (240).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (241).png or kitti_road/data_road_224/training/gt_image_2/image_224 (241).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (242).png or kitti_road/data_road_224/training/gt_image_2/image_224 (242).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (243).png or kitti_road/data_road_224/training/gt_image_2/image_224 (243).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (244).png or kitti_road/data_road_224/training/gt_image_2/image_224 (244).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (245).png or kitti_road/data_road_224/training/gt_image_2/image_224 (245).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (246).png or kitti_road/data_road_224/training/gt_image_2/image_224 (246).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (247).png or kitti_road/data_road_224/training/gt_image_2/image_224 (247).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (248).png or kitti_road/data_road_224/training/gt_image_2/image_224 (248).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (249).png or kitti_road/data_road_224/training/gt_image_2/image_224 (249).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (25).png or kitti_road/data_road_224/training/gt_image_2/image_224 (25).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (250).png or kitti_road/data_road_224/training/gt_image_2/image_224 (250).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (251).png or kitti_road/data_road_224/training/gt_image_2/image_224 (251).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (252).png or kitti_road/data_road_224/training/gt_image_2/image_224 (252).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (253).png or kitti_road/data_road_224/training/gt_image_2/image_224 (253).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (254).png or kitti_road/data_road_224/training/gt_image_2/image_224 (254).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (255).png or kitti_road/data_road_224/training/gt_image_2/image_224 (255).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (256).png or kitti_road/data_road_224/training/gt_image_2/image_224 (256).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (257).png or kitti_road/data_road_224/training/gt_image_2/image_224 (257).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (258).png or kitti_road/data_road_224/training/gt_image_2/image_224 (258).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (259).png or kitti_road/data_road_224/training/gt_image_2/image_224 (259).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (26).png or kitti_road/data_road_224/training/gt_image_2/image_224 (26).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (260).png or kitti_road/data_road_224/training/gt_image_2/image_224 (260).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (261).png or kitti_road/data_road_224/training/gt_image_2/image_224 (261).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (262).png or kitti_road/data_road_224/training/gt_image_2/image_224 (262).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (263).png or kitti_road/data_road_224/training/gt_image_2/image_224 (263).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (264).png or kitti_road/data_road_224/training/gt_image_2/image_224 (264).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (265).png or kitti_road/data_road_224/training/gt_image_2/image_224 (265).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (266).png or kitti_road/data_road_224/training/gt_image_2/image_224 (266).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (267).png or kitti_road/data_road_224/training/gt_image_2/image_224 (267).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (268).png or kitti_road/data_road_224/training/gt_image_2/image_224 (268).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (269).png or kitti_road/data_road_224/training/gt_image_2/image_224 (269).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (27).png or kitti_road/data_road_224/training/gt_image_2/image_224 (27).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (270).png or kitti_road/data_road_224/training/gt_image_2/image_224 (270).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (271).png or kitti_road/data_road_224/training/gt_image_2/image_224 (271).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (272).png or kitti_road/data_road_224/training/gt_image_2/image_224 (272).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (273).png or kitti_road/data_road_224/training/gt_image_2/image_224 (273).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (274).png or kitti_road/data_road_224/training/gt_image_2/image_224 (274).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (275).png or kitti_road/data_road_224/training/gt_image_2/image_224 (275).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (276).png or kitti_road/data_road_224/training/gt_image_2/image_224 (276).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (277).png or kitti_road/data_road_224/training/gt_image_2/image_224 (277).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (278).png or kitti_road/data_road_224/training/gt_image_2/image_224 (278).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (279).png or kitti_road/data_road_224/training/gt_image_2/image_224 (279).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (28).png or kitti_road/data_road_224/training/gt_image_2/image_224 (28).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (280).png or kitti_road/data_road_224/training/gt_image_2/image_224 (280).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (281).png or kitti_road/data_road_224/training/gt_image_2/image_224 (281).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (282).png or kitti_road/data_road_224/training/gt_image_2/image_224 (282).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (283).png or kitti_road/data_road_224/training/gt_image_2/image_224 (283).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (284).png or kitti_road/data_road_224/training/gt_image_2/image_224 (284).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (285).png or kitti_road/data_road_224/training/gt_image_2/image_224 (285).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (286).png or kitti_road/data_road_224/training/gt_image_2/image_224 (286).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (287).png or kitti_road/data_road_224/training/gt_image_2/image_224 (287).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (288).png or kitti_road/data_road_224/training/gt_image_2/image_224 (288).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (289).png or kitti_road/data_road_224/training/gt_image_2/image_224 (289).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (29).png or kitti_road/data_road_224/training/gt_image_2/image_224 (29).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (3).png or kitti_road/data_road_224/training/gt_image_2/image_224 (3).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (30).png or kitti_road/data_road_224/training/gt_image_2/image_224 (30).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (31).png or kitti_road/data_road_224/training/gt_image_2/image_224 (31).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (32).png or kitti_road/data_road_224/training/gt_image_2/image_224 (32).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (33).png or kitti_road/data_road_224/training/gt_image_2/image_224 (33).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (34).png or kitti_road/data_road_224/training/gt_image_2/image_224 (34).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (35).png or kitti_road/data_road_224/training/gt_image_2/image_224 (35).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (36).png or kitti_road/data_road_224/training/gt_image_2/image_224 (36).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (37).png or kitti_road/data_road_224/training/gt_image_2/image_224 (37).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (38).png or kitti_road/data_road_224/training/gt_image_2/image_224 (38).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (39).png or kitti_road/data_road_224/training/gt_image_2/image_224 (39).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (4).png or kitti_road/data_road_224/training/gt_image_2/image_224 (4).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (40).png or kitti_road/data_road_224/training/gt_image_2/image_224 (40).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (41).png or kitti_road/data_road_224/training/gt_image_2/image_224 (41).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (42).png or kitti_road/data_road_224/training/gt_image_2/image_224 (42).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (43).png or kitti_road/data_road_224/training/gt_image_2/image_224 (43).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (44).png or kitti_road/data_road_224/training/gt_image_2/image_224 (44).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (45).png or kitti_road/data_road_224/training/gt_image_2/image_224 (45).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (46).png or kitti_road/data_road_224/training/gt_image_2/image_224 (46).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (47).png or kitti_road/data_road_224/training/gt_image_2/image_224 (47).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (48).png or kitti_road/data_road_224/training/gt_image_2/image_224 (48).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (49).png or kitti_road/data_road_224/training/gt_image_2/image_224 (49).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (5).png or kitti_road/data_road_224/training/gt_image_2/image_224 (5).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (50).png or kitti_road/data_road_224/training/gt_image_2/image_224 (50).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (51).png or kitti_road/data_road_224/training/gt_image_2/image_224 (51).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (52).png or kitti_road/data_road_224/training/gt_image_2/image_224 (52).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (53).png or kitti_road/data_road_224/training/gt_image_2/image_224 (53).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (54).png or kitti_road/data_road_224/training/gt_image_2/image_224 (54).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (55).png or kitti_road/data_road_224/training/gt_image_2/image_224 (55).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (56).png or kitti_road/data_road_224/training/gt_image_2/image_224 (56).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (57).png or kitti_road/data_road_224/training/gt_image_2/image_224 (57).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (58).png or kitti_road/data_road_224/training/gt_image_2/image_224 (58).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (59).png or kitti_road/data_road_224/training/gt_image_2/image_224 (59).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (6).png or kitti_road/data_road_224/training/gt_image_2/image_224 (6).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (60).png or kitti_road/data_road_224/training/gt_image_2/image_224 (60).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (61).png or kitti_road/data_road_224/training/gt_image_2/image_224 (61).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (62).png or kitti_road/data_road_224/training/gt_image_2/image_224 (62).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (63).png or kitti_road/data_road_224/training/gt_image_2/image_224 (63).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (64).png or kitti_road/data_road_224/training/gt_image_2/image_224 (64).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (65).png or kitti_road/data_road_224/training/gt_image_2/image_224 (65).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (66).png or kitti_road/data_road_224/training/gt_image_2/image_224 (66).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (67).png or kitti_road/data_road_224/training/gt_image_2/image_224 (67).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (68).png or kitti_road/data_road_224/training/gt_image_2/image_224 (68).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (69).png or kitti_road/data_road_224/training/gt_image_2/image_224 (69).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (7).png or kitti_road/data_road_224/training/gt_image_2/image_224 (7).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (70).png or kitti_road/data_road_224/training/gt_image_2/image_224 (70).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (71).png or kitti_road/data_road_224/training/gt_image_2/image_224 (71).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (72).png or kitti_road/data_road_224/training/gt_image_2/image_224 (72).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (73).png or kitti_road/data_road_224/training/gt_image_2/image_224 (73).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (74).png or kitti_road/data_road_224/training/gt_image_2/image_224 (74).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (75).png or kitti_road/data_road_224/training/gt_image_2/image_224 (75).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (76).png or kitti_road/data_road_224/training/gt_image_2/image_224 (76).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (77).png or kitti_road/data_road_224/training/gt_image_2/image_224 (77).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (78).png or kitti_road/data_road_224/training/gt_image_2/image_224 (78).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (79).png or kitti_road/data_road_224/training/gt_image_2/image_224 (79).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (8).png or kitti_road/data_road_224/training/gt_image_2/image_224 (8).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (80).png or kitti_road/data_road_224/training/gt_image_2/image_224 (80).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (81).png or kitti_road/data_road_224/training/gt_image_2/image_224 (81).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (82).png or kitti_road/data_road_224/training/gt_image_2/image_224 (82).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (83).png or kitti_road/data_road_224/training/gt_image_2/image_224 (83).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (84).png or kitti_road/data_road_224/training/gt_image_2/image_224 (84).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (85).png or kitti_road/data_road_224/training/gt_image_2/image_224 (85).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (86).png or kitti_road/data_road_224/training/gt_image_2/image_224 (86).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (87).png or kitti_road/data_road_224/training/gt_image_2/image_224 (87).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (88).png or kitti_road/data_road_224/training/gt_image_2/image_224 (88).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (89).png or kitti_road/data_road_224/training/gt_image_2/image_224 (89).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (9).png or kitti_road/data_road_224/training/gt_image_2/image_224 (9).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (90).png or kitti_road/data_road_224/training/gt_image_2/image_224 (90).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (91).png or kitti_road/data_road_224/training/gt_image_2/image_224 (91).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (92).png or kitti_road/data_road_224/training/gt_image_2/image_224 (92).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (93).png or kitti_road/data_road_224/training/gt_image_2/image_224 (93).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (94).png or kitti_road/data_road_224/training/gt_image_2/image_224 (94).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (95).png or kitti_road/data_road_224/training/gt_image_2/image_224 (95).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (96).png or kitti_road/data_road_224/training/gt_image_2/image_224 (96).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (97).png or kitti_road/data_road_224/training/gt_image_2/image_224 (97).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (98).png or kitti_road/data_road_224/training/gt_image_2/image_224 (98).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (99).png or kitti_road/data_road_224/training/gt_image_2/image_224 (99).png
Loaded 0 images and 0 masks
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-9-54f3443a0370> in <cell line: 128>()
126
127 # Split the dataset into training and validation sets
–> 128 train_images, val_images, train_masks, val_masks = train_test_split(train_images, train_masks, test_size=0.2, random_state=42)
129
130 # Check sizes of the datasets

1 frames
/usr/local/lib/python3.10/dist-packages/sklearn/model_selection/split.py in validate_shuffle_split(n_samples, test_size, train_size, default_test_size)
2234
2235 if n_train == 0:
-> 2236 raise ValueError(
2237 "With n_samples={}, test_size={} and train_size={}, the "
2238 "resulting train set will be empty. Adjust any of the "

ValueError: With n_samples=0, test_size=0.2 and train_size=None, the resulting train set will be empty. Adjust any of the aforementioned parameters.
please i provided you directory structure and names
already satisfied: python-slugify in /usr/local/lib/python3.10/dist-packages (from kaggle) (8.0.4)
Requirement already satisfied: urllib3 in /usr/local/lib/python3.10/dist-packages (from kaggle) (2.0.7)
Requirement already satisfied: bleach in /usr/local/lib/python3.10/dist-packages (from kaggle) (6.1.0)
Requirement already satisfied: webencodings in /usr/local/lib/python3.10/dist-packages (from bleach->kaggle) (0.5.1)
Requirement already satisfied: text-unidecode>=1.3 in /usr/local/lib/python3.10/dist-packages (from python-slugify->kaggle) (1.3)
Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests->kaggle) (3.3.2)
Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests->kaggle) (3.7)
Dataset URL: https://www.kaggle.com/datasets/kpgeek/kitti-roadlane-detection-dataset-224-x-224
License(s): unknown
kitti-roadlane-detection-dataset-224-x-224.zip: Skipping, found more recently modified local copy (use --force to force download)
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
<ipython-input-3-88028bc57aa3> in <cell line: 97>()
95
96 train_images, train_masks = load_data(‘kitti_road/data_road_224/training’) # Update path
—> 97 val_images, val_masks = load_data(‘kitti_road/data_road_224/validation’) # Update path
98
99 # Train the U-Net model

<ipython-input-3-88028bc57aa3> in load_data(data_dir, img_size)
78 images = []
79 masks = []
—> 80 for img_file in os.listdir(data_dir):
81 if img_file.endswith(‘.png’) and ‘road’ in img_file:
82 img = cv2.imread(os.path.join(data_dir, img_file))

FileNotFoundError: [Errno 2] No such file or directory: ‘kitti_road/data_road_224/validation’



fyi
data_road_224(2 directories)
About this directory

Add Suggestion
The classic KITTI urban road dataset resized to 224 x 224 image resolution for using in transfer learning models like GoogleNet, Resnet-50, MobileNet-V2, etc, which expect the input of size 224 x 224.

testing

2 directories
training

3 directories
training(3 directories)
About this directory

Add Suggestion
gt_image_2 consist of the Labeled ground truth images and image_2 consist of original road images.

calib

289 files
gt_image_2

290 files
image_2

289 files
testing(2 directories)
About this directory

Add Suggestion
Test images directory

calib

290 files
image_2

291 files
is data structure
Thank you for providing the detailed directory structure and the error message. Based on the information, it seems there are some mismatches between the image filenames and the mask filenames. Let’s correct the script to handle the filenames properly.

Given the directory structure:
- training/image_2: Contains the original road images.
- training/gt_image_2: Contains the labeled ground truth images.

We need to ensure that the filenames in image_2 and gt_image_2 match correctly. Let’s update the script to handle this:

1. Load the dataset structure accurately:
- Ensure that the filenames in image_2 and gt_image_2 match correctly.
- Split the training data for validation.

Here is the updated script:

# 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()

# Prepare the dataset
def load_data(image_dir, mask_dir, img_size=(224, 224)):
images = []
masks = []

image_files = os.listdir(image_dir)
image_files = sorted(image_files) # Ensure consistent order
mask_files = os.listdir(mask_dir)
mask_files = {os.path.basename(f): f for f in mask_files}

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)
mask_file_name = img_file.replace(“umm”, “road”).replace(“um_”, “road_”).replace(“uu_”, “road_”)
mask_path = os.path.join(mask_dir, mask_file_name)

if mask_file_name in mask_files:
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 {mask_path}”)

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 = ‘kitti_road/data_road_224/training/image_2’
train_mask_dir = ‘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
print(f"Loaded {len(train_images)} images and {len(train_masks)} masks")

# Split the dataset into training and validation sets
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)

######################################################################
# 2. 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)
for sigma in sigma_list:
msr += retinex_ssr(img, sigma)
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

######################################################################
# 3. Upload and Process the Image
######################################################################

# Upload 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()


### Key Changes:
1. Filename Matching: Updated the mask_file_name generation to match the filenames in gt_image_2 with the filenames in image_2.
2. Debugging Output: Added print statements to help debug missing files and ensure the correct files are being loaded.

This script should now correctly load the images and masks, and then split the training data for validation. If there are still issues with missing files, you may need to further investigate the exact filenames in your dataset and ensure they match correctly.

i asked u 100 times but same error now fix it in one go
forever plzzz
Missing file: kitti_road/data_road_224/training/image_2/image_224 (253).png or kitti_road/data_road_224/training/gt_image_2/image_224 (253).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (254).png or kitti_road/data_road_224/training/gt_image_2/image_224 (254).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (255).png or kitti_road/data_road_224/training/gt_image_2/image_224 (255).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (256).png or kitti_road/data_road_224/training/gt_image_2/image_224 (256).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (257).png or kitti_road/data_road_224/training/gt_image_2/image_224 (257).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (258).png or kitti_road/data_road_224/training/gt_image_2/image_224 (258).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (259).png or kitti_road/data_road_224/training/gt_image_2/image_224 (259).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (26).png or kitti_road/data_road_224/training/gt_image_2/image_224 (26).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (260).png or kitti_road/data_road_224/training/gt_image_2/image_224 (260).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (261).png or kitti_road/data_road_224/training/gt_image_2/image_224 (261).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (262).png or kitti_road/data_road_224/training/gt_image_2/image_224 (262).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (263).png or kitti_road/data_road_224/training/gt_image_2/image_224 (263).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (264).png or kitti_road/data_road_224/training/gt_image_2/image_224 (264).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (265).png or kitti_road/data_road_224/training/gt_image_2/image_224 (265).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (266).png or kitti_road/data_road_224/training/gt_image_2/image_224 (266).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (267).png or kitti_road/data_road_224/training/gt_image_2/image_224 (267).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (268).png or kitti_road/data_road_224/training/gt_image_2/image_224 (268).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (269).png or kitti_road/data_road_224/training/gt_image_2/image_224 (269).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (27).png or kitti_road/data_road_224/training/gt_image_2/image_224 (27).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (270).png or kitti_road/data_road_224/training/gt_image_2/image_224 (270).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (271).png or kitti_road/data_road_224/training/gt_image_2/image_224 (271).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (272).png or kitti_road/data_road_224/training/gt_image_2/image_224 (272).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (273).png or kitti_road/data_road_224/training/gt_image_2/image_224 (273).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (274).png or kitti_road/data_road_224/training/gt_image_2/image_224 (274).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (275).png or kitti_road/data_road_224/training/gt_image_2/image_224 (275).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (276).png or kitti_road/data_road_224/training/gt_image_2/image_224 (276).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (277).png or kitti_road/data_road_224/training/gt_image_2/image_224 (277).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (278).png or kitti_road/data_road_224/training/gt_image_2/image_224 (278).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (279).png or kitti_road/data_road_224/training/gt_image_2/image_224 (279).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (28).png or kitti_road/data_road_224/training/gt_image_2/image_224 (28).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (280).png or kitti_road/data_road_224/training/gt_image_2/image_224 (280).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (281).png or kitti_road/data_road_224/training/gt_image_2/image_224 (281).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (282).png or kitti_road/data_road_224/training/gt_image_2/image_224 (282).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (283).png or kitti_road/data_road_224/training/gt_image_2/image_224 (283).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (284).png or kitti_road/data_road_224/training/gt_image_2/image_224 (284).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (285).png or kitti_road/data_road_224/training/gt_image_2/image_224 (285).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (286).png or kitti_road/data_road_224/training/gt_image_2/image_224 (286).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (287).png or kitti_road/data_road_224/training/gt_image_2/image_224 (287).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (288).png or kitti_road/data_road_224/training/gt_image_2/image_224 (288).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (289).png or kitti_road/data_road_224/training/gt_image_2/image_224 (289).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (29).png or kitti_road/data_road_224/training/gt_image_2/image_224 (29).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (3).png or kitti_road/data_road_224/training/gt_image_2/image_224 (3).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (30).png or kitti_road/data_road_224/training/gt_image_2/image_224 (30).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (31).png or kitti_road/data_road_224/training/gt_image_2/image_224 (31).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (32).png or kitti_road/data_road_224/training/gt_image_2/image_224 (32).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (33).png or kitti_road/data_road_224/training/gt_image_2/image_224 (33).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (34).png or kitti_road/data_road_224/training/gt_image_2/image_224 (34).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (35).png or kitti_road/data_road_224/training/gt_image_2/image_224 (35).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (36).png or kitti_road/data_road_224/training/gt_image_2/image_224 (36).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (37).png or kitti_road/data_road_224/training/gt_image_2/image_224 (37).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (38).png or kitti_road/data_road_224/training/gt_image_2/image_224 (38).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (39).png or kitti_road/data_road_224/training/gt_image_2/image_224 (39).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (4).png or kitti_road/data_road_224/training/gt_image_2/image_224 (4).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (40).png or kitti_road/data_road_224/training/gt_image_2/image_224 (40).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (41).png or kitti_road/data_road_224/training/gt_image_2/image_224 (41).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (42).png or kitti_road/data_road_224/training/gt_image_2/image_224 (42).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (43).png or kitti_road/data_road_224/training/gt_image_2/image_224 (43).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (44).png or kitti_road/data_road_224/training/gt_image_2/image_224 (44).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (45).png or kitti_road/data_road_224/training/gt_image_2/image_224 (45).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (46).png or kitti_road/data_road_224/training/gt_image_2/image_224 (46).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (47).png or kitti_road/data_road_224/training/gt_image_2/image_224 (47).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (48).png or kitti_road/data_road_224/training/gt_image_2/image_224 (48).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (49).png or kitti_road/data_road_224/training/gt_image_2/image_224 (49).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (5).png or kitti_road/data_road_224/training/gt_image_2/image_224 (5).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (50).png or kitti_road/data_road_224/training/gt_image_2/image_224 (50).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (51).png or kitti_road/data_road_224/training/gt_image_2/image_224 (51).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (52).png or kitti_road/data_road_224/training/gt_image_2/image_224 (52).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (53).png or kitti_road/data_road_224/training/gt_image_2/image_224 (53).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (54).png or kitti_road/data_road_224/training/gt_image_2/image_224 (54).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (55).png or kitti_road/data_road_224/training/gt_image_2/image_224 (55).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (56).png or kitti_road/data_road_224/training/gt_image_2/image_224 (56).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (57).png or kitti_road/data_road_224/training/gt_image_2/image_224 (57).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (58).png or kitti_road/data_road_224/training/gt_image_2/image_224 (58).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (59).png or kitti_road/data_road_224/training/gt_image_2/image_224 (59).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (6).png or kitti_road/data_road_224/training/gt_image_2/image_224 (6).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (60).png or kitti_road/data_road_224/training/gt_image_2/image_224 (60).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (61).png or kitti_road/data_road_224/training/gt_image_2/image_224 (61).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (62).png or kitti_road/data_road_224/training/gt_image_2/image_224 (62).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (63).png or kitti_road/data_road_224/training/gt_image_2/image_224 (63).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (64).png or kitti_road/data_road_224/training/gt_image_2/image_224 (64).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (65).png or kitti_road/data_road_224/training/gt_image_2/image_224 (65).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (66).png or kitti_road/data_road_224/training/gt_image_2/image_224 (66).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (67).png or kitti_road/data_road_224/training/gt_image_2/image_224 (67).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (68).png or kitti_road/data_road_224/training/gt_image_2/image_224 (68).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (69).png or kitti_road/data_road_224/training/gt_image_2/image_224 (69).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (7).png or kitti_road/data_road_224/training/gt_image_2/image_224 (7).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (70).png or kitti_road/data_road_224/training/gt_image_2/image_224 (70).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (71).png or kitti_road/data_road_224/training/gt_image_2/image_224 (71).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (72).png or kitti_road/data_road_224/training/gt_image_2/image_224 (72).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (73).png or kitti_road/data_road_224/training/gt_image_2/image_224 (73).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (74).png or kitti_road/data_road_224/training/gt_image_2/image_224 (74).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (75).png or kitti_road/data_road_224/training/gt_image_2/image_224 (75).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (76).png or kitti_road/data_road_224/training/gt_image_2/image_224 (76).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (77).png or kitti_road/data_road_224/training/gt_image_2/image_224 (77).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (78).png or kitti_road/data_road_224/training/gt_image_2/image_224 (78).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (79).png or kitti_road/data_road_224/training/gt_image_2/image_224 (79).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (8).png or kitti_road/data_road_224/training/gt_image_2/image_224 (8).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (80).png or kitti_road/data_road_224/training/gt_image_2/image_224 (80).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (81).png or kitti_road/data_road_224/training/gt_image_2/image_224 (81).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (82).png or kitti_road/data_road_224/training/gt_image_2/image_224 (82).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (83).png or kitti_road/data_road_224/training/gt_image_2/image_224 (83).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (84).png or kitti_road/data_road_224/training/gt_image_2/image_224 (84).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (85).png or kitti_road/data_road_224/training/gt_image_2/image_224 (85).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (86).png or kitti_road/data_road_224/training/gt_image_2/image_224 (86).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (87).png or kitti_road/data_road_224/training/gt_image_2/image_224 (87).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (88).png or kitti_road/data_road_224/training/gt_image_2/image_224 (88).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (89).png or kitti_road/data_road_224/training/gt_image_2/image_224 (89).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (9).png or kitti_road/data_road_224/training/gt_image_2/image_224 (9).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (90).png or kitti_road/data_road_224/training/gt_image_2/image_224 (90).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (91).png or kitti_road/data_road_224/training/gt_image_2/image_224 (91).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (92).png or kitti_road/data_road_224/training/gt_image_2/image_224 (92).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (93).png or kitti_road/data_road_224/training/gt_image_2/image_224 (93).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (94).png or kitti_road/data_road_224/training/gt_image_2/image_224 (94).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (95).png or kitti_road/data_road_224/training/gt_image_2/image_224 (95).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (96).png or kitti_road/data_road_224/training/gt_image_2/image_224 (96).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (97).png or kitti_road/data_road_224/training/gt_image_2/image_224 (97).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (98).png or kitti_road/data_road_224/training/gt_image_2/image_224 (98).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (99).png or kitti_road/data_road_224/training/gt_image_2/image_224 (99).png
Loaded 0 images and 0 masks
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-11-5d520393717c> in <cell line: 128>()
126
127 # Split the dataset into training and validation sets
–> 128 train_images, val_images, train_masks, val_masks = train_test_split(train_images, train_masks, test_size=0.2, random_state=42)
129
130 # Check sizes of the datasets

1 frames
/usr/local/lib/python3.10/dist-packages/sklearn/model_selection/_split.py in _validate_shuffle_split(n_samples, test_size, train_size, default_test_size)
2234
2235 if n_train == 0:
-> 2236 raise ValueError(
2237 "With n_samples={}, test_size={} and train_size={}, the "
2238 "resulting train set will be empty. Adjust any of the "

ValueError: With n_samples=0, test_size=0.2 and train_size=None, the resulting train set will be empty. Adjust any of the aforementioned parameters.
I understand the issue you’re facing with the missing files. It seems the problem lies in how the file names in image_2 and gt_image_2 don’t align as expected. Let’s address this by carefully ensuring that the filenames in both directories match appropriately.

From the structure you provided, it seems the naming convention between the images and their masks might be straightforward to map. We can perform a few checks and ensure that the mask file names match correctly.

Let’s fix this in a more comprehensive manner:

1. Ensure that the file names in gt_image_2 align with image_2.
2. Load the images and masks accordingly.
3. Properly print debug info to ensure we load files appropriately.

Here’s the revised script:

# 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’] = ‘your_kaggle_username’
os.environ[‘KAGGLE_KEY’] = ‘your_kaggle_key’

# 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()

# Prepare the dataset
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.basename(f): f for f in sorted(os.listdir(mask_dir))}

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

    # Attempt to load each image and its corresponding mask
    for img_file in image_files:
        img_path = os.path.join(image_dir, img_file)
        
        # Find corresponding mask file
        mask_file_name = img_file # default: exact filename match
        mask_path = os.path.join(mask_dir, mask_file_name)

        if mask_file_name in mask_files:
            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 {mask_path}”)

    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 = ‘kitti_road/data_road_224/training/image_2’
train_mask_dir = ‘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
print(f"Loaded {len(train_images)} images and {len(train_masks)} masks")

# Split the dataset into training and validation sets
if len(train_images) == 0 or len(train_masks) == 0:
    print(“No images or masks were loaded. Please check the dataset paths and file names.”)
else:
    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)

######################################################################
# 2. 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)
        for sigma in sigma_list:
            msr += retinex_ssr(img, sigma)
        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

######################################################################
# 3. Upload and Process the Image
######################################################################

# Upload 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()


### Key Changes:

1. Simplified Loading Logic: We now strictly ensure filenames match exactly. Make sure your mask filenames match your image filenames.
2. Print Debug Messages: To help you spot any mismatches or missing files.
3. Error Check for Empty Dataset: Added error checks in case no images or masks were loaded.

Ensure that your filenames in both image_2 and gt_image_2 directories match exactly. If they don’t, you may need to rename the files so that they align correctly.
please think step by step carefully and fix this at one go
Missing file: kitti_road/data_road_224/training/image_2/image_224 (63).png or kitti_road/data_road_224/training/gt_image_2/image_224 (63).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (64).png or kitti_road/data_road_224/training/gt_image_2/image_224 (64).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (65).png or kitti_road/data_road_224/training/gt_image_2/image_224 (65).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (66).png or kitti_road/data_road_224/training/gt_image_2/image_224 (66).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (67).png or kitti_road/data_road_224/training/gt_image_2/image_224 (67).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (68).png or kitti_road/data_road_224/training/gt_image_2/image_224 (68).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (69).png or kitti_road/data_road_224/training/gt_image_2/image_224 (69).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (7).png or kitti_road/data_road_224/training/gt_image_2/image_224 (7).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (70).png or kitti_road/data_road_224/training/gt_image_2/image_224 (70).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (71).png or kitti_road/data_road_224/training/gt_image_2/image_224 (71).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (72).png or kitti_road/data_road_224/training/gt_image_2/image_224 (72).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (73).png or kitti_road/data_road_224/training/gt_image_2/image_224 (73).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (74).png or kitti_road/data_road_224/training/gt_image_2/image_224 (74).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (75).png or kitti_road/data_road_224/training/gt_image_2/image_224 (75).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (76).png or kitti_road/data_road_224/training/gt_image_2/image_224 (76).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (77).png or kitti_road/data_road_224/training/gt_image_2/image_224 (77).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (78).png or kitti_road/data_road_224/training/gt_image_2/image_224 (78).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (79).png or kitti_road/data_road_224/training/gt_image_2/image_224 (79).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (8).png or kitti_road/data_road_224/training/gt_image_2/image_224 (8).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (80).png or kitti_road/data_road_224/training/gt_image_2/image_224 (80).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (81).png or kitti_road/data_road_224/training/gt_image_2/image_224 (81).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (82).png or kitti_road/data_road_224/training/gt_image_2/image_224 (82).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (83).png or kitti_road/data_road_224/training/gt_image_2/image_224 (83).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (84).png or kitti_road/data_road_224/training/gt_image_2/image_224 (84).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (85).png or kitti_road/data_road_224/training/gt_image_2/image_224 (85).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (86).png or kitti_road/data_road_224/training/gt_image_2/image_224 (86).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (87).png or kitti_road/data_road_224/training/gt_image_2/image_224 (87).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (88).png or kitti_road/data_road_224/training/gt_image_2/image_224 (88).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (89).png or kitti_road/data_road_224/training/gt_image_2/image_224 (89).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (9).png or kitti_road/data_road_224/training/gt_image_2/image_224 (9).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (90).png or kitti_road/data_road_224/training/gt_image_2/image_224 (90).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (91).png or kitti_road/data_road_224/training/gt_image_2/image_224 (91).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (92).png or kitti_road/data_road_224/training/gt_image_2/image_224 (92).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (93).png or kitti_road/data_road_224/training/gt_image_2/image_224 (93).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (94).png or kitti_road/data_road_224/training/gt_image_2/image_224 (94).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (95).png or kitti_road/data_road_224/training/gt_image_2/image_224 (95).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (96).png or kitti_road/data_road_224/training/gt_image_2/image_224 (96).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (97).png or kitti_road/data_road_224/training/gt_image_2/image_224 (97).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (98).png or kitti_road/data_road_224/training/gt_image_2/image_224 (98).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (99).png or kitti_road/data_road_224/training/gt_image_2/image_224 (99).png
Loaded 0 images and 0 masks
No images or masks were loaded. Please check the dataset paths and file names.
th (1).jpg
th (1).jpg(image/jpeg) - 3856 bytes, last modified: 6/9/2024 - 100% done
Saving th (1).jpg to th (1).jpg
---------------------------------------------------------------------------
UFuncTypeError Traceback (most recent call last)
<ipython-input-12-951bc8542f7d> in <cell line: 204>()
202
203 # Dehaze the image
–> 204 dehazed_image = dehaze_image(image)
205
206 # Segment the road in the dehazed image

1 frames
<ipython-input-12-951bc8542f7d> in retinex_msr(img, sigma_list)
154 msr = np.zeros_like(img)
155 for sigma in sigma_list:
–> 156 msr += retinex_ssr(img, sigma)
157 msr = msr / len(sigma_list)
158 return msr

UFuncTypeError: Cannot cast ufunc ‘add’ output from dtype(‘float32’) to dtype(‘uint8’) with casting rule ‘same_kind’
I understand that we need to be thorough to ensure that the script works correctly. Let’s address the two main issues step-by-step:

1. Loading the Dataset: Ensure that the image and mask filenames align correctly.
2. Dehaze Image Function Error: Fix the UFuncTypeError related to typecasting during the processing of the image.

### 1. Fixing the Dataset Loading Issue

Let’s modify the filenames to ensure that they align correctly. We’ll check if there’s any pattern or assumption we can follow to map the image filenames to the appropriate mask filenames correctly.

### Script to Load Matching Files:

1. First, we list all the files in both image_2 and gt_image_2 directories.
2. Match them based on the common naming pattern.
3. Handle the exceptions properly and ensure we load all the matched files.

### 2. Fixing the Dehaze Image Function Error

Let’s also ensure that the dtype issues in the dehaze_image function are handled correctly.

Here’s the updated script with these changes:

# 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’] = ‘your_kaggle_username’
os.environ[‘KAGGLE_KEY’] = ‘your_kaggle_key’

# 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()

# Prepare the dataset
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.basename(f): f for f in sorted(os.listdir(mask_dir))}

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

    # Attempt to load each image and its corresponding mask
    for img_file in image_files:
        img_path = os.path.join(image_dir, img_file)
        
        # Directly match the filenames
        mask_file_name = img_file
        mask_path = os.path.join(mask_dir, mask_file_name)

        if mask_file_name in mask_files:
            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 {mask_path}”)

    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 = ‘kitti_road/data_road_224/training/image_2’
train_mask_dir = ‘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
print(f"Loaded {len(train_images)} images and {len(train_masks)} masks")

# Split the dataset into training and validation sets
if len(train_images) == 0 or len(train_masks) == 0:
    print(“No images or masks were loaded. Please check the dataset paths and file names.”)
else:
    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)

######################################################################
# 2. 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

######################################################################
# 3. Upload and Process the Image
######################################################################

# Upload 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()


### Key Changes:
1. File Matching: Directly matching filenames from image_2 and gt_image_2 directories assuming filenames are identical and exist in both directories.
2. Debugging Messages: Included messages to assist debugging missing files.
3. Dtype Issue in dehaze_image Function: Ensured that additions in retinex_msr are performed in float32 format to avoid casting issues.

Please ensure that the filenames in your dataset’s image_2 and gt_image_2 directories match exactly. If they do not, you will need to rename the files or adjust the script to match the filenames accordingly. This revised script should handle the dataset appropriately and avoid the dtype error in the dehazing function.
i_road/data_road_224/training/image_2/image_224 (77).png or kitti_road/data_road_224/training/gt_image_2/image_224 (77).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (78).png or kitti_road/data_road_224/training/gt_image_2/image_224 (78).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (79).png or kitti_road/data_road_224/training/gt_image_2/image_224 (79).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (8).png or kitti_road/data_road_224/training/gt_image_2/image_224 (8).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (80).png or kitti_road/data_road_224/training/gt_image_2/image_224 (80).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (81).png or kitti_road/data_road_224/training/gt_image_2/image_224 (81).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (82).png or kitti_road/data_road_224/training/gt_image_2/image_224 (82).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (83).png or kitti_road/data_road_224/training/gt_image_2/image_224 (83).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (84).png or kitti_road/data_road_224/training/gt_image_2/image_224 (84).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (85).png or kitti_road/data_road_224/training/gt_image_2/image_224 (85).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (86).png or kitti_road/data_road_224/training/gt_image_2/image_224 (86).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (87).png or kitti_road/data_road_224/training/gt_image_2/image_224 (87).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (88).png or kitti_road/data_road_224/training/gt_image_2/image_224 (88).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (89).png or kitti_road/data_road_224/training/gt_image_2/image_224 (89).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (9).png or kitti_road/data_road_224/training/gt_image_2/image_224 (9).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (90).png or kitti_road/data_road_224/training/gt_image_2/image_224 (90).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (91).png or kitti_road/data_road_224/training/gt_image_2/image_224 (91).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (92).png or kitti_road/data_road_224/training/gt_image_2/image_224 (92).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (93).png or kitti_road/data_road_224/training/gt_image_2/image_224 (93).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (94).png or kitti_road/data_road_224/training/gt_image_2/image_224 (94).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (95).png or kitti_road/data_road_224/training/gt_image_2/image_224 (95).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (96).png or kitti_road/data_road_224/training/gt_image_2/image_224 (96).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (97).png or kitti_road/data_road_224/training/gt_image_2/image_224 (97).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (98).png or kitti_road/data_road_224/training/gt_image_2/image_224 (98).png
Missing file: kitti_road/data_road_224/training/image_2/image_224 (99).png or kitti_road/data_road_224/training/gt_image_2/image_224 (99).png
Loaded 0 images and 0 masks
No images or masks were loaded. Please check the dataset paths and file names.




what happend to you i just asked a code where the hazy road is dehazed using an algorithm then the image is passed to u net which highlights whole road part of the image as semantic segmentation via unet its such a simple program i gave you whole directory strufcture still why are you? plz think step by step and conclude this one last time
I apologize for the confusion and the inconvenience caused. Let’s take a step-by-step approach to resolve this issue.

### Step-by-Step Approach to Fix the Code

1. Check Directory Structure and Filenames: Ensure that the image filenames and mask filenames match.
2. Load Data Properly: Ensure that images and masks are loaded correctly.
3. Dehaze Image Function: Fix any issues in the dehazing function.
4. Segmentation and Highlighting: Ensure that the U-Net model is trained and used for segmentation correctly.

### 1. Check Directory Structure and Filenames

Given the directory structure, let’s ensure that the image and mask filenames are correctly aligned. We will list the files in both directories and ensure they match.

### 2. Load Data Properly

We will load the data by matching the filenames directly.

### 3. Dehaze Image Function

Ensure that the dehazing function works correctly without dtype issues.

### 4. Segmentation and Highlighting

Ensure the U-Net model is trained and used for segmentation.

### Final Script

Here is the final script that addresses all these points:

# 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’] = ‘your_kaggle_username’
os.environ[‘KAGGLE_KEY’] = ‘your_kaggle_key’

# 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()

# Prepare the dataset
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.basename(f): f for f in sorted(os.listdir(mask_dir))}

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

    # Attempt to load each image and its corresponding mask
    for img_file in image_files:
        img_path = os.path.join(image_dir, img_file)
        
        # Directly match the filenames
        mask_file_name = img_file
        mask_path = os.path.join(mask_dir, mask_file_name)

        if mask_file_name in mask_files:
            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 {mask_path}”)

    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 = 'kitti_road/data_road_224/training/image
continue