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

Using multiple NCS 1 to run face detection and feed in the faces into gendernet and agenet on Rasp

idata
Employee
721 Views

Hello there!

 

The plan of my project is do use multiple NCS 1 on Raspberry Pi 3 to do facial detection. Apparently there's gender age lbp available in C++ but that is giving inference on face of a same person. I want to have it detecting only 1 person's face with 1 result, not 1 person's face giving multiple results. The reason for this is I am doing person counting by face as well as doing recognition on their gender and age.

 

Therefore I break it down into facial detection by running different py files that taking snapshot of the ROI (bounding box of face only) through opencv dnn library and then feed these faces into gender and age net. I referred to pyimagesearch blog (https://www.pyimagesearch.com/2018/07/23/simple-object-tracking-with-opencv), this blog emphasis face detection and tracking, so I can output only 1 face of a person, not every face detected in every frame that gives me many faces of same person. The problem I faced using the code in this blog is slow inference speed as this code does not support NCS library yet. I am trying to modify the code to support NCS but I face problem in understanding codes like:

 

     

  1. graph.LoadTensor(image.astype(np.float32), None)

     

    I get that second parameter in graph.LoadTensor None is for user object, but I do not really understand what does it use for
  2.  

  3. output, userobj = graph.GetResult()

     

    Same as the line #1 above, userobj, what does it use for?
  4.  

 

I am assuming output in line#2 gives me the bounding box coordinate of my ROI (face of person) which then I can use cv2.imwrite to take a snapshot of the ROI. (that's how i work without NCS on the blog code initially).

 

Any help from the community will be greatly appreciated! :smile:

 

Cheers! - Ricky

0 Kudos
3 Replies
idata
Employee
418 Views

UPDATE

 

After I ran output, userobj = graph.GetResult() command, i tried print (output)

 

All I get is a lot of numbers in power of -3 to power of -5 in an array. 707 elements of number in the array to be exact.
0 Kudos
idata
Employee
418 Views

Hi @RickyChew

 

graph.LoadTensor() is a function that starts an inference on the graph passed through. I think you would need to call this function for every graph file. After this function is called, call graph.GetResult() to retrieve that inference result. The parameter inputTensor is in a numpy ndarray of half precision floating point numbers - this is the input data on which the inference will be run. The output of graph.GetResult() are the inference results and the user object, so that output that you got is the array from graph.LoadTensor.

 

I hope this was helpful!

 

Best Regards,

 

Sahira
0 Kudos
idata
Employee
418 Views

Hi @Sahira_at_Intel

 

Thank you for reaching out.

 

I have also found some comments in python code in /workspace/ncappzoo/app/security-cam/utils/deserialize_output.py that clearly saying what exactly is each element in the 'output' and how to extract them accordingly.

 

Hope this helps anyone that are achieving same objectives.

 

Cheers

0 Kudos
Reply