Python (sendex人脸识别)cv2中的照片整形问题。将用作人脸识别的输入
我正在跟踪sentdex人脸识别。我正在使用我自己的图片来训练尺寸非常大的模型,因此我在Python (sendex人脸识别)cv2中的照片整形问题。将用作人脸识别的输入,python,opencv,face-recognition,cv2,Python,Opencv,Face Recognition,Cv2,我正在跟踪sentdex人脸识别。我正在使用我自己的图片来训练尺寸非常大的模型,因此我在cv2.reformate()的帮助下将图片的大小更改为256x256。以下是我用于调整大小的代码。我做了10次,拍了10张照片,你可以利用这个循环 import cv2 #paste the path where you have face recognition file #for me it is '/home/Desktop/ml/face_reco' path = str(input("paste
cv2.reformate()
的帮助下将图片的大小更改为256x256。以下是我用于调整大小的代码。我做了10次,拍了10张照片,你可以利用这个循环
import cv2
#paste the path where you have face recognition file
#for me it is '/home/Desktop/ml/face_reco'
path = str(input("paste you file path here: "))
IMG_SIZE = 256
# convert to array
img_array = cv2.imread(path)
new_array = cv2.resize(img_array, (IMG_SIZE, IMG_SIZE))
#save the resized pic with some new name
cv2.imwrite('/home/Desktop/ml/face_reco/known_faces/vardhan/new.png',new_array)
当我使用这些新调整大小的图片作为模型的输入时,它会引发一个错误列表索引超出范围
,因为sentdex第38行的编码
数组是空的,我不知道为什么新图片的编码数组是空的,而原始图片的编码数组不是空的