model package

Submodules

deploy

edgeimpulse.model.deploy(
		model: Union[pathlib.Path, strbytes, Any],
		model_output_type: Union[edgeimpulse.model.output_type.Classification, edgeimpulse.model.output_type.Regression, edgeimpulse.model.output_type.ObjectDetection],
		model_input_type: Union[edgeimpulse.model.input_type.ImageInput, edgeimpulse.model.input_type.AudioInput, edgeimpulse.model.input_type.TimeSeriesInput, edgeimpulse.model.input_type.OtherInput, None] = None,
		representative_data_for_quantization: Union[pathlib.Path, strbytes, Any, None= None,
		deploy_model_type: Optional[str= None,
		engine: str = 'tflite',
		deploy_target: str = 'zip',
		output_directory: Optional[str= None,
		api_key: Optional[str= None,
		timeout_sec: Optional[float= None
)> _io.BytesIO

Transform a machine learning model into a library for an edge device.

Transforms a trained model into a library, package, or firmware ready to deploy on an embedded device. Can optionally apply post-training quantization if a representative data sample is uploaded.

Supported model formats:

  • Keras Model instance <https://www.tensorflow.org/api_docs/python/tf/keras/Model>_

  • TensorFlow SavedModel <https://www.tensorflow.org/guide/saved_model>_ (as path to directory or .zip file)

  • ONNX model file <https://learn.microsoft.com/en-us/windows/ai/windows-ml/get-onnx-model>_ (as path to .onnx file)

  • TensorFlow Lite file <https://www.tensorflow.org/lite/guide>_ (as bytes, or path to any file that is not .zip or .onnx)

Representative data for quantization:

  • Must be a numpy array or .npy file.

  • Each element must have the same shape as your model's input.

  • Must be representative of the range (maximum and minimum) of values in your training data.

Note: the available deployment options will change depending on the values given for model, model_output_type, and model_input_type. For example, the openmv deployment option is only available if model_input_type is set to ImageInput. If you attempt to deploy to an unavailable target, you will receive the error Could not deploy: deploy_target: ....

Parameters

  • model: Union[pathlib.Path, str, bytes, Any]

  • model_output_type: Union[edgeimpulse.model.output_type.Classification, edgeimpulse.model.output_type.Regression, edgeimpulse.model.output_type.ObjectDetection]

  • model_input_type: Union[edgeimpulse.model.input_type.ImageInput, edgeimpulse.model.input_type.AudioInput, edgeimpulse.model.input_type.TimeSeriesInput, edgeimpulse.model.input_type.OtherInput, None] = None

  • representative_data_for_quantization: Union[pathlib.Path, str, bytes, Any, None] = None

  • deploy_model_type: Optional[str] = None

  • engine: str = 'tflite'

  • deploy_target: str = 'zip'

  • output_directory: Optional[str] = None

  • api_key: Optional[str] = None

  • timeout_sec: Optional[float] = None

Return

_io.BytesIO

list_deployment_targets

edgeimpulse.model.list_deployment_targets(
		api_key: Optional[str= None
)> List[str]

List suitable deployment targets for the project associated with configured or provided api key.

Parameters

  • api_key: Optional[str] = None

Return

List[str]

list_engines

edgeimpulse.model.list_engines(
		
)> List[str]

List all the engines that can be passed to deploy()'s engine parameter.

Returns: List[str]: List of engines

Return

List[str]