Assertion Error with Custom Trained Caffe
Hi,
I would like to use the OpenCV DNN framework with a custom trained Caffe network. I am using the newest OpenCV Version and contrib libs, I compiled two weeks ago, I guess. I have already checked the dnn samples, and with the precompiled SqueezeDet and SqueezeNet examples everything works just fine. But if I load my network I get the following exception:
OpenCV(3.4.1-dev) Error: Unspecified error (Can't create layer "cluster" of type "Python") in getLayerInstance, file opencv-master/modules/dnn/src/dnn.cpp, line 388 terminate called after throwing an instance of 'cv::Exception' what(): OpenCV(3.4.1-dev) opencv-master/modules/dnn/src/dnn.cpp:388: error: (-2) Unspecified error: Can't create layer "cluster" of type "Python" in function getLayerInstance
The network should be fine, I have tested it outside the OpenCV framework. The caffe version is 0.15.14, digits version is 5.1-dev. I use OpenCV in C++ not in Python, could it be the error?
Thanks a lot for any answers! Mary
EDIT: Here is the last layer of the prototxt, that probably causes the problem:
layer {
name: "cluster"
type: "Python"
bottom: "coverage"
bottom: "bboxes"
top: "bbox-list"
python_param {
module: "caffe.layers.detectnet.clustering"
layer: "ClusterDetections"
param_str: "1248, 352, 16, 0.6, 3, 0.02, 22, 1"
}
}
no, opencv does not have a "cluster" layer , so far.
@Mary-Ann, Are there any references to this layer? I guess "cluster" is only the name of layer but not it's type.
Hi, I'm not sure that I get your question right, but here is how I use my network in my application: ReadNetFromCaffe(prototxt, caffemodel) SetInput(inputBlob) forward() I don't use any arguments in the method forward() I only want that it propagates through the whole network. It works with squeezeNet and squeezeDet in this way, and also with specified layers, but not with my network...
@Mary-Ann , please add (at least) the prototxt to the question
Hi, I updated the question, I hope it helps to solve my problem
@Mary-Ann - wow, that broke the editor of this webpage ;)
maybe we need ONLY the last layer, and the resp. python code for that. then we can see, if there's any ready-made opencv replacement code for this
I updated the question so that only the last layer can be seen. The network was trained using DIGITS (https://github.com/NVIDIA/DIGITS/tree...), with a dataset similar to KITTI (http://www.cvlibs.net/datasets/kitti/...). Just like in the example DetectNet was used. I have just realized, that I dont use the binaryproto of the model. I am currently working on the reading in of the file. But I dont think so, that the wrong mean values cause the actual problem.
@Mary-Ann, dkurt is already working on support for custom python layers, watch this pr , and update, once it's merged ;)
@berak, yeah, I can handle to test it with an implementation from https://github.com/NVIDIA/caffe/blob/....