MCPcopy
hub / github.com/ultralytics/yolov5 / export_openvino

Function export_openvino

export.py:189–200  ·  view source on GitHub ↗
(file, metadata, half, prefix=colorstr('OpenVINO:'))

Source from the content-addressed store, hash-verified

187
188@try_export
189def export_openvino(file, metadata, half, prefix=colorstr('OpenVINO:')):
190 # YOLOv5 OpenVINO export
191 check_requirements('openvino-dev') # requires openvino-dev: https://pypi.org/project/openvino-dev/
192 import openvino.inference_engine as ie
193
194 LOGGER.info(f'\n{prefix} starting export with openvino {ie.__version__}...')
195 f = str(file).replace('.pt', f'_openvino_model{os.sep}')
196
197 cmd = f"mo --input_model {file.with_suffix('.onnx')} --output_dir {f} --data_type {'FP16' if half else 'FP32'}"
198 subprocess.run(cmd.split(), check=True, env=os.environ) # export
199 yaml_save(Path(f) / file.with_suffix('.yaml').name, metadata) # add metadata.yaml
200 return f, None
201
202
203@try_export

Callers 1

runFunction · 0.85

Calls 5

colorstrFunction · 0.90
check_requirementsFunction · 0.90
yaml_saveFunction · 0.90
infoMethod · 0.80
runMethod · 0.80

Tested by

no test coverage detected