我的单元格没有显示准确性,而是不断收到错误“TypeError:‘ImageDataGenerator’类型的对象没有 len()”
这是我的手机代码:
# evaluate model
_, acc = classifier.evaluate_generator(test_datagen, steps=len(test_datagen), verbose=0)
print('> %.3f' % (acc * 100.0))```
最佳答案
len()
函数在 python 中接受列表或字符串作为参数,而test_datagen
对象是生成器。要准确了解生成器对象的长度,请尝试此
len(list(test_datagen))
关于python - 类型错误 : object of type 'ImageDataGenerator' has no len(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59962329/