Error: (-215:Assertion failed) !ssize.empty() in function 'cv::resize'

import matplotlib.pyplot as plt
import numpy as np
import cv2
import os
import PIL
import tensorflow as tf

from tensorflow import keras
from tensorflow.keras import layers
from tensorflow.keras.models import Sequential

dataset_url = “
data_dir = tf.keras.utils.get_file(‘flower_photos’, origin=dataset_url, cache_dir=‘.’, untar = True)

import pathlib
data_dir = pathlib.Path(data_dir)

flowers_images_dict = {
‘roses’: list(data_dir.glob(r’roses/')),
‘daisy’: list(data_dir.glob(r’daisy/
‘dandelion’: list(data_dir.glob(r’dandelion/')),
‘sunflowers’: list(data_dir.glob(r’sunflowers/
‘tulips’: list(data_dir.glob(r’tulips/*')),

flowers_labels_dict = {
‘roses’: 0,
‘daisy’: 1,
‘dandelion’: 2,
‘sunflowers’: 3,
‘tulips’: 4,

X, y = ,

for flower_name, images in flowers_images_dict.items():
for image in images:
img = cv2.imread(str(image))
resized_img = cv2.resize(img,(180,180))

This is what my path looks like

I am able to open the image

please , no further useless screenshots

your image was not read. go and debug it.