在 load_img 中,open(path, 'rb') as f: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
发布时间:2022-06-10 13:50:35 327
相关标签: # node.js
我不知道该怎么办我尝试了所有的方法
with `open(path, encoding="utf8", errors='ignore') as f:`
或with open(your_file_path,'rb') as f: contents = f.read() contents = contents.decode("utf-16")`` and
编码格式为ISO-8859-1。`代码
for (x, y, w, h) in faces:
#cv2.rectangle(frame, (x, y), (x + w, y + h), (255, 0, 0), 5)
faceX = x;
faceY = y;
faceWidth = w;
faceHeight = h;
cv2.rectangle(frame, (x, y), (x+w, y+h), (255, 0, 0), 2)
cv2.imshow("Face recognition", frame)
if cv2.waitKey(1) == ord('s'):
detectedFace = frame[faceY:faceY+faceHeight, faceX:faceX+faceWidth]
model = models.load_model("Face rec.model")
import pickle
with open("ResultsMap.pkl", 'rb') as fileWriteStream:
data=pickle.load(fileWriteStream)
test_image=image.load_img(detectedFace,target_size=(64, 64))
test_image=image.img_to_array(test_image)
test_image=np.expand_dims(test_image,axis=0)
result=model.predict(test_image,verbose=0)
特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报