Add rt info for OpenVINO ModelAPI (#2891)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: Ayush Chaurasia <ayush.chaurarsia@gmail.com>
single_channel
Zlobin Vladimir 1 year ago committed by GitHub
parent a7c249e9c1
commit 01273c5ca1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -362,6 +362,18 @@ class Exporter:
model_name=self.pretty_name, model_name=self.pretty_name,
framework='onnx', framework='onnx',
compress_to_fp16=self.args.half) # export compress_to_fp16=self.args.half) # export
# Set RT info
ov_model.set_rt_info('YOLOv8', ['model_info', 'model_type'])
ov_model.set_rt_info(True, ['model_info', 'reverse_input_channels'])
ov_model.set_rt_info(114, ['model_info', 'pad_value'])
ov_model.set_rt_info([255.0], ['model_info', 'scale_values'])
ov_model.set_rt_info(self.args.iou, ['model_info', 'iou_threshold'])
ov_model.set_rt_info([v.replace(' ', '_') for k, v in sorted(self.model.names.items())],
['model_info', 'labels'])
if self.model.task != 'classify':
ov_model.set_rt_info('fit_to_window_letterbox', ['model_info', 'resize_type'])
ov.serialize(ov_model, f_ov) # save ov.serialize(ov_model, f_ov) # save
yaml_save(Path(f) / 'metadata.yaml', self.metadata) # add metadata.yaml yaml_save(Path(f) / 'metadata.yaml', self.metadata) # add metadata.yaml
return f, None return f, None

Loading…
Cancel
Save