flame.engine

Classes

CAREInferenceSession(model_path, ...[, cpu_ok])

Class CAREInference Session

class flame.engine.CAREInferenceSession(model_path: str, model_config_path: str, dataset_config_path: str, cpu_ok: bool = False)[source]

Class CAREInference Session

Attributes

loggerlogging.Logger

Logger for the inference engine

execution_providerslist[str]

List of available execution providers for onnxruntime session for the inference engine

model_configDict

Model configuration information loaded from provided path

dataset_configDict

Dataset configuration information loaded from provided path

input_namestr

Name of the input layer in the ONNX/TRT engine

input_shapetuple

Shape of the input tensor to the ONNX/TRT engine

input_dtype

Data types of the input tensor to the ONNX/TRT engine

inferenceSessiononnxruntime.InferenceSession

onnxruntime InferenceSession object

from_mlflowbool

Whether the CAREInferenceSession is loaded from an FLFlow run.

mlflow_tracking_uristr

The MLFlow tracking URI mapping to the MLFlow tracking server used to initialize the CAREInferenceSession object.

mlflow_run_idstr

The MLFlow run ID corresponding to the MLFlow run used to initialized the CAREInferenceSession object.

mlflow_run_namestr

The name of the MLFlow run used to initialize the CAREInferenceSession object.

inference_generator(inference_images: list[FLAMEImage | numpy.typing.NDArray], FLAMEImage_input_frames: int | None = None)[source]

Will yield inferred-upon images one-by-one. Assumes 1-99 pcttile normalization.

predict(arr: numpy.typing.NDArray.typing.Any) numpy.typing.NDArray[source]

Assumes array input of shape NYXC. Will break Y and X dimension into patches necessary for inference by the ONNX model in this inference session.

Args:
  • arr: numpy ndarray of shape NYXC

Returns: Denoised image of shape NYXC

predict_FLAME(image: FLAMEImage, input_frames: int | None = None) numpy.typing.NDArray[source]

Takes FLAMEImage Object and infers on it using the ONNX engine. Will attempt to dynamically detect FLAMEImage dimensions (ZFCYX, CYX, etc…) and return corresponding denoised image.

Args:
  • image (FLAMEImage): The FLAMEImage object to be denoised

  • input_frames (int): The number of frames to input into the denoising model. If none are provided,

    then all available frames will be used.

Returns: Numpy NDArray with denoised FLAMEImage data. Will match dimensions of input FLAMEImage.