Reputation: 6829
Does image_dataset_from_directory() order the class names as specified by me i.e., [0,10,5] or is it sorted alphanumerically?
I am asking because when I use the model to make predictions I want to be sure that the order I set is followed or not.
train_dataset = image_dataset_from_directory(
directory=TRAIN_DIR,
labels="inferred",
label_mode="categorical",
class_names=["0", "10", "5"],
image_size=SIZE,
seed=SEED,
subset=None,
interpolation="bilinear",
follow_links=False,
)
Upvotes: 0
Views: 2153
Reputation: 3574
If will follow the order specified in class_names
argument.
If you don't specify anything the order will be according to alphanumeric sorting.
The exact statement from Tensorflow Documentation for argument class_names
:
Only valid if "labels" is "inferred". This is the explict list of class names (must match names of subdirectories). Used to control the order of the classes (otherwise alphanumerical order is used).
See the documentation here
Upvotes: 1