I’ve downloaded the Malaria dataset from kaggle and I have two folders of images, one parasitized cells and the other normal cells. How do I go about loading all these images into an array?
I could do a for loop but I don’t know the command to get the number of image files in a folder. The file names aren’t consistent either.
You could obtain all the files and directories: readdir(dir_path).
Then check if an element is a file or a directory: isfile(file_path).
Then for each element, you could check for the file extension: endswith(file_name, suffix).
instead-- you want to pass the function isfile to filter, whereas in your version, you’re calling isfile (with no arguments), and then passing the result to filter.