-
-
Notifications
You must be signed in to change notification settings - Fork 38
Size discrepancy in conversion #138
Description
Issue Type
Performance
OS
Windows
OS architecture
x86_64
Programming Language
Python
Framework
TensorFlow
Download URL for ONNX / OpenVINO IR
https://drive.google.com/drive/folders/1Di7vhQfd-5DLGDUSII1_NxLvEvs2fXpI?usp=sharing
Convert Script
Conversion was performed on the model.xml OpenVino model (included in the Drive directory above) with the unchanged openvino2tensorflow.py script (commit hash 63fff40). I tested both on the Docker and on a local clone of the repository and the same issue was observed.
python openvino2tensorflow.py --model_path C:\dev\openvino_model\model.xml --output_weight_and_json --model_output_path C:\dev\converted_model
Description
While converting an OpenVino model to Tensorflow (in json architecture + h5 weights format) it was observed that the size of the resulting files (namely the json file) was much larger than the original model in OpenVino format. More precisely, the original OpenVino bin file was 254MB in size, while the resulting json was 1394MB and the resulting h5 weights file was 205MB in size.
All models are included in the Google Drive folder shared above, including the original ONNX model (can also be downloaded in its original form from https://drive.google.com/file/d/1Gh8C-bwl2B90RDrvKJkXafvZC3q4_H_z/view?usp=sharing). The conversion to OpenVino was performed using OpenVino 2021.4.1, with all the details consultable in the metadata section of the xml file.
We noticed that the resulting architecture file has a lot of numeric values in it, whereas a normal json architecture file only has info about the tensors and how they are connected to form the full model scheme. Not sure if this helps in any way to pinpoint the issue.
Also of note that the number of parameters in the model is consistent when loading the converted model in Python using load_model, which seems to indicate that the architecture and the weights are consistent but, for some reason, occupy a lot more space in disk. Also, the models take a long time to load in Python and timeout Netron visualization.
If you need any more details just let me know and thanks in advance!
Relevant Log Output
The logs were too large to include, just attached them in the description.
Source code for simple inference testing code
Just run the conversion script pointing to model.xml and it should output the large json + similar sized h5 weights file.