frame

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

OpenCv face_detect network fails in mvNCCheck

Hi
I'm trying to convert the OpenCv face_detector network to use it on the Compute stick.
https://github.com/opencv/opencv/blob/master/samples/dnn/face_detector/deploy.prototxt

mvNCCompile and mvNCProfile works fine but mvNCCheck fails

mvNCCheck deploy.prototxt -s 12 -is 300 300
mvNCCheck v02.00, Copyright @ Movidius Ltd 2016

****** WARNING: using empty weights ******
/usr/local/bin/ncsdk/Controllers/FileIO.py:52: UserWarning: You are using a large type. Consider reducing your data sizes for best performance
"Consider reducing your data sizes for best performance\033[0m")
USB: Transferring Data...
USB: Myriad Execution Finished
USB: Myriad Connection Closing.
USB: Myriad Connection Closed.
Result: (1, 1, 7)
1) 6 nan
2) 5 nan
3) 4 nan
4) 3 nan
5) 2 nan
Expected: (1, 200, 7)
1) 699 inf
2) 874 inf
3) 907 inf
4) 270 inf
5) 272 inf
/usr/local/bin/ncsdk/Controllers/Metrics.py:75: RuntimeWarning: invalid value encountered in greater

diff)) / total_values * 100

Obtained values

Obtained Min Pixel Accuracy: nan% (max allowed=2%), Fail
Obtained Average Pixel Accuracy: nan% (max allowed=1%), Fail
Obtained Percentage of wrong values: 0.0% (max allowed=0%), Fail
Obtained Pixel-wise L2 error: nan% (max allowed=1%), Fail
Obtained Global Sum Difference: nan

Any hint to what the reason could be ?

/Mats Önnerby

Comments

  • 10 Comments sorted by Votes Date Added
  • @Mats This could be the cause of using zero weights for this network. Try using the weights listed in https://github.com/opencv/opencv/issues/10965 and you should get results that are not inf or nan. In case you are interested, we have a FaceNet example @ https://github.com/movidius/ncappzoo.

  • I also tried using the weights file, but that also fails. I think the base problem is that OpenCV uses a different branch of caffe.
    I'm trying to get this running on a Raspberry PI, and tensorflow is not officially available on the PI, so I can't use FaceNet.
    So my workaround now is to run UV4L ( https://www.linux-projects.org/uv4l/installation/ ) on the PI to stream video from the picamera to a more powerful computer ( Intel NUC ) where I can use OpenCV's DNN module to do facedetection in realtime.
    Thanks for your suggestions.

  • @Mats When trying the weights file, are you still seeing the same nan and inf error? I was able to get some values to show up during my own test. For reference, the weights file I used was: https://github.com/opencv/opencv_3rdparty/raw/dnn_samples_face_detector_20170830/res10_300x300_ssd_iter_140000.caffemodel

  • @Tome_at_Intel

    I tried with that weigths file and now I get values, but it seems like the output matrix from caffe and the compute stick have different size, so the comparision fails in MVNCCheck.

    Console output below:

    mvNCCheck v02.00, Copyright @ Movidius Ltd 2016

    /usr/local/bin/ncsdk/Controllers/FileIO.py:52: UserWarning: You are using a large type. Consider reducing your data sizes for best performance
    "Consider reducing your data sizes for best performance\033[0m")
    USB: Transferring Data...
    USB: Myriad Execution Finished
    USB: Myriad Connection Closing.
    USB: Myriad Connection Closed.
    Result: (1, 196, 7)
    1) 566 4.99
    2) 692 4.984
    3) 691 4.832
    4) 439 4.81
    5) 689 4.176
    Expected: (1, 112, 7)
    1) 27 4.98
    2) 19 4.97
    3) 76 4.883
    4) 34 4.87
    5) 97 4.855
    Traceback (most recent call last):
    File "/usr/local/bin/mvNCCheck", line 152, in
    quit_code = check_net(args.network, args.image, args.inputnode, args.outputnode, args.nshaves, args.inputsize, args.weights, args)
    File "/usr/local/bin/mvNCCheck", line 143, in check_net
    ValidationStatistic[extargs.metric], filename, args)
    File "/usr/local/bin/ncsdk/Views/Validate.py", line 169, in validation
    compare_matricies(result, expected, filename)
    File "/usr/local/bin/ncsdk/Controllers/Metrics.py", line 185, in compare_matricies
    compare_obj.generate_report(csv, result, expected)
    File "/usr/local/bin/ncsdk/Controllers/Metrics.py", line 116, in generate_report
    obtained_val = self.metrics(result.astype(np.float32), reference)
    File "/usr/local/bin/ncsdk/Controllers/Metrics.py", line 59, in metrics
    diff = np.abs(a - b)
    ValueError: operands could not be broadcast together with shapes (1,196,7) (1,112,7)

    Do you get the same result ?

    Thanks /Mats

  • @Mats I see similar results to yours. mvNCCheck is a tool that is designed for Softmax outputs so that is probably the reason why the top 5 results are wrong. The OpenCV network you provided uses a DetectionOutput layer and this layer may be returning different bounding box locations based on your image.

  • @Tome_at_Intel I'm test this opencv facedetect too, the results which the device returned was like this:
    [ 1.08000000e+02 -3.25927734e-01 -6.87255859e-02 -1.22375488e-01
    -5.04455566e-02 -5.56030273e-02 6.31713867e-02]
    [ 0. 1. 0.33666992 2.1640625 2.02929688 2.8203125
    2.97460938]
    [ 0. 1. 0.30371094 0.1920166 0.00604248 0.25683594
    0.13208008]
    [ 0. 1. 0.29882812 2.17382812 3.015625 2.83789062
    3.9375 ]
    [ 0. 1. 0.29394531 0.77880859 0.02429199 0.85302734
    0.16638184]
    [ 0. 1. 0.28515625 0.24438477 0.11401367 0.82519531
    0.93652344]
    [ 0. 1. 0.27807617 0.19226074 0.41967773 0.26318359
    0.56298828]
    [ 0. 1. 0.27294922 1.2265625 1.99804688 1.83007812
    2.99804688]
    [ 0. 1. 0.26049805 0.640625 -0.02961731 0.71777344
    0.06573486]
    [ 0. 1. 0.25073242 0.61181641 -0.01260376 0.69384766
    0.09301758]
    [ 0. 1. 0.24719238 0.18884277 0.47265625 0.26367188
    0.61816406]
    [ 0. 1. 0.24511719 0.75732422 0.1583252 0.89892578
    0.42285156]
    [ 0. 1. 0.22387695 0.27685547 0.30957031 0.34033203
    0.45556641]
    [ 0. 1. 0.21728516 0.91552734 0.12890625 0.98193359
    0.27050781]
    [ 0. 1. 0.21643066 0.47119141 0.3125 0.89306641
    0.859375 ]
    [ 0. 1. 0.21533203 3.16796875 3. 3.76171875
    3.97265625]
    [ 0. 1. 0.21447754 0.06347656 0.52734375 0.46630859
    1.06835938]
    [ 0. 1. 0.21411133 1.21679688 2.99414062 1.81835938
    3.97460938]
    [ 0. 1. 0.2109375 0.18811035 0.18859863 0.25756836
    0.31738281]
    ......

  • @Zhoujustin I'm not sure how to interpret the results from that network. If you examine the SSD Mobilenet example from the ncappzoo (https://github.com/movidius/ncappzoo/blob/master/apps/video_objects/video_objects.py#L177) this may give you a clue as to how to work with the result because it uses the same output layer (although it could be completely different too). Maybe you can check the github where you got this network from and see if there is any instructions on how to interpret the output from this network.

  • Thanks @Tome_at_Intel , I try to understand the output that you explained. Go back and ask again.

  • @Zhoujustin your result seems consist with the description in https://github.com/movidius/ncappzoo/blob/master/apps/video_objects/video_objects.py#L177. first number is the object count, and the next 6 numbers are useless. the next n*7 are image id, class id, confidence in this class, x1, y1, x2, y2.
    But I didn't get the similar result as yours. Could you share your code with me?

    @Tome_at_Intel. I am not sure if it is caused by the error in vm. Although I can get an output, but the result is not structured as Zhoujusitin's result. It was also blocked the code and can't release the device.
    error: E: [ 0] dispatcherEventReceive:200 dispatcherEventReceive() Read failed -9

  • @machinedog The problems which I faced were that the caffe vision diffent. The caffe-ssd should be used. And the others such as Intel, Nvidia, may have the diffent probuf struct.

Sign In or Register to comment.