docstr: Create a OpenVINO model from Keras.
  
  :param model: Keras model to be converted to OpenVINO for inference or
                path to Openvino saved model.
  :param input_spec: A (tuple or list of) tf.TensorSpec or numpy array defining
                     the shape/dtype of the input
  :param precision: Global precision of model, supported type: 'fp32', 'fp16',
                    defaults to 'fp32'.
  :param thread_num: a int represents how many threads(cores) is needed for
              inference. default: None.
  :param device: A string represents the device of the inference. Default to 'CPU'.
                 'CPU', 'GPU' and 'VPUX' are supported for now.
  :param config: The config to be inputted in core.compile_model.
                 inference. default: None.
  :param logging: whether to log detailed information of model conversion.
                  default: True.
  :param shapes: input shape. For example, 'input1[1,3,224,224],input2[1,4]',
                 '[1,3,224,224]'. This parameter affect model Parameter shape, can be
                 dynamic. For dynamic dimesions use symbol `?`, `-1` or range `low.. up`.'.
                 Only valid for openvino model, otherwise will be ignored.
  :param **kwargs: will be passed to model optimizer function.
docstr_tok: ["Create","a","OpenVINO","model","from","Keras",".",":","param","model",":","Keras","model","to","be","converted","to","OpenVINO","for","inference","or","path","to","Openvino","saved","model",".",":","param","input_spec",":","A","(","tuple","or","list","of",")","tf.TensorSpec","or","numpy","array","defining","the","shape\/dtype","of","the","input",":","param","precision",":","Global","precision","of","model",",","supported","type",":","'fp32","'",",","'fp16","'",",","defaults","to","'fp32","'",".",":","param","thread_num",":","a","int","represents","how","many","threads","(","cores",")","is","needed","for","inference",".","default",":","None",".",":","param","device",":","A","string","represents","the","device","of","the","inference",".","Default","to","'CPU","'",".","'CPU","'",",","'GPU","'","and","'VPUX","'","are","supported","for","now",".",":","param","config",":","The","config","to","be","inputted","in","core.compile_model",".","inference",".","default",":","None",".",":","param","logging",":","whether","to","log","detailed","information","of","model","conversion",".","default",":","True",".",":","param","shapes",":","input","shape",".","For","example",",","'input1","[","1,3,224,224","]",",","input2","[","1,4","]","'",",","'","[","1,3,224,224","]","'",".","This","parameter","affect","model","Parameter","shape",",","can","be","dynamic",".","For","dynamic","dimesions","use","symbol","`","?","`",",","`","-1","`","or","range","`","low","..","up","`",".","'",".","Only","valid","for","openvino","model",",","otherwise","will","be","ignored",".",":","param","*","*","kwargs",":","will","be","passed","to","model","optimizer","function","."]
code: def __init__(
      self,
      model,
      input_spec=None,
      precision="fp32",
      thread_num=None,
      device="CPU",
      config=None,
      logging=True,
      shapes=None,
      **kwargs,
  ):
      """
      Create a OpenVINO model from Keras.
  
      :param model: Keras model to be converted to OpenVINO for inference or
                    path to Openvino saved model.
      :param input_spec: A (tuple or list of) tf.TensorSpec or numpy array defining
                         the shape/dtype of the input
      :param precision: Global precision of model, supported type: 'fp32', 'fp16',
                        defaults to 'fp32'.
      :param thread_num: a int represents how many threads(cores) is needed for
                  inference. default: None.
      :param device: A string represents the device of the inference. Default to 'CPU'.
                     'CPU', 'GPU' and 'VPUX' are supported for now.
      :param config: The config to be inputted in core.compile_model.
                     inference. default: None.
      :param logging: whether to log detailed information of model conversion.
                      default: True.
      :param shapes: input shape. For example, 'input1[1,3,224,224],input2[1,4]',
                     '[1,3,224,224]'. This parameter affect model Parameter shape, can be
                     dynamic. For dynamic dimesions use symbol `?`, `-1` or range `low.. up`.'.
                     Only valid for openvino model, otherwise will be ignored.
      :param **kwargs: will be passed to model optimizer function.
      """
      super().__init__()
      ov_model_path = model
      with TemporaryDirectory() as tmp_dir:
          tmp_dir = Path(tmp_dir)
          if isinstance(model, tf.keras.Model):
              self._mode = "arg"
              self._arg_names = []
              if isinstance(input_spec, dict):
                  self._arg_names = list(input_spec.keys())
                  input_spec = [
                      input_spec[name] for name in self._arg_names
                  ]
                  self._mode = "kwarg"
                  kwargs["input"] = ",".join(self._arg_names)
              try_fake_inference(model, input_spec)
              export(
                  model,
                  str(tmp_dir / "tmp.xml"),
                  precision=precision,
                  logging=logging,
                  **kwargs,
              )
              ov_model_path = tmp_dir / "tmp.xml"
          self.ov_model = OpenVINOModel(
              ov_model_path,
              device=device,
              precision=precision,
              thread_num=thread_num,
              config=config,
              shapes=shapes,
          )
  
imports: import os
  from bigdl.nano.utils.common import SafePickle
  from pathlib import Path
  from typing import Sequence, Any, Union, Dict
  from tempfile import TemporaryDirectory
  import numpy
  import tensorflow
  from bigdl.nano.utils.common import invalidInputError
  from bigdl.nano.utils.tf import try_fake_inference
  from bigdl.nano.utils.tf import convert_all, tensors_to_numpy
  from bigdl.nano.tf.model import KerasOptimizedModel
  from ..core.model import OpenVINOModel
  from ..core.utils import save
  from .utils import export
  from .dataloader import KerasOpenVINODataLoader
  from .metric import KerasOpenVINOMetric
label_desc: Use image node_id 1 to create a new KerasOpenVINOModel object from inherited base classes: KerasOptimizedModel with example: obj = KerasOpenVINOModel(model, input_spec, precision, thread_num, device, config, logging, shapes)