繁体   English   中英

错误:'NoneType' object 没有属性'shape'

[英]ERROR: 'NoneType' object has no attribute 'shape'‏

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”object 没有属性“shape”

更改路径,添加 for 循环

可能路径无效。 检查print('/content/drive/MyDrive/dataset/images/'+annotations_bbox['image_path'][index])的 output 和 colab go 到一个图像文件,并复制路径。 确保它们相同。 如果没有,修复它

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM