[OpenR8 solution] OpenVINO (Using OpenVINO for face detection and object detection)
  1. Chapter 1: OpenVINO

 

OpenVINO is Intel's software framework for deep learning inference running on Intel's hardware (CPU, GPU...) to optimize execution performance.

The solution in Openvino is divided into two parts, face detection (gender, age, expression) and object detection, while face detection (gender, age, expression) and object detection solutions are divided into CPU and MYRIAD two versions, the CPU refers to the computer's Intel CPU, MYRIAD is Intel's special hardware for deep learning. Because it's running on Intel's hardware, it's not Intel's hardware, and it's not supported in theory!

※ This solution uses a Webcam, so please check if there is a Webcam before Running.

※ OpenVINO uses the IR model, so we need to use our "Model_optimizer.flow" solution to convert the Caffe model to OpenVINO's IR model. See Chapter 4 for details.

 

 

  1. Chapter 2: Interactive_face_detection_CPU.flow ― Face detection gender, age and expression

 

Running this solution can detect a person's gender, age, and expression, and using the solution requires only two steps. as follows:

  1. Load the solution

"execute R8.exe" => "File" => "Open" => "Select Solution under OpenVino folder" => "double-click Interactive_face_detection_cpu.flow". The following Fig. 1, Fig. 2, Fig. 3, Fig. 4, Fig. 5.

 

Fig. 1. Excute R8.png

Fig. 1. Excute R8.exe.

 

Fig. 2. File Open.png

Fig. 2. File => Open.

 

Fig. 3. click solution.png

Fig. 3. click solution/OpenVINO

 

Fig. 4. double-click interactive_face_detection_CPU.flow.png

Fig. 4. double-click interactive_face_detection_CPU.flow

 

Fig. 5. load Interactive_face_detection_CPU.flow.png

Fig. 5. load Interactive_face_detection_CPU.flow

 

  1. Run the solution

 

Fig. 6. Run the solution.png

Fig. 6. Run the solution.

 

※Fig. 6 explanation:

Detecting the position of the face, showing the gender, age, expression of the face, where M refers to the male, if F is the female, and the latter 22 refers to the age, the last "happy" is the detection expression , like "sad", the origin of the x, y, and z axes of the bounding box is the position of the head.

※ The difference between Interactive_face_detection_MYRIAD.flow and Interactive_face_detection_CPU.flow is whether there is Intel's MYRIAD. If there is no MYRIAD, the error in Fig. 7 will appear.

Interactive_face_detection_MYRIAD.flow is used in the same way as Interactive_face_detection_CPU.flow, except that the difference is different in Intel hardware.

 

Fig. 7. No MYRIAD would have been wrong..png

Fig. 7. No MYRIAD would have been wrong.

 

 

  1. Chapter 3: Object_detection_CPU.flow ― Celebrity face detection

 

There are only two steps to using this solution. As follows:

  1. Load Solution

“Run R8.exe” => “File” => “Open” => “Select solution Under OpenVINO folder” => “double-click Object_detection_CPU.flow” , as shown in Fig. 8, Fig. 9, Fig. 10, Fig. 11, Fig. 12.

 

Fig. 8. Run R8.png

Fig. 8. Run R8.exe

 

Fig. 9..png

Fig. 9. “File” => “Open”

 

Fig. 10..png

Fig. 10. select “solutionOpenVINO”

 

Fig. 11..png

Fig. 11. “double-click Object_detection_CPU.flow”

 

Fig. 12. load Object_detection_CPU.flow.png

Fig. 12. load Object_detection_CPU.flow

 

  1. Run the solution

 

Fig. 13. Run the solution.png

Fig. 13. Run the solution.

 

※Fig. 13 explanation:

After execution, the image will be continuously captured for celebrity face detection, and the detection result will be displayed in the CMD window.

※ The difference between Object_detection_MYRIAD.flow and Object_detection_CPU.flow is whether there is Intel's MYRIAD. If there is no MYRIAD, the error in Fig. 14 will appear. Object_detection_MYRIAD.flow is used in the same way as Object_detection_MYRIAD.flow, except that the difference is different in Intel hardware.

 

Fig. 14. No MYRIAD would have been wrong..png

Fig. 14. No MYRIAD would have been wrong.

 

 

  1. Chapter 4: Model_optimizer.flow ― Turn Caffe model to IR model

 

If you want to use OpenVINO to inference your own caffe model, you need to convert the caffe model to an OpenVINO-specific IR model, and change the location of the model_detection_CPU.flow to read the model to perform optimization using OpenVINO. The following is the step to convert the Caffe model to IR model.

  1. Prepare the caffemodel file and the prototxt file in the data/caffe_model folder, as shown in Fig. 15.

 

Fig. 15. older.png

Fig. 15. Caffemodel files and prototxt files placed in the Caffe_model folder.

 

  1. Load solution

“Execute R8.exe” => “File” => “Open” => “Select the OpenVINO folder under solution” => “double-click Model_optimizer.flow”, as shown in Fig. 16, Fig. 17, Fig. 18.

 

Fig. 16..png

Fig. 16. “File” => “Open”

 

Fig. 17. double-click Model_optimizer.flow.png

Fig. 17. double-click Model_optimizer.flow.

 

Fig. 18. load Model_optimizer.flow.png

Fig. 18. load Model_optimizer.flow.

 

  1. Confirm the Caffe model location you want to convert, as shown in Fig. 15, if you change the Caffe_model folder location yourself, you need to change the parameter content of Fig. 19, and if you place the Caffe_model folder as shown in Fig. 15, you do not need to change it.

 

Fig. 19. Change the folder where you put the Caffe model.png

Fig. 19. Change the folder where you put the Caffe model.

 

  1. Set the folder position of the Output IR model. The solution example is set in data/ir_model/face-recognition-celebrity-FP32. You can change the name to see if there is still a face-recognition-celebrity-FP32 folder. The parameter location is shown in Fig. 20.

 

Fig. 20. Change the folder where the IR model is stored.png

Fig. 20. Change the folder where the IR model is stored.

 

  1. Click “Run” to convert caffemodel file, as shown in Fig. 21, Fig. 22.

 

Fig. 21. Run flow file to turn caffemodel to IR model.png

Fig. 21. Run flow file to turn caffemodel to IR model.

 

Fig. 22. Store the converted IR model file in the specified folder.png

Fig. 22. Store the converted IR model file in the specified folder.

 

  1. A new labels file is added to the folder that specifies the converted IR model file, and the file name needs to match the file name of the bin file, mapping file, and XML file, as shown in Fig. 23, and the file content of the labels file is the category name (like Predefined_classes.txt),

But be sure to have 20 lines, as shown in Fig. 24.

 

Fig. 23. Add a file with an extension named labels.png

Fig. 23. Add a file with an extension named labels.

 

Fig. 24. The content of the auxiliary file named labels.png

Fig. 24. The content of the auxiliary file named labels.

 

※ Then to use your Caffe model to detect the object, simply put the “Object_detection_cpu.flow” "OpenVino_ObjectDetect_ReadNet" ObjectDetectionModel the field can be changed to the xml after the above steps (the labels file must be generated), as shown in Fig. 25.

 

Fig. 25. Set up your model file in Object_detection_CPU.flow.png

Fig. 25. Set up your model file in Object_detection_CPU.flow.


Recommended Article

1.
OpenR8 - AI Software for Everyone (Download)