Im trying to follow a project using a pretrained caffe model to detect faces but get an error.
CODE
import numpy as np
import os.path
modelFile = “C:/Users/danie/PycharmProjects/FaceTrack/models/res10_300x300_ssd_iter_140000.caffemodel”
configFile = “C:/Users/danie/PycharmProjects/FaceTrack/models/deploy.prototxt”
assert os.path.exists(modelFile)
assert os.path.exists(configFile)
print(os.path.isfile(modelFile))
print(os.path.isfile(configFile))
net = cv2.dnn.readNetFromCaffe(configFile, modelFile)
ERROR
C:\Users\danie\PycharmProjects\FaceTrack\venv\Scripts\python.exe C:/Users/danie/PycharmProjects/FaceTrack/DNN_FACETRACK.py
True
True
[libprotobuf ERROR C:\Users\runneradmin\AppData\Local\Temp\pip-req-build-c2l3r8zm\opencv\3rdparty\protobuf\src\google\protobuf\text_format.cc:292] Error parsing text-format opencv_caffe.NetParameter: 7:1: Expected identifier, got: <
Traceback (most recent call last):
File “C:/Users/danie/PycharmProjects/FaceTrack/DNN_FACETRACK.py”, line 18, in
net = cv2.dnn.readNetFromCaffe(configFile, modelFile)
cv2.error: OpenCV(4.5.3) C:\Users\runneradmin\AppData\Local\Temp\pip-req-build-c2l3r8zm\opencv\modules\dnn\src\caffe\caffe_io.cpp:1157: error: (-2:Unspecified error) FAILED: ReadProtoFromTextFile(param_file, param). Failed to parse NetParameter file: C:/Users/danie/PycharmProjects/FaceTrack/models/deploy.prototxt in function ‘cv::dnn::ReadNetParamsFromTextFileOrDie’
I would massivly appreciate any help. i have looked at loads of threads and cant see what im doing wrong