ValueError: X.shape [1] = 128 должен быть равен 512, количество функций во время обучения - PullRequest
0 голосов
/ 12 ноября 2018

В настоящее время я работаю над распознаванием лиц, и у меня возникла следующая проблема с данным кодом.

for i in range(nrof_faces):
    emb_array = np.zeros((1, embedding_size))

    bb[i][0] = det[i][0]
    bb[i][1] = det[i][1]    
    bb[i][2] = det[i][2]
    bb[i][3] = det[i][3]

    # inner exception
    if bb[i][0] <= 0 or bb[i][1] <= 0 or bb[i][2] >= len(frame[0]) or bb[i] 
        [3] >= len(frame):
        print('Face is very close!')
        continue

    cropped.append(frame[bb[i][1]:bb[i][3], bb[i][0]:bb[i][2], :])
    cropped[i] = facenet.flip(cropped[i], False)
    scaled.append(misc.imresize(cropped[i], (image_size, image_size), 
             interp='bilinear'))
    scaled[i] = cv2.resize(scaled[i], (input_image_size,input_image_size),
                       interpolation=cv2.INTER_CUBIC)
    scaled[i] = facenet.prewhiten(scaled[i]) 

scaled_reshape.append (масштабируется [I] .reshape (-1, input_image_size, input_image_size, 3))

    feed_dict = {images_placeholder: scaled_reshape[i], phase_train_placeholder: False}
    emb_array[0, :] = sess.run(embeddings, feed_dict=feed_dict)
    predictions = model.predict_proba(emb_array)
    print(predictions)

И это дает мне следующую ошибку:

Traceback (most recent call last):
File "F:\std\programs\python\Camera\Facenet-Real-time-face-recognition-using-deep-learning-Tensorflow\test_video.py", line 107, in <module>
  predictions = model.predict_proba(emb_array)
File "C:\Program Files\Python36\lib\site-packages\sklearn\svm\base.py", line 613, in _predict_proba
  X = self._validate_for_predict(X)
File "C:\Program Files\Python36\lib\site-packages\sklearn\svm\base.py", line 478, in _validate_for_predict
  (n_features, self.shape_fit_[1]))
ValueError: X.shape[1] = 128 should be equal to 512, the number of features at training time
...