Can't create layer "DummyData1" of type "DummyData" in function 'getLayerInstance'

asked 2020-06-23 08:24:49 -0500

goncz gravatar image

I converted a tensorflow model to a caffe model (tf_resnet.prototxt), and I'm now trying to run an object detection counting algorithm (code). However, i get the following error:

[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 similar issue on Stackoverflow suggested to change the type: "DummyData1" to type: "Input" in the following code:

layer {
  name: "DummyData1"
  type: "DummyData1"
  top: "DummyData1"
  dummy_data_param {
    shape {
      dim: 1
      dim: 64
      dim: 150
      dim: 150
    }
  }
}

However, when doing this, i get another error:

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'

Any suggestions on how to fix this?

edit retag flag offensive close merge delete

Comments

if this is the 1st layer, you could try to replace it with:

input: "data"
input_dim: 1
input_dim: 64
input_dim: 150
input_dim: 150

does it really have 64 "channels" there ?

berak gravatar imageberak ( 2020-06-23 09:02:12 -0500 )edit

As you can see in the prototxt file, it's not the first layer (however it is the first dummylayer). You mean to replace it like this?

layer {
  input: "data"
  input_dim: 1
  input_dim: 64
  input_dim: 150
  input_dim: 150
}
goncz gravatar imagegoncz ( 2020-06-24 01:55:00 -0500 )edit

no, it was meant literally, and since it's NOT the 1st data layer, it probably can't apply

(yea, sorry did not see your prototxt)

btw, why did you convert it to caffe ? (did you retrain it ?) does the original tf model work with opencv ?

berak gravatar imageberak ( 2020-06-24 02:03:26 -0500 )edit
1

I'm trying to develop an object detection counting algorithm, specifically this implementation by Adrian Rosebrock. This implementation requires a caffe model instead of a TF model.

goncz gravatar imagegoncz ( 2020-06-24 02:26:16 -0500 )edit

well adrian's tutorial seems to mainly highlight his "centroid tracker"

The bounding boxes themselves can be provided by either:

    An object detector (such as HOG + Linear SVM, Faster R- CNN, SSDs, etc.)
    Or an object tracker (such as correlation filters)

This implementation requires a caffe model instead of a TF model.

we do have ready-made SSD detection caffe models in the zoo. i'm also quite sure, that you can use others like yolo or squeezedet, with a bit of hacking...

berak gravatar imageberak ( 2020-06-24 02:39:36 -0500 )edit
1

That's true, but I'm trying to implement my own model which is trained in Tensorflow. It's a faster RCNN inception resnet v2 model.

goncz gravatar imagegoncz ( 2020-06-24 02:45:05 -0500 )edit

ok,ok, and nice, that you trained your own !

It's a faster RCNN inception resnet v2 model.

good to know, maybe we can find out, what the DummyLayer is about now

berak gravatar imageberak ( 2020-06-24 02:55:30 -0500 )edit

I'll make sure to get back to you if I find a solution. Hopefully someone here knows something ;)

goncz gravatar imagegoncz ( 2020-06-24 03:11:05 -0500 )edit