Для этого кода
import cv2
import numpy as np
from os import listdir
from os.path import isfile, join
data_path = 'dataset/'
onlyfiles = [f for f in listdir(data_path) if isfile(join(data_path,f))]
Training_Data, Labels = [], []
for i, files in enumerate(onlyfiles):
image_path = data_path + onlyfiles[i]
images = cv2.imread(image_path, cv2.IMREAD_GRAYSCALE)
Training_Data.append(np.asarray(images, dtype=np.uint8))
Labels.append(i)
Labels = np.asarray(Labels, dtype=np.int32)
model = cv2.face.LBPHFaceRecognizer_create()
model.train(np.asarray(Training_Data), np.asarray(Labels))
print("Model Training Completed!!!!!")
Я получаю эту ошибку
/usr/local/bin/python3.7 "/Users/mac/Google Drive/Read&Write2Database/knowledgeShelfPart-2.py"
Traceback (most recent call last):
File "/Users/mac/Google Drive/Read&Write2Database/knowledgeShelfPart-2.py", line 14, in <module>
Training_Data.append(np.asarray(images, dtype=np.uint8))
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/core/numeric.py", line 492, in asarray
return array(a, dtype, copy=False, order=order)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'