DEV Community

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

Posted on

1

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???

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay