问题描述
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 (将#修改为@)