简体   繁体   中英

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}")

I'm trying to run this code on google colab and it shows this error 'NoneType' object has no attribute 'shape'

changed the path, adding for loop

Probably path is not valid. Check the output of print('/content/drive/MyDrive/dataset/images/'+annotations_bbox['image_path'][index]) and in colab go to an image file, and copy path. Make sure they are the same. If not, fix it

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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