DEV Community

Cover image for Images Dataset is not Loading!!!
JesterRexx-ux
JesterRexx-ux

Posted on

Images Dataset is not Loading!!!

You can see the given code in the image and the error its giving. I am using ubuntu 18.04 and everytime I try to load the dataset from the image folder it shows an error. Guys if you know how to handle this plz help me. This simple problem is wasting my lot of time!!!

Code:
import numpy as np
import matplotlib.pyplot as plt
import os
import cv2
from tqdm import tqdm

DATADIR = "'/home/akshat/Documents/Cats and Dogs/training_set /training_set/IN/Dog'
"

CATEGORIES = ["Dog", "Cat"]

for category in CATEGORIES: # do dogs and cats
path = os.path.join(DATADIR,category) # create path to dogs and cats
for img in os.listdir(path): # iterate over each image per dogs and cats
img_array = cv2.imread(os.path.join(path,img) ,cv2.IMREAD_GRAYSCALE) # convert to array
plt.imshow(img_array, cmap='gray') # graph it
plt.show() # display!

    break  
break  

Error:
FileNotFoundError: [Errno 2] No such file or directory: '/home/akshat/Documents/Cats and Dogs/training_set/training_set/IN/Dog'

OS:Ubuntu 18.04

Tell me what I am doing wrong???

Top comments (0)