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

Post-training Optimization Tool API Examples

DarkHorse
Employee
714 Views

Hello,

 

I am trying to run this command and I am getting error messages again

 

https://docs.openvino.ai/2022.3/pot_example_classification_README.html#doxid-pot-example-classification-r-e-a-d-m-e

 

OS: Windows 11

Python: 3.8.2

OpenVINO_2023

 

 

python3 ./classification_example.py -m <PATH_TO_IR_XML> -a <IMAGENET_ANNOTATION_FILE> -d <IMAGES_DIR>

 

And again I am getting this error messages :

 

(openvino_env) F:\openvino_env\Scripts>python classification_sample.py -m F:\IR_Models\public\mobilenet-v2-1.0-224\FP32\mobilenet-v2-1.0-224.xml -a F:\ImageNet\val.txt -d F:\ImageNet
F:\openvino_env\lib\site-packages\openvino\offline_transformations\__init__.py:10: FutureWarning: The module is private and following namespace `offline_transformations` will be removed in the future.
warnings.warn(
[ DEBUG ] Creating converter from 7 to 5
[ DEBUG ] Creating converter from 5 to 7
[ DEBUG ] Creating converter from 7 to 5
[ DEBUG ] Creating converter from 5 to 7
Post-training Optimization Tool is deprecated and will be removed in the future. Please use Neural Network Compression Framework instead: https://github.com/openvinotoolkit/nncf 
Nevergrad package could not be imported. If you are planning to use any hyperparameter optimization algo, consider installing it using pip. This implies advanced usage of the tool. Note that nevergrad is compatible only with Python 3.7+
INFO:openvino.tools.pot.pipeline.pipeline:Inference Engine version: 2023.0.1-11005-fa1c41994f3-releases/2023/0
INFO:openvino.tools.pot.pipeline.pipeline:Model Optimizer version: 2023.0.1-11005-fa1c41994f3-releases/2023/0
INFO:openvino.tools.pot.pipeline.pipeline:Post-Training Optimization Tool version: 2023.0.1-11005-fa1c41994f3-releases/2023/0
INFO:openvino.tools.pot.statistics.collector:Start computing statistics for algorithms : DefaultQuantization
INFO:openvino.tools.pot.statistics.collector:Computing statistics finished
INFO:openvino.tools.pot.pipeline.pipeline:Start algorithm: DefaultQuantization
INFO:openvino.tools.pot.algorithms.quantization.default.algorithm:Start computing statistics for algorithm : ActivationChannelAlignment
INFO:openvino.tools.pot.algorithms.quantization.default.algorithm:Computing statistics finished
INFO:openvino.tools.pot.algorithms.quantization.default.algorithm:Start computing statistics for algorithms : MinMaxQuantization,FastBiasCorrection
INFO:openvino.tools.pot.algorithms.quantization.default.algorithm:Computing statistics finished
INFO:openvino.tools.pot.pipeline.pipeline:Finished: DefaultQuantization
===========================================================================
Traceback (most recent call last):
File "classification_sample.py", line 245, in <module>
main()
File "classification_sample.py", line 232, in main
compressed_model, pipeline = optimize_model(args)
File "classification_sample.py", line 215, in optimize_model
if not args.keep_uncompressed_weights:
AttributeError: 'Namespace' object has no attribute 'keep_uncompressed_weights'

 

Any idea on this?

 

0 Kudos
3 Replies
Megat_Intel
Moderator
680 Views

Hi DarkHorse,

Thank you for reaching out to us.

 

For your information, I received the same error message " AttributeError: 'Namespace' object has no attribute 'keep_uncompressed_weights' " when running the Quantizing Image Classification Model. From the error message, the error occurs in line 215 during model weights compression.

 

We have informed the relevant team regarding this issue and we'll provide an update once we receive any confirmation.

 

On the other hand, it is mentioned in the code that the step that was causing the error is optional. I remove the model compression step in the classification_sample.py code and was able to run the image classification model quantization. I show my results here:

 

Code Snippet:

 code_snippet.png

 

Quantization Results:

 pot_result.png

 

On the other hand, I ran the OpenVINO™ Benchmark Tool and Classification Python Demo for both the original model (mobilenet-v2-1.0-224) and the quantized model (TensorFlow_Frontend_IR) to compare the results. I share them below:

 

Benchmark Tool:

  • mobilenet-v2-1.0-224:

 original_model.png

 

  • TensorFlow_Frontend_IR:

 quantized_model.png

 

Classification Python Demo:

  • mobilenet-v2-1.0-224:

 demo result original .png

 

  • TensorFlow_Frontend_IR:

 demo result quantized.png

 

 

Regards,

Megat

 

0 Kudos
Megat_Intel
Moderator
581 Views

Hi DarkHorse,

Thank you for sharing your findings on the error.

 

For your information, this issue has been fixed by the Development Team. You can check out the latest Quantizing Image Classification Model, by git pull the latest OpenVINO™ Toolkit master branch.

 

 

Regards,

Megat


0 Kudos
Megat_Intel
Moderator
558 Views

Hi DarkHorse,

This thread will no longer be monitored since we have provided a suggestion. If you need any additional information from Intel, please submit a new question.

 

 

Regards,

Megat


0 Kudos
Reply