(2:未指定错误)无法在函数“getLayerInstance”中创建类型为“AddV2”的层“FeatureExtractor/MobilenetV3/Conv/hard_swish/add”

2024-04-26 03:22:41 发布

您现在位置:Python中文网/ 问答频道 /正文

我在classIds, confs, bbox = net.detect(img,confThreshold=float0.5)面临一个问题 怎么修?请帮忙

我正在尝试运行一个非常简单的OpenCV脚本:

import cv2

img = cv2.imread("index.jpeg")

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) #line 19
print(classIds,bbox)


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

Picture of full error

提前谢谢


Tags: 脚本imgnetcv2opencvcocodetectbbox