dnn module caffe, weird output [closed]
Hello, i am porting an algorithm to opencv https://arxiv.org/pdf/1804.06039.pdf , the models are available here: https://github.com/Jack-CV/PCN-FaceDe... . I finished the first stage and while implementing the second, the outputs of the network are a bit weird:
Input Data: I: 1 C: 3 H: 24 W: 24
Scores Data: I: 1 C: 2 H: 299777088 W: 1
Regression Data: I: 1 C: 3 H: 309665792 W: 1
Rotate Data: I: 1 C: 3 H: 299780800 W: 1
The channels size of each output is correct, but the H,W are confusing me. I don't know if this has to be with the case that the model is the same for all the three networks?. Or maybe is an overflow issue? I tested it just forwarding a simple image with the secont network "PCN-2.prototxt" the output is similar.. has someone experienced something like this?
thanks!
porting means what ? to opencv3, using the dnn module instead of caffe ? (that would be indeed cool !)
yes! using the dnn module instead of caffe, i ported a lot of algorithms and while using the CPU, dnn is faster than the caffe CPU version.. so i wanted to do the same with this one :) .. also the linking is easier Im using the latest repo of opencv..
shame, i don't have caffe, else i'd join your battle ;)
uuuh shame :( . i will try to figure out what can be different there and post news if i get something. thanks!
did you see https://github.com/HandsomeHans/PCN-ncnn
yes, i was looking also in that one. I did the process of setting the inputs and reading the outputs of the networks similarly. Is the first time that I use the same .caffemodel for 3 different networks in opencv::dnn, i dont know if while loading the model, the fact that some output layers have the same name could be an issue (?)
i like to try it if i can compile on windows
i have both running in caffe and ncnn.. but in mac os :( . caffe is about 30-FPS and ncnn around 7-FPS with the same configurations on CPU.. i can post the first two stages of my code with opencv::dnn here if that is of some help?
@aguila, -- yes, please, let's see the code ! (why not put it on github, even ;) ?)
and, btw, which layers do
Scores Data
, etc refer to ?made some program recently, that prints out the opencv dnn layers, and got this
(the network layer names are not exactly the same, so this shouldn't be a problem, imho)
okay! i will just get some sushi and then create a github repo.. the names i defined as:
ScoresData is the "cls_prob" layer
RegressionData the "bbox_reg_1" layer
RotateData the "rotate_cls_prob" layer
layer name "cls_prob" is in the three networks present no? and "rotate_cls_prob" is in the first two networks
@berak i uploaded my code to https://github.com/richipower/PCN-opencv is just the first two stages.. as soon as i finish the third one ill upload it ;)
that's cool ! i could reproduce your weird numbers !
but i think, the problem here is: you're assuming, that all the output blobs from the dnn have 4 dimensions, it is clearly NOT so !
e.g the
cls_prob
rotate_cls_prob
andbbox_reg_2
from net_2 only have 2 dimensions, not 4 (similar for net_3), so you're trying to access invalid memory here !check
blob.dims
for those, again, please !heeey! aaah you are right.. my bad! i forgot that in the next networks just some regions are analyzed i just saw it with the blob.dims..
ill make the modifications and post the updates
Thank you!
hello! i just updated the repo.. maybe with some optimizations it could get to 40-FPS.. now is around 25-30 thanks @berak for your help!