作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我将 Tensorflow 模型转换为 Caffe 模型( tf_resnet.prototxt ),现在我正在尝试运行对象检测计数算法( code )。但是,我收到以下错误:
[INFO] loading model...
[INFO] opening video file...
Traceback (most recent call last):
File "people_counter.py", line 132, in <module>
detections = net.forward()
cv2.error: OpenCV(4.2.0) /io/opencv/modules/dnn/src/dnn.cpp:562: error: (-2:Unspecified error) Can't create layer "DummyData1" of type "DummyData" in function 'getLayerInstance'
This Stackoverflow 上的类似问题建议更改
type: "DummyData1"
至
type: "Input"
在以下代码中:
layer {
name: "DummyData1"
type: "DummyData1"
top: "DummyData1"
dummy_data_param {
shape {
dim: 1
dim: 64
dim: 150
dim: 150
}
}
}
但是,在执行此操作时,我收到另一个错误:
Traceback (most recent call last):
File "people_counter.py", line 132, in <module>
detections = net.forward()
cv2.error: OpenCV(4.2.0) /io/opencv/modules/dnn/src/dnn.cpp:2709: error: (-215:Assertion failed) inp.total() in function 'allocateLayers''
有关如何解决此问题的任何建议?
最佳答案
你可以试试这个方法;改变这个:
layer {
name: "DummyData1"
type: "DummyData1"
top: "DummyData1"
dummy_data_param {
shape {
dim: 1
dim: 64
dim: 150
dim: 150
}
}
}
有了这个:
layer {
name: "DummyData1"
type: "Input"
top: "DummyData1"
input_param {
shape {
dim: 1
dim: 64
dim: 150
dim: 150
}
}
}
然后在脚本中,而不是使用这些行:
blob = cv2.dnn.blobFromImage(frame, 0.007843, (W, H), 127.5)
net.setInput(blob)
detections = net.forward()
试试这些:
blob = cv2.dnn.blobFromImage(frame, 0.007843, (W, H), 127.5)
net.setInput(blob, "Placeholder")
net.setInput(np.zeros((1, 64, 150, 150)), "DummyData1")
detections = net.forward()
我不知道结果是否会好,但这至少应该解决异常。
关于opencv - 使用 DummyData 层 : "Can' t create layer "DummyData1" of type "DummyData1" in function 'getLayerInstance' "加载 Caffe 模型时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62549599/
我将 Tensorflow 模型转换为 Caffe 模型( tf_resnet.prototxt ),现在我正在尝试运行对象检测计数算法( code )。但是,我收到以下错误: [INFO] load
我是一名优秀的程序员,十分优秀!