0
votes

I have written [Code]: I have written this import cv2 import numpy as np from os import listdir from os.path import isfile, join

data_path = 'D:/ALL_PYTHON/Face Recog/image'
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("Modal Training Completed!!")

And the out is showing:

Traceback (most recent call last):
  File "d:\ALL_PYTHON\Face Recog\Facial_Recognisation_part_2.py", line 14, in <module>
    Training_Data.append(np.asarray(images, dtype=np.uint8))
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

Anyone, please solve it...