先看我的目录结构
我现在能做个最简单的流程,在urls.py写好url,通过此url调用views.py里的一个函数,然后页面输入能显示,但我想写一个业务,需要导入
shape_predictor_68_face_landmarks.dat 文件(以下称为A文件)
我在faceRecognition文件夹里新建了个py文件,导入此文件,居然报错:
代码:
ace_rec_model = dlib.face_recognition_model_v1("C:\\Users\\51530\\Desktop\\openFace\\shape_predictor_68_face_landmarks.dat")
(注:我这个A文件放在faceRecognition文件下了,直接用‘shape_predictor_68_face_landmarks.dat’会提示无法打开此文件,所以上代码我直接指向我这个文件的本地目录了)
报错:
RuntimeError: An error occurred while trying to read the first object from the file C:\Users\51530\Desktop\openFace\shape_predictor_68_face_landmarks.dat.
ERROR: Error deserializing object of type unsigned long
while deserializing object of type std::string
跪求大神指点,第一个用django项目,就是想做个简单的服务跑上去,真是一步一个坑啊。。。
我觉得你用错模型了,A文件应该用shape_predict导入。即ace_rec_model = dlib.shape_predictor('shape_predictor_68_face_landmarks.dat')
我这里是吧你的A文件和你导入A文件的py文件放在同一个文件夹下的写法。
如果要使用face_recognition_model_v1模型,应该导入dlib_face_revognition_resnet_model_v1.dat.
是shape_predictor,,一不小心打错了,不好意思哈