flame.engine.CAREInferenceSession¶
- class flame.engine.CAREInferenceSession(model_path: str, model_config_path: str, dataset_config_path: str, cpu_ok: bool = False)[source]¶
Bases:
objectClass 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.
- __init__(model_path: str, model_config_path: str, dataset_config_path: str, cpu_ok: bool = False) None[source]¶
Methods
__init__(model_path, model_config_path, ...)from_mlflow_uri(tracking_uri, run_id[, ...])inference_generator(inference_images[, ...])Will yield inferred-upon images one-by-one.
predict(arr)Assumes array input of shape NYXC.
predict_FLAME(image[, input_frames])Takes FLAMEImage Object and infers on it using the ONNX engine.
- 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.