Search code examples
pythonmovidiusquantization-aware-training

How to retrain a detection model and quantize it for Intel Movidius?


I want to retrain an existing object detection model with a new image dataset and quantize it for Intel Movidius. Is there any working procedure to do this?

I have successfully retrained the model but failing to quantize it. I have followed the following tutorial Retrain SSD MobileNet


Solution

  • The Movidius devices only support FP16 models, and to convert a caffe version of SSD Mobilenet then you supply the "--data_type FP16"to the model optimizer (mo.py) The openvino model zoo has a mobilenet-ssd model,also using caffe, and the associated yaml file has the following parameters model_optimizer_args:

    • --input_shape=[1,3,300,300]
    • --input=data
    • --mean_values=data[127.5,127.5,127.5]
    • --scale_values=data[127.5]
    • --output=detection_out
    • --input_model=$dl_dir/mobilenet-ssd.caffemodel
    • --input_proto=$dl_dir/mobilenet-ssd.prototxt.

    Note that your input shape and the mean and scale values will likely be different so change those to match your retrained model.

    There's also a demo file shipped with that can be used with your converted model. See the associated mode.lst file for all the supported architectures. https://github.com/openvinotoolkit/open_model_zoo/tree/master/demos/object_detection_demo/python