Clipping input data to the valid range for imshow with RGB data ([0..1] for floats or [0..255]
❓报错原因
plt.imshow(images)
✨解决办法
plt.imshow(images.astype(np.uint8))
🧵解释
matplotlib.pyplot.imshow( ) 函数在处理灰度图像时,自动将其值做归一化处理
而在处理彩色图像时则不会,而是将浮点值变换至
[0,1]
,整数值变换到[0, 255]
范围