Loading Unlabeled Images with ImageDataGenerator flow_from_directory in Keras

wonderful world·2021년 9월 2일
0

https://kylewbanks.com/blog/loading-unlabeled-images-with-imagedatagenerator-flowfromdirectory-keras

from tensorflow.keras.preprocessing.image import ImageDataGenerator, load_img, img_to_array

datagen = ImageDataGenerator()
# In ./dataset directory, there is `test` directory.
test_data = datagen.flow_from_directory('./dataset', classes=['test'])
Found 1000 images belonging to 1 class.

The classes argument tells flow_from_directory that you only want to load images of the specified class(es), in this case the test “class”. Now test_data will contain only the one test “class”, allowing you to work with your test dataset just as you would the labeled training data from above.

profile
hello wirld

0개의 댓글