首页 > 解决方案 > 嗨,我想遍历 numpy 数组以仅显示 2656 个图像中的 100 个图像

问题描述

这是我的数组形状打印 (img_array.shape) (2656, 256, 256, 3)

这就是我打印单个图像的方式

from matplotlib import pyplot as plt

from google.colab.patches import cv2_imshow
img3 = img_array[2655,:,:,:]
cv2_imshow(img3)

我想提前打印 100 份谢谢

标签: python-3.xnumpymachine-learningcomputer-vision

解决方案


对于前 100 张图像

img3 = img_array[0:99]

但它产生错误 TypeError: Cannot handle this data type: (1, 1, 256, 3), |u1


推荐阅读