openvinotoolkit / open_model_zoo

Pre-trained Deep Learning models and demos (high quality and extremely fast)
https://docs.openvino.ai/latest/model_zoo.html
Apache License 2.0
4.1k stars 1.38k forks source link

Re-ID model detail #3023

Closed tingggggg closed 2 years ago

tingggggg commented 2 years ago

I want to know about https://github.com/openvinotoolkit/open_model_zoo/tree/master/models/intel/person-reidentification-retail-0288 https://github.com/openvinotoolkit/open_model_zoo/tree/master/models/intel/person-reidentification-retail-0287 ... models detail for training by myself.

Detail about use which source training code, and how to convert model to openvino format(pytorch -> onnx -> FP32.xml & .bin) ...

I train model myself with source (https://github.com/KaiyangZhou/deep-person-reid) python3 scripts/main.py --config-file configs/im_osnet_x0_25_softmax_256x128_amsgrad.yaml --transforms random_flip random_erase --root ./ test.eval_freq 10

then got the acc result after training

Computing CMC and mAP ...
** Results **
mAP: 76.8%
CMC curve
Rank-1  : 91.7%
Rank-5  : 97.1%
Rank-10 : 98.1%
Rank-20 : 98.7%
Checkpoint saved to "log/osnet_x0_25_market1501_softmax/model/model.pth.tar-180"

next step, I convert modellog/osnet_x0_25_market1501_softmax/model/model.pth.tar-180 to onnx with source code(https://github.com/openvinotoolkit/deep-object-reid) then convert to openvino format by mo.py.

cd $ROOT(https://github.com/openvinotoolkit/deep-object-reid)
python3 tools/convert_to_onnx.py --config-file configs/person/im_osnet_x0_25_softmax_256x128_amsgrad.yaml model.load_weights log/osnet_x0_25_market1501_softmax/model/model.pth.tar-180

python3 /opt/intel/openvino_2021/deployment_tools/model_optimizer/mo_onnx.py --input_model model.onnx --input_shape [1,3,256,128] --model_name myReID_FP32

After that I did Computing CMC and mAP with openvino inference engine (https://github.com/openvinotoolkit/deep-object-reid) but got the bad result.

2021-12-24_17:52:58|mAP: 0.55%
2021-12-24_17:52:58|CMC curve
2021-12-24_17:52:58|Rank-1  : 1.28%
2021-12-24_17:52:58|Rank-5  : 4.31%
2021-12-24_17:52:58|Rank-10 : 6.77%
2021-12-24_17:52:58|Rank-20 : 10.42%

Did I missing any step? I want to got the correct openvino format model like model person-reidentification-retail-0288 provided in model zoo.

thanks for help~

sovrasov commented 2 years ago

Hi @tingggggg. deep-person-reid and deep-object-reid are incompatible at the moment, so that result is expected. Try this commit from OTE: https://github.com/openvinotoolkit/training_extensions/commit/789896de22a2c99753c31c2659ee542b2cc8588e and instructions from https://github.com/openvinotoolkit/training_extensions/tree/789896de22a2c99753c31c2659ee542b2cc8588e/pytorch_toolkit/object_reidentification to train and export your model. Note that we don't support training reid models in OTE anymore.

vladimir-dudnik commented 2 years ago

closing this as answered