Найти - Пользователи
Полная версия: cv2 ERROR
Начало » Python для новичков » cv2 ERROR
1
dankochkurov
Hello! I am doing object recognition on a windows system.
I have a code:
import cv2

img = cv2.imread('Doroga_na_ylitce1.jpg')

classNames =
classFile = ‘coco.names’
with open(classFile, ‘rt’) as f:
classNames = f.read().rstrip('\n').split('\n')

configPath = ‘ssd_mobilenet_v3_large_coco_2020_01_14.pbtxt’
weightsPath = ‘frozen_inference_graph.pb’

net = cv2.dnn_DetectionModel(weightsPath, configPath)
net.setInputSize(320, 320)
net.setInputScale(1.0/ 127.5)
net.setInputMean((127.5, 127.5, 127.5))
net.setInputSwapRB(True)

classIds, confs, bbox = net.detect(img, confThreshold=0.5)
print(classIds, bbox)

cv2.imshow('Output', img)
cv2.waitKey(0)

It gives me an error:
global D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\tensorflow\tf_importer. cpp (3159) cv::dnn::dnn4_v20211220::anonymous-namespace'::TFImporter::parseNode DNN/TF: Can't parse layer for node='FeatureExtractor/MobilenetV3/Conv/Conv2D' of type='Conv2D'. Exception: OpenCV(4.5.5) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\tensorflow\tf_importer.cpp:2830: error: (-2:Unspecified error) Const input blob for weights not found in function ‘cv::dnn::dnn4_v20211220::anonymous-namespace’::TFImporter::getConstBlob'

cv2.error: OpenCV(4.5.5) D:\a\opencv-python\opencv\modules\dnn\src\tensorflow\tf_importer. cpp:2830: error: (-2:Unspecified error) Const input blob for weights not found in function ‘cv::dnn::dnn4_v20211220::`anonymous-namespace’::TFImporter::getConstBlob'

The above exception was the immediate cause of the following exception:

Traceback (last call):
“CUsers/Daniel/PycharmProjects/object_detection/real_time_object_detection.py” file, line 13, in .
net = cv2.dnn_DetectionModel(weightsPath, configPath)
SystemError: The <class ‘cv2.dnn_DetectionModel’> returned a result with a set of errors

Process ended with exit code 1
Help please, thanks in advance.
P.S. The files are in the project folder.
dankochkurov
Here is the file with my code
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB