find that are not images in the entire images folder.
import matplotlib.image as mpimg images = [] folder = './your/folder/' for filename in os.listdir(folder): try: img = mpimg.imread(os.path.join(folder, filename)) if img is not None: images.append(img) except: print('Cant import ' + filename) images = np.asarray(images)
Source: stackoverflow.com