- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, I'm trying to convert MTCNN to NCSDK graph. I need outputs of several layers to locate face.
But I found that getResult() only returns the result of the output node which is defined when the graph is generated
I read the API documents, but the documents didn't show the details about the return logic of this function.
I want to ask about how to output results of different layers at the same time or maybe I should generate different graphs with different output node???
(by the way, I don't know why when I compile the net, the last layer 'prob1' is always ignored. Only if I define the last layer as the output node, it won't be ignored.
-------compiling without defining the output node
Detailed Per Layer Profile
Bandwidth time
# Name MFLOPs (MB/s) (ms)
0 data 0.0 1458.7 0.002
1 conv1 0.7 24.7 1.277
2 prelu1 0.0 409.0 0.063
3 pool1 0.0 292.7 0.088
4 conv2 2.0 207.2 0.393
5 prelu2 0.0 118.6 0.063
6 pool2 0.0 220.2 0.034
7 conv3 0.2 104.5 0.281
8 prelu3 0.0 9.8 0.113
9 conv4 0.1 1001.4 0.142
10 prelu4 0.0 3.9 0.063
11 conv5-1 0.0 23.5 0.031
12 conv5-2 0.0 41.3 0.030
Total inference time 2.58
Generating Profile Report 'output_report.html'…
--------define the prob1 as the output node
Detailed Per Layer Profile
Bandwidth time
# Name MFLOPs (MB/s) (ms)
0 data 0.0 1458.7 0.002
1 conv1 0.7 25.6 1.236
2 prelu1 0.0 415.9 0.062
3 pool1 0.0 284.4 0.091
4 conv2 2.0 188.6 0.432
5 prelu2 0.0 120.2 0.062
6 pool2 0.0 215.6 0.034
7 conv3 0.2 78.7 0.373
8 prelu3 0.0 17.6 0.063
9 conv4 0.1 968.7 0.146
10 prelu4 0.0 3.9 0.063
11 conv5-1 0.0 23.0 0.032
12 conv5-2 0.0 41.0 0.030
13 prob1 0.0 0.1 0.048
Total inference time 2.67
Generating Profile Report 'output_report.html'…
)
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@FREEMAN123 You are correct. getResult() returns a tensor of the same shape as the output node during the graph file creation. So yes, if you would like to get the output of several different nodes then you would have to create different graph files for each node.
I don't know what your use case is, but the NCS can only process one inference at a time so simultaneous inference for different layers with one device will not be possible.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Tome_at_Intel Thanks very much! I just want to use "https://github.com/kpzhang93/MTCNN_face_detection_alignment" to detect face and "https://github.com/wy1iu/sphereface" to recognize face. I need the output of Conv4-2 and Prob1 in MTCNN. I hope maybe a concat layer can help me.
I also got a problem when I test the spherenet on NCS. The output are NANs. Here is my code, and the trained model can be found in "https://github.com/wy1iu/sphereface", could you give me some advice?
from mvnc import mvncapi as mvnc
import cv2
import numpy
dim=(96,112)
mvnc.SetGlobalOption(mvnc.GlobalOption.LOG_LEVEL,2)
devices = mvnc.EnumerateDevices()
device = mvnc.Device(devices[0])
device.OpenDevice()
network_blob='graph'
with open(network_blob, mode='rb') as f:
blob=f.read()
graph = device.AllocateGraph(blob)
img = cv2.imread('1.jpg')
img = cv2.resize(img,dim)
print(img.shape)
img = img.astype(numpy.float32)
graph.LoadTensor(img.astype(numpy.float16), 'user object')
output, userobj = graph.GetResult()
print(output)
graph.DeallocateGraph()
device.CloseDevice()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@FREEMAN123 I'll check it out and get back to you. Thanks for your patience.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@FREEMAN123 Hi, I just want to give you an update. I've made some progress but I'm still running into the same error. Changing the PReLU layer's top parameter to its own name seems to produce the correct results when using the intermediate layers as output (see below). However the final layers are still producing nans for me.
old PReLU layer (gives wrong results):
layer {
name: "relu1_1"
type: "PReLU"
bottom: "conv1_1"
top: "conv1_1"
}
new PReLU layer:
layer {
name: "relu1_1"
type: "PReLU"
bottom: "conv1_1"
top: "relu1_1"
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Tome_at_Intel Thanks very much for your update. I'm wondering if it's because float16 is not long enough?
And I also found that it raises an error when I deallocate a graph and then allocate another graph. Could you give me any advice about what should I do when I need to change the graph?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@FREEMAN123 There is a bug with de-allocating and allocating graphs dynamically at the moment. We are working on a release candidate for that issue at the moment. As of right now, you will have to close the device and reopen the device to be able to use another graph with the same device. I realize this is not efficient.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Tome_at_Intel Oh, I really hope the update is coming soon, thank you for your kind replies!
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page