tensorflow2.6报错
Error occurred when finalizing GeneratorDataset iterator: Failed precondition: Python interpreter state is not initialized. The process may be terminated.
[[{{node PyFunc}}]]
训练集分类模式为categorical
train_generator = train_datagen.flow_from_directory(
train_dir,
target_size=(pic_height,pic_width),
batch_size=32,
class_mode='categorical',
subset='training',
shuffle=True,
)
之后编译模型时损失函数是sparse_categorical_crossentropy,是分类模式sparse使用的
改成categorical_crossentropy