Unverified 提交 27911dc8 authored 作者: xylieong's avatar xylieong 提交者: GitHub

OpenVINO metadata fix2 (#7954)

* Bug Fixed: OpenVINO metadata * Bug Fixed: OpenVINO metadata * Update export.py * Update export.py Co-authored-by: 's avatarGlenn Jocher <glenn.jocher@ultralytics.com>
上级 0dd66e2d
...@@ -180,7 +180,7 @@ def export_openvino(model, file, half, prefix=colorstr('OpenVINO:')): ...@@ -180,7 +180,7 @@ def export_openvino(model, file, half, prefix=colorstr('OpenVINO:')):
cmd = f"mo --input_model {file.with_suffix('.onnx')} --output_dir {f} --data_type {'FP16' if half else 'FP32'}" cmd = f"mo --input_model {file.with_suffix('.onnx')} --output_dir {f} --data_type {'FP16' if half else 'FP32'}"
subprocess.check_output(cmd.split()) # export subprocess.check_output(cmd.split()) # export
with open(Path(f) / file.with_suffix('.yaml'), 'w') as g: with open(Path(f) / file.with_suffix('.yaml').name, 'w') as g:
yaml.dump({'stride': int(max(model.stride)), 'names': model.names}, g) # add metadata.yaml yaml.dump({'stride': int(max(model.stride)), 'names': model.names}, g) # add metadata.yaml
LOGGER.info(f'{prefix} export success, saved as {f} ({file_size(f):.1f} MB)') LOGGER.info(f'{prefix} export success, saved as {f} ({file_size(f):.1f} MB)')
......
...@@ -368,7 +368,7 @@ class DetectMultiBackend(nn.Module): ...@@ -368,7 +368,7 @@ class DetectMultiBackend(nn.Module):
network = ie.read_model(model=w, weights=Path(w).with_suffix('.bin')) network = ie.read_model(model=w, weights=Path(w).with_suffix('.bin'))
executable_network = ie.compile_model(model=network, device_name="CPU") executable_network = ie.compile_model(model=network, device_name="CPU")
output_layer = next(iter(executable_network.outputs)) output_layer = next(iter(executable_network.outputs))
meta = w.with_suffix('.yaml') meta = Path(w).with_suffix('.yaml')
if meta.exists(): if meta.exists():
stride, names = self._load_metadata(meta) # load metadata stride, names = self._load_metadata(meta) # load metadata
elif engine: # TensorRT elif engine: # TensorRT
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论