openvinotoolkit / training_extensions

Train, Evaluate, Optimize, Deploy Computer Vision Models via OpenVINO™
https://openvinotoolkit.github.io/training_extensions/
Apache License 2.0
1.14k stars 443 forks source link

Convert a REID model to Onnx. #499

Closed sradmard closed 3 years ago

sradmard commented 3 years ago

Hi, I would like to convert one of the pre-trained person-reid models for example person-reidentification-retail-0270 into .onnx format. I have downloaded a snapshot of the pre-trained weights from here. I run the following command to convert the model to .onnx based on the instructions: python ../../../../external/deep-object-reid/tools/convert_to_onnx.py --config person-reidentification-retail-0270.yaml --output-name PersonREID_Test.onnx model.load_weights ~/Downloads/person-reidentification-retail-0270.pt However, I get the following error: raise KeyError("Non-existent config key: {}".format(full_key)) KeyError: 'Non-existent config key: train.warmup_factor_base'

I would really appreciate any help on that to be able to convert the .pt model into onnx.

sovrasov commented 3 years ago

Hi. Looks like you're using an outdated version of this repo. This issue was resolved in #439. Configs for reid models don't contain train.warmup_factor_base key anymore.

sradmard commented 3 years ago

@sovrasov thank you so much for your quick response. I was able to resolve that error following your advice. Now I am getting the following error while running the previous script to convert the person-reidentification-retail-0270 model with its pretrained .pt weights to onnx:

File "../../../../../external/deep-object-reid/tools/convert_to_onnx.py", line 36, in group_norm_symbolic channels_num = input.type().sizes()[1] TypeError: 'NoneType' object is not subscriptable (Occurred when translating group_norm).

Do I need to set up both datasets Market-1501, and MSMT17 for it? Or am I missing something else?

sovrasov commented 3 years ago

I can't reproduce this issue. Do you work on virtualenv built using this script? Also please check that you have the latest version of the deep-object-reid submodule.

To convert a model you don't need to download any datasets.