Ask Your Question
3

dnn module caffe, weird output [closed]

asked 2018-11-03 05:48:38 -0600

aguila gravatar image

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!

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by dkurt
close date 2018-11-08 06:49:26.640833

Comments

porting means what ? to opencv3, using the dnn module instead of caffe ? (that would be indeed cool !)

berak gravatar imageberak ( 2018-11-03 05:53:00 -0600 )edit
1

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..

aguila gravatar imageaguila ( 2018-11-03 05:57:25 -0600 )edit

shame, i don't have caffe, else i'd join your battle ;)

berak gravatar imageberak ( 2018-11-03 06:01:28 -0600 )edit

uuuh shame :( . i will try to figure out what can be different there and post news if i get something. thanks!

aguila gravatar imageaguila ( 2018-11-03 06:24:36 -0600 )edit
1
sturkmen gravatar imagesturkmen ( 2018-11-03 07:16:35 -0600 )edit

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 (?)

aguila gravatar imageaguila ( 2018-11-03 07:53:33 -0600 )edit
sturkmen gravatar imagesturkmen ( 2018-11-03 07:59:39 -0600 )edit

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 gravatar imageaguila ( 2018-11-03 08:10:09 -0600 )edit

@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)

berak gravatar imageberak ( 2018-11-03 08:27:08 -0600 )edit
1

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

aguila gravatar imageaguila ( 2018-11-03 08:32:03 -0600 )edit
1

@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 ;)

aguila gravatar imageaguila ( 2018-11-03 09:18:04 -0600 )edit
1

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_probrotate_cls_prob and bbox_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 !

berak gravatar imageberak ( 2018-11-03 09:38:00 -0600 )edit
1

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!

aguila gravatar imageaguila ( 2018-11-03 10:00:50 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2018-11-05 13:54:09 -0600

aguila gravatar image

updated 2018-11-05 15:52:25 -0600

solved... the error was accessing bad dimensions of blob

https://github.com/richipower/PCN-opencv

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2018-11-03 05:48:38 -0600

Seen: 516 times

Last updated: Nov 05 '18