我使用flow_from_directory
得到訓練,從一個文件夾設置的結構如下:如何在Keras培訓多個班時獲得標籤ID?
train
class1
class2
class3
...
發電機被稱爲是如下:
train_generator = train_datagen.flow_from_directory(
train_data_dir,
target_size=(img_height, img_width),
batch_size=32,
class_mode='categorical')
我沒有設置參數classes
,但我期望按字母順序獲取標籤。
classes: optional list of class subdirectories (e.g.
['dogs', 'cats']
). Default: None. If not provided, the list of classes will be automatically inferred (and the order of the classes, which will map to the label indices, will be alphanumeric).
但是,當我分類訓練圖像(用於檢查哪些標籤正在返回)時,我沒有得到任何特定的排序。訓練進行得很順利(準確性達到85%),並且在對來自同一班級的圖像進行分類時與輸出標籤保持一致。
如何推斷由flow_from_directory
生成的標籤號碼並將它們映射到類別?
這個問題是固定的一個例子[此拉請求( https://github.com/fchollet/keras/pull/3052)。 –