未知图层类型:函数cv :: dnn :: darknet :: ReadDarknetFromCfgFile中的快捷方式

时间:2019-10-17 15:53:39

标签: python opencv

我正在尝试使用opencv实现yolov3,我正在使用jupterlab,python 3.7.3和opencv 3.4.1

import numpy as np
import os
# Load Yolo 
weightsPath = os.path.sep.join(['yolo', "yolov3.weights"])
configPath = os.path.sep.join(['yolo', "yolov3.cfg"])

print("[INFO] loading YOLO from disk...")
net = cv2.dnn.readNetFromDarknet(configPath, weightsPath)
classes = []
with open("coco.names", "r") as f:
    classes = [line.strip() for line in f.readlines()]
layer_names = net.getLayerNames()
output_layers = [layer_names[i[0] - 1] for i in net.getUnconnectedOutLayers()]
colors = np.random.uniform(0, 255, size=(len(classes), 3))

,它返回此错误:

error: OpenCV(3.4.1) C:\Miniconda3\conda-bld\opencv-suite_1533128839831\work\modules\dnn\src\darknet\darknet_io.cpp:503: error: (-212) Unknown layer type: shortcut in function cv::dnn::darknet::ReadDarknetFromCfgFile

我在线搜索,但找不到线索,请帮忙!

0 个答案:

没有答案