sima.mini_pipeline_base

Attributes

logger

Classes

MLSoCSession

A class for interacting with the MLSoC for model inference.

Functions

process_pipeline_tar(tar_file,Β pipeline,Β modelname)

Extracts a tar.gz file, processes it, and moves specific files to a target directory.

Module Contents

sima.mini_pipeline_base.logger
sima.mini_pipeline_base.process_pipeline_tar(tar_file, pipeline, modelname)

Extracts a tar.gz file, processes it, and moves specific files to a target directory.

Parameters:
  • tar_file (str) – Path to the tar.gz file.

  • pipeline (str) – Name of the application

  • modelname (str) – Name of the MLSocSession:Model

Raises:
  • FileNotFoundError – If the tar.gz file is not found.

  • ValueError – If required files (.lm or .elf, and a valid .json) are not found in the archive.

  • RuntimeError – If any error occurs during extraction or file processing.

class sima.mini_pipeline_base.MLSoCSession(model_file: str, pipeline: str, frame_width: int, frame_height: int, session_name: str = 'model1', ev_preproc=True)

A class for interacting with the MLSoC for model inference.

pipeline
session_name = 'model1'
session_id = '_________Pipeline: Uninferable| Model: model1_________'
ev_preproc = True
parser_obj
model_file
tensor_shapes
create_plugin(plugin_class)
configure(model_external_params) bool

Configures EV74, MLA components with external model parameters

Parameters:

model_external_params (dict) – A dictionary containing external parameters for configuring the model and related components.

a65_preprocess(in_frame: numpy.ndarray) numpy.ndarray
preprocess(in_frame: numpy.ndarray) numpy.ndarray

Preprocesses the input frame for model inference based on the EV74 configuration

Parameters:

in_frame (np.ndarray) – The input frame as a NumPy array.

Returns:

The preprocessed frame ready for model inference.

Return type:

np.ndarray

run_model(frame: numpy.ndarray) numpy.ndarray | List[numpy.ndarray]

Runs the model inference (Preprocess, MLA, and Postprocess) on a given frame.

For the following models, the output is from SimaBoxDecode:

  • centernet

  • yolo

  • detr

  • effdet

Parameters:

frame (np.ndarray) – Input frame as a NumPy array.

Returns:

The output tensor after running the model and applying the appropriate postprocessing.
  • For the models mentioned above, the output is from SimaBoxDecode containing bounding boxes.

  • For other models, the output is from Detess Dequant.

Return type:

np.ndarray

set_log_level(level: spy.logger.LogLevel)
get_configs()
get_inference_resolution()
release()