i was trying to use MobileNet SSD model for Object detection project, and i wanted to use a caffemodel with prototxt file and i downloaded these files from here. After i downloaded files and put them in the same directory of my project, pycharm interpreter can't understand the caffemodel file as shown in the image issue_image
Here is the code i use in my object detection project:
import numpy as np
import cv2
image_path = 'roompeople.jpg'
prototxt_path = 'models/MobileNetSSD_deploy.prototxt'
model_path = 'models/mobilenet.caffemodel'
min_confidence = 0.2
classes = ["background", "aeroplane", "bicycle", "bird", "boat", "bottle", "bus", "car", "cat", "chair", "cow",
"diningtable", "dog", "horse", "motorbike", "person", "pottedplant", "sheep", "sofa", "train", "tvmonitor"]
np.random.seed(543210)
colors = np.random.uniform(0, 255, size=(len(classes), 3))
net = cv2.dnn.readNetFromCaffe(prototxt_path, model_path)
image = cv2.imread(image_path)
height, width = image.shape[0], image.shape[1]
blob = cv2.dnn.blobFromImage(cv2.resize(image, (300,300)), 0.007, (300, 300), 130)
net.setInput(blob)
detected_objects = net.forward()
print(detected_objects[0][0][0])
and Here is the error i got after run the code:
cv2.error: OpenCV(4.6.0) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\caffe\caffe_io.cpp:1138: error: (-2:Unspecified error) FAILED: fs.is_open(). Can't open "models/mobilenet.caffemodel" in function 'cv::dnn::ReadProtoFromBinaryFile'