image_data = []
for index in range(len(annotations_bbox[:10])):
img = cv2.imread('/content/drive/MyDrive/dataset/images/'+annotations_bbox['image_path'][index])
image_data.append(img)
height, width, channel = img.shape
print(f"Image: {img.shape}")
我试图在google colab上运行这个代码,它显示了这个错误"NoneType"对象没有属性"shape">
更改了路径,添加了for循环
可能路径无效。检查print('/content/drive/MyDrive/dataset/images/'+annotations_bbox['image_path'][index])
和colab的输出到一个镜像文件,并拷贝路径。确保它们是相同的。如果没有,修复它