dnn forward Mat size and dimensions are wierd
I am running the OpenCV demo dnn code from here:
https://docs.opencv.org/trunk/d5/de7/...
However, when I do the forward pass:
Mat prob = net.forward();
prob has the following attributes:
prob.dims 2
prob.channels: 1
prob.rows: 1
prob.cols 1000
prob.depth: 5
prob.size[0]: 1
prob.size[1]: 1000
prob.size[2]: 213147712
prob.size[3]: 277
In most examples, to find he coordinates, it loops through prob.size[2], which in my case is 21347712!
Any ideas what's going on?
In most examples
. Please provide a reference to at least one of them. GoogLeNet is a classification network and it produces a vector with confidences where number of elements equals to number of classes.What I'm really trying to get at is the coordinates of the detected objects. I could not find a good example of that in c++. In this example, the loop is through detector.size[2]: https://stackoverflow.com/questions/4...
@Jonny, have you tried https://github.com/opencv/opencv/blob... ? And you need to use network trained for object detection problem.
Got it: wrong network model for object detection. Thanks for the pointer.
@Jonny, if dims==2, only size[0] and size[1] are valid (or even properly allocated)
both 213147712 and 277 are bogus values.
imho, your classification example works perfect (googlenet indeed has class 1000 labels), and you only got confused by the wrong sizes.
if you wanted to do object detection with it, it's the wrong example, and the wrong network