You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 11, 2023. It is now read-only.
###Convert the Pytorch model to ONNX model
python export.py --weights yolov7-tiny.pt --grid --end2end --simplify --topk-all 100 --iou-thres 0.65 --conf-thres 0.35 --img-size 640 640 --max-wh 640
###Convert ONNX model to OpenVINO IR
mo --input_model yolov7-tiny.onnx --input_shape [1,3,640,640] --output_dir model_openvino/ --data_type FP32
###Convert model input shape to NHWC
python openvino2tensorflow.py --model_path model_openvino/yolov7-tiny.xml --model_output_path models-NHWC-final/ --output_saved_model --output_h5 --output_pb --output_no_quant_float32_tflite
Description
I am trying to use to convert the Pythorch version of the Yolov7-tiny model (https://github.com/WongKinYiu/yolov7) to the tflite version of the same model. If I take the conversion path PyTorch -> ONNX -> TF/TFlite the ONNX model works fine however the order of the input channels of the resulting TF model is NcHW instead of the NHWc required by TfLite. To correct the issue I am trying to use openvino2tensorflow using the conversion path PyTorch -> ONNX -> OpenVINO ->openvino2tensorflow -> TensorFlow / Tensorflow Lite. The conversion works without exceptions until i reach the openvino2tensorflow step where i use the following script:
I recommend the use of the latest tool here. No conversion errors occur and no accuracy errors are introduced. It also supports complex models such as Transformer. openvino2tensorflow is not actively maintained at this time. https://github.com/PINTO0309/onnx2tf
Issue Type
Bug
OS
Windows
OS architecture
x86_64
Programming Language
Python
Framework
TensorFlowLite
Download URL for ONNX / OpenVINO IR
pip install onnx==1.12.0
pip install onnxruntime onnxsim onnx-tf
pip install openvino-dev==2022.3.0
pip install tensorflow-intel==2.10.0
pip install tensorflow-datasets
pip install openvino2tensorflow --upgrade
Convert Script
###Download the model
wget https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-tiny.pt
###Convert the Pytorch model to ONNX model
python export.py --weights yolov7-tiny.pt --grid --end2end --simplify --topk-all 100 --iou-thres 0.65 --conf-thres 0.35 --img-size 640 640 --max-wh 640
###Convert ONNX model to OpenVINO IR
mo --input_model yolov7-tiny.onnx --input_shape [1,3,640,640] --output_dir model_openvino/ --data_type FP32
###Convert model input shape to NHWC
python openvino2tensorflow.py --model_path model_openvino/yolov7-tiny.xml --model_output_path models-NHWC-final/ --output_saved_model --output_h5 --output_pb --output_no_quant_float32_tflite
Description
I am trying to use to convert the Pythorch version of the Yolov7-tiny model (https://github.com/WongKinYiu/yolov7) to the tflite version of the same model. If I take the conversion path PyTorch -> ONNX -> TF/TFlite the ONNX model works fine however the order of the input channels of the resulting TF model is NcHW instead of the NHWc required by TfLite. To correct the issue I am trying to use openvino2tensorflow using the conversion path PyTorch -> ONNX -> OpenVINO ->openvino2tensorflow -> TensorFlow / Tensorflow Lite. The conversion works without exceptions until i reach the openvino2tensorflow step where i use the following script:
python openvino2tensorflow.py --model_path model_openvino/yolov7-tiny.xml --model_output_path models-NHWC-final/ --output_saved_model --output_h5 --output_pb --output_no_quant_float32_tflite
Relevant Log Output
Source code for simple inference testing code
The text was updated successfully, but these errors were encountered: