如何解决Python返回'UFuncTypeError:ufunc'add'不包含循环
我正在研究图像的深度学习。 运行此代码时出现此错误:
from PIL import Image
using_image_num = 10000
batch_num = 2
for category in classes:
for j in range(using_image_num):
img = category[j,:j+784].reshape(1,28,1)
batch = 0
flow = datagen.flow(img,batch_size = 1,save_to_dir = saved_location,save_prefix = 'augmented_' + classes[i],save_format='png')
for augmenting_batch in flow:
batch += 1
if batch > batch_num:
break
print("augmented " + category + " is saved.")
错误看起来像:
UFuncTypeError Traceback (most recent call last)
<ipython-input-42-e9dd2f490a52> in <module>
15 img = category[j,1)
16 batch = 0
---> 17 flow = datagen.flow(img,save_format='png')
18 for augmenting_batch in flow:
19 batch += 1
UFuncTypeError: ufunc 'add' did not contain a loop with signature matching types (dtype('<U10'),dtype('<U10')) -> dtype('<U10')
当我在colab中运行此代码时,它会很好地返回结果。
我不知道为什么这在Jupyter笔记本电脑上不起作用。我在AWS ec2服务器上操作了此代码。 起初,我认为colab和jupyter的工作原理类似,但结果却不一样。 我发现U10表示unicode ....但是我陷入了这个问题,没有任何解决方案。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。