【发布时间】:2020-12-28 14:41:01
【问题描述】:
这是我在 google colab 上写的代码。但是,执行后却报错。 代码:
img_width =500
img_height = 500
X=[]
for i in tqdm(range(data.shape[0])):
path= '/content/drive/My Drive/DData/img' + data['id'][i] + '.png'
img= image.load_img(path, target_size=(img_width, img_height, 3))
img = image.img_to_array(img)
img = img/255.0
X.append(img)
X= np.array(X)
这是错误:
Error:
TypeError Traceback (most recent call last)
<ipython-input-81-1aa91a1867f4> in <module>()
3 X=[]
4 for i in tqdm(range(data.shape[0])):
----> 5 path= '/content/drive/My Drive/DData/img' + data['id'][i] + '.png'
6 img= image.load_img(path, target_size=(img_width, img_height, 3))
7 img = image.img_to_array(img)
TypeError: must be str, not numpy.int64**
【问题讨论】:
-
data['id'][i]的内容是什么?
标签: python google-colaboratory tensorflow2.0