CNN 中的预测结果
Result of a prediction in CNN
我正在研究以下内容link
https://becominghuman.ai/building-an-image-classifier-using-deep-learning-in-python-totally-from-a-beginners-perspective-be8dbaf22dd8
我怎么知道“result[0][0]”中的“one”预测的是“狗”而不是猫?
文章中的代码使用 ImageDataGenerator
class 和 flow_from_directory()
函数来加载和扩充图像。检查 Keras documentation 您可以找到有关名为 classes
:
的参数之一的信息
Optional list of class subdirectories (e.g. ['dogs', 'cats']).
Default: None. If not provided, the list of classes will be
automatically inferred from the subdirectory names/structure under
directory, where each subdirectory will be treated as a different
class (and the order of the classes, which will map to the label
indices, will be alphanumeric). The dictionary containing the mapping
from class names to class indices can be obtained via the attribute
class_indices.
根据这些信息,我怀疑 'cat' 指的是 0 而 'dog' 指的是 1。为了确保您可以检查 class 字典:
print(train_datagen.class_indices)
我正在研究以下内容link https://becominghuman.ai/building-an-image-classifier-using-deep-learning-in-python-totally-from-a-beginners-perspective-be8dbaf22dd8 我怎么知道“result[0][0]”中的“one”预测的是“狗”而不是猫?
文章中的代码使用 ImageDataGenerator
class 和 flow_from_directory()
函数来加载和扩充图像。检查 Keras documentation 您可以找到有关名为 classes
:
Optional list of class subdirectories (e.g. ['dogs', 'cats']). Default: None. If not provided, the list of classes will be automatically inferred from the subdirectory names/structure under directory, where each subdirectory will be treated as a different class (and the order of the classes, which will map to the label indices, will be alphanumeric). The dictionary containing the mapping from class names to class indices can be obtained via the attribute class_indices.
根据这些信息,我怀疑 'cat' 指的是 0 而 'dog' 指的是 1。为了确保您可以检查 class 字典:
print(train_datagen.class_indices)