函数'cv::dnn::ConvolutionLayerImpl::getMemoryShapes'中的OpenCV深度学习人脸检测断言错误

OpenCV deep learning face detection assertion error in function #39;cv::dnn::ConvolutionLayerImpl::getMemoryShapes#39;(函数#39;cv::dnn::ConvolutionLayerImpl::getMemoryShapes#39;中的OpenCV深度学习人脸检测断言错误)
本文介绍了函数'cv::dnn::ConvolutionLayerImpl::getMemoryShapes'中的OpenCV深度学习人脸检测断言错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我跟随tutorial使用OpenCV和深度学习SSD框架从image实现了人脸检测。

modelFile = "./ssd/res10_300x300_ssd_iter_140000.caffemodel"
configFile = "./ssd/deploy.prototxt"
net = cv2.dnn.readNetFromCaffe(configFile, modelFile)
image = cv2.imread("face.jpg")
(h, w) = image.shape[:2]
blob = cv2.dnn.blobFromImage(cv2.resize(image, (300, 300)), 1.0, (300, 300), (104.0, 177.0, 123.0))
net.setInput(blob)
detections = net.forward()

detections = net.forward()返回错误:

error: OpenCV(4.0.0) C:projectsopencv-pythonopencvmodulesdnnsrclayersconvolution_layer.cpp:236: error: (-215:Assertion failed) blobs.size() != 0 in function 'cv::dnn::ConvolutionLayerImpl::getMemoryShapes'

仍在寻找更多信息,但不知道是代码错误还是库中的错误...有人知道什么会引起问题吗?任何帮助都将不胜感激。

推荐答案

我无法同时使用OpenCV 3.4.2和OpenCV 4.0.0重现您的问题。

我得到的是:

附注:我从https://raw.githubusercontent.com/opencv/opencv_3rdparty/dnn_samples_face_detector_20170830/res10_300x300_ssd_iter_140000.caffemodel下载res10_300x300_SSD_ITER_140000.caffModel,从https://github.com/opencv/opencv/raw/3.4.0/samples/dnn/face_detector/deploy.prototxt下载部署.Prototxt。

这篇关于函数'cv::dnn::ConvolutionLayerImpl::getMemoryShapes'中的OpenCV深度学习人脸检测断言错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Leetcode 234: Palindrome LinkedList(Leetcode 234:回文链接列表)
How do I read an Excel file directly from Dropbox#39;s API using pandas.read_excel()?(如何使用PANDAS.READ_EXCEL()直接从Dropbox的API读取Excel文件?)
subprocess.Popen tries to write to nonexistent pipe(子进程。打开尝试写入不存在的管道)
I want to realize Popen-code from Windows to Linux:(我想实现从Windows到Linux的POpen-code:)
Reading stdout from a subprocess in real time(实时读取子进程中的标准输出)
How to call type safely on a random file in Python?(如何在Python中安全地调用随机文件上的类型?)