Here is a code to obtain all image paths for a folder for your datascience project


import os
    
# define the directory where the images are located      
images_path = "PATH"

img_paths = sorted([os.path.join(images_path, fname) for fname in os.listdir(images_path)
                                      if fname.endswith(".jpeg") and not fname.startswith(".")]) # replace ".jpeg" with the format in which the image file is.
                                      
# img_paths is a list of all image paths in the PATH directory.

Updated:

Leave a comment