retrieving an error while accessing files from the folder

You’re iterating over a string, so it will only get the first character. You need to list the contents of the directory. Use os.listdir like this.

import os
filename = 'C:/Users/test_image'
files = os.listdir(filename)
for file in files:
    orig = cv2.imread(file)
    image = image_utils.load_img(file, target_size=(224,224))
    image = image_utils.img_to_array(image)

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top