Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.

How can I get the output of each layer?

idata
Employee
812 Views

Now, I am trying to run the python version mtcnn(https://github.com/DuinoDu/mtcnn) which I am going to use it for face detection on NCS, I successfully compiled the graph file. From the demo on the github, it needs the output of different layer, like the conv4-2, conv6-2, conv6-3 and prob1 .etc, how can I get the result of each layer. I try to compile it without the -in and -on option, but the output of the graph result are the same, is there any examples running the mtcnn?

0 Kudos
4 Replies
idata
Employee
487 Views

@fengping I assume that you are using one of the caffe models listed in the GitHub link you provided. To get the output of a layer, you can generate a graph file specifying the output node that you desire.

 

Using one of the prototxt files in the GitHub link as an example:

 

name: "PNet"

 

input: "data"

 

input_dim: 1

 

input_dim: 3

 

input_dim: 12

 

input_dim: 12

 

layer {

 

name: "conv1"

 

type: "Convolution"

 

bottom: "data"

 

top: "conv1"

 

param {

 

lr_mult: 1

 

decay_mult: 1

 

}

 

param {

 

lr_mult: 2

 

decay_mult: 0

 

}

 

….

 

You can use this command to generate a graph file that outputs at the layer "conv1": mvNCCompile -w det1.caffemodel det1.prototxt -on conv1 -s 12

 

More information on the mvNCCompile tool can be found at: https://movidius.github.io/ncsdk/tools/compile.html.
0 Kudos
idata
Employee
487 Views

@Tome_at_Intel

 

yes, if I want to get the result of each layer, I shall compile it to generate different graphs, and load it one by one to get the result of each layer, right?
0 Kudos
idata
Employee
487 Views

@Tome_at_Intel

 

I tried the way you mentioned, but the out of graph.GetResult() is quite different result with PNet.forward(). So, I can't match the result to the demo in mtcnn.
0 Kudos
idata
Employee
487 Views

Hi, as mentioned by @fengqing , the graph.GetResult() is different from what OpenCV cv2.dnn library that using net.forward().

 

I am unsure what is the output, userobj = graph.GetResult() is? Its data type etc? What is the inference result as stated in https://movidius.github.io/ncsdk/ncapi/ncapi1/py_api/Graph.GetResult.html

 

Cheers :)

0 Kudos
Reply