TypeError: must be str, not numpy.int64

TypeError: must be str, not numpy.int64

这应该有效,因为我已经看到它在其他人身上有效,但这对我不起作用。我正在做一个 test/train 模型并尝试训练图像

这就是我尝试过的所有内容。数据保存在 google 驱动器

train_image = []
for i in tqdm(range(train.shape[0])):
    img = image.load_img('/content/drive/My Drive/Colab Notebooks/data/train/'+train['file_id'][i], target_size=(128,173,1), color_mode='grayscale')
    img = image.img_to_array(img)
    img = img/255
    train_image.append(img)
x_train = np.array(train_image)

      0%|          | 0/5377 [00:00<?, ?it/s]
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-5-ef9f3fb90a16> in <module>()
      1 train_image = []
      2 for i in tqdm(range(train.shape[0])):
----> 3     img = image.load_img('/content/drive/My Drive/Colab Notebooks/data/train/'+train['file_id'][i], target_size=(128,173,1), color_mode='grayscale')
      4     img = image.img_to_array(img)
      5     img = img/255

TypeError: must be str, not numpy.int64

检查load_img和img_to_array传入的参数是否正确。我的代码有同样的错误。这是因为我正在调用一个方法来获取用于创建返回字符(输入错误)并影响它的路径的特定参数。