我正在尝试使用流形学习方法减小尺寸以将 RGB 图像变为灰色。
我已将图像转换为 numpy 数组(image_array)
import numpy as np
from sklearn.datasets import load_sample_image
china = load_sample_image("china.jpg")
# Convert to floats instead of the default 8 bits integer coding. Dividing by
# 255 is important so that plt.imshow behaves works well on float data (need to
# be in the range [0-1]
china = np.arraychina, dtype=np.float64) / 255
# Load Image and transform to a 2D numpy array.
w, h, d = original_shape = tuple(china.shape)
assert d == 3
image_array = np.reshape(china, (w * h, d))
检查 image_array
image_array.shape
(273280, 3)
尝试的时候,
X, color = image_array
我明白了
ValueError:解包的值太多。
有没有办法解决这个问题?