Quantizing Cascaded Face detection Model¶
This example demonstrates the use of the Post-training Optimization Tool API for the task of quantizing a face detection model.
The MTCNN model from Caffe is used for this purpose.
DataLoader is created to load the WIDER FACE dataset for a face detection task
and the implementation of Recall metric is used for the model evaluation. In addition, this example demonstrates how one can implement
an engine to infer a cascaded (composite) model that is represented by multiple submodels in an OpenVINO™ Intermediate Representation (IR)
and has a complex staged inference pipeline. The code of the example is available on GitHub.
How to Prepare the Data¶
To run this example, you need to download the validation part of the Wider Face dataset http://shuoyang1213.me/WIDERFACE/.
Images with faces divided into categories are placed in the
Annotations in .txt format containing the coordinates of the face bounding boxes of the
validation part of the dataset can be downloaded separately and are located in the
How to Run the Example¶
Launch Model Downloader tool to download
mtcnnmodel from the Open Model Zoo repository.
omz_downloader --name mtcnn*
Launch Model Converter tool to generate Intermediate Representation (IR) files for the model:
omz_converter --name mtcnn* --mo <PATH_TO_MODEL_OPTIMIZER>/mo.py
Launch the example script from the example directory:
python3 ./face_detection_example.py -pm <PATH_TO_IR_XML_OF_PNET_MODEL> -rm <PATH_TO_IR_XML_OF_RNET_MODEL> -om <PATH_TO_IR_XML_OF_ONET_MODEL> -d <WIDER_val/images> -a <wider_face_split/wider_face_val_bbx_gt.txt>
Optional: you can specify .bin files of corresponding IRs directly using the