简体   繁体   English

image_dataset_from_directory() 如何对数字类名的预测进行排序?

[英]How does image_dataset_from_directory() order the predictions of a numerical class name?

Does image_dataset_from_directory() order the class names as specified by me ie, [0,10,5] or is it sorted alphanumerically? image_dataset_from_directory() 是否按照我指定的方式对类名进行排序,即 [0,10,5] 还是按字母数字排序?

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,
)

If will follow the order specified in class_names argument. If 将遵循class_names参数中指定的顺序。

If you don't specify anything the order will be according to alphanumeric sorting.如果您未指定任何内容,则顺序将根据字母数字排序。

The exact statement from Tensorflow Documentation for argument class_names : Tensorflow 文档中关于参数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请参阅此处的文档

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 是否可以从 image_dataset_from_directory 获取图像名称? - is it possible to get image name from image_dataset_from_directory? Keras 方法 image_dataset_from_directory() 如何区分 X 和 Y 数据? - How does the Keras method image_dataset_from_directory() distinguish X and Y data? 如何将 keras image_dataset_from_directory 与自定义结构一起使用? - How to use keras image_dataset_from_directory with custom structures? image_dataset_from_directory 用于多标签分类 - image_dataset_from_directory for multilabel classifcation Tensorflow image_dataset_from_directory 用于输入数据集和 output 数据集 - Tensorflow image_dataset_from_directory for input dataset and output dataset 从 image_dataset_from_directory function 生成的数据集不包括 batch size - Dataset generated from image_dataset_from_directory function does not include batch size 如何将从 image_dataset_from_directory 获得的数据集拆分为数据和标签? - How can I split the dataset obtained from image_dataset_from_directory into data and labels? 导入错误:无法从“tensorflow.keras.preprocessing”(未知位置)导入名称“image_dataset_from_directory” - ImportError: cannot import name 'image_dataset_from_directory' from 'tensorflow.keras.preprocessing' (unknown location) image_dataset_from_directory label 列表似乎是按随机顺序分配的 - image_dataset_from_directory label list appear to be assigned in a random order 如何在专辑 label 中调整数据集 label 的大小以使用 tensorflow image_dataset_from_directory ZC1C425268E687A945D - How resize dataset label in albumentations label to work with tensorflow image_dataset_from_directory function?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM