我无法规范我的数据以应用PCA

时间:2019-08-27 17:33:33

标签: python pandas image normalization series

我正在对4900张图像进行归一化处理。它在上半部分似乎工作正常,但是在下半部分尝试时会出现以下错误:

faces = []
for item in glob.iglob('/content/drive/My Drive/KDEF/B***/*.JPG'):
  img= io.imread(item, as_gray = True)
  image_rescaled = rescale(img, 0.25, anti_aliasing=False)
  face = pd.Series(image_rescaled.flatten(),name=item)
  faces.append(face)

face_norm = normalize(faces)

ValueError                                Traceback (most recent call last)
<ipython-input-47-8d0cf136c5a0> in <module>()
----> 1 face_norm = normalize(faces)

2 frames
/usr/local/lib/python3.6/dist-packages/sklearn/preprocessing/data.py in normalize(X, norm, axis, copy, return_norm)
   1612 
   1613     X = check_array(X, sparse_format, copy=copy,
-> 1614                     estimator='the normalize function', 
dtype=FLOAT_DTYPES)
   1615     if axis == 0:
   1616         X = X.T

/usr/local/lib/python3.6/dist-packages/sklearn/utils/validation.py in check_array(array, accept_sparse, accept_large_sparse, dtype, order, copy, force_all_finite, ensure_2d, allow_nd, ensure_min_samples, ensure_min_features, warn_on_dtype, estimator)
    494             try:
    495                 warnings.simplefilter('error', ComplexWarning)
--> 496                 array = np.asarray(array, dtype=dtype, order=order)
    497             except ComplexWarning:
    498                 raise ValueError("Complex data not supported\n"

/usr/local/lib/python3.6/dist-packages/numpy/core/numeric.py in asarray(a, dtype, order)
    536 
    537     """
--> 538     return array(a, dtype, copy=False, order=order)
    539 
    540 

ValueError: setting an array element with a sequence.

0 个答案:

没有答案