Уведомления

Группа в Telegram: @pythonsu

#1 Сен. 5, 2022 10:46:05

dankochkurov
Зарегистрирован: 2022-05-01
Сообщения: 15
Репутация: +  0  -
Профиль   Отправить e-mail  

cv2 ERROR

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.

Прикреплённый файлы:
attachment real_time_object_detection.py (607 байт)

Офлайн

#2 Сен. 5, 2022 15:14:02

ZerG
Зарегистрирован: 2012-04-05
Сообщения: 2580
Репутация: +  58  -
Профиль   Отправить e-mail  

cv2 ERROR

Dont spam please
https://python.su/forum/topic/41923/



Влодение рускай арфаграфией - это как владение кунг-фу: настаящие мастира не преминяют ево бес ниабхадимости

Офлайн

#3 Сен. 6, 2022 11:03:50

dankochkurov
Зарегистрирован: 2022-05-01
Сообщения: 15
Репутация: +  0  -
Профиль   Отправить e-mail  

cv2 ERROR

ZerG
Dont spam pleasehttps://python.su/forum/topic/41923/
hello! This is not spam!!!
I added two topics to different groups, because it is not moderate that newcomers to python can solve this issue. And experts most likely can!

Офлайн

#4 Сен. 9, 2022 10:05:53

Shakelv
От: Киев
Зарегистрирован: 2022-09-09
Сообщения: 1
Репутация: +  0  -
Профиль   Отправить e-mail  

cv2 ERROR

Офлайн

Board footer

Модераторировать

Powered by DjangoBB

Lo-Fi Version