![]() |
ImFusion C++ SDK 4.5.0
|
#include <OnnxRuntimePlugin/Include/ImFusion/OnnxRuntime/OnnxEngine.h>
Main wrapper around a Onnx neural network performing a prediction on an image. More...
Main wrapper around a Onnx neural network performing a prediction on an image.
Public Member Functions | |
| OnnxEngine (const Properties &properties) | |
| ML::DataItem | predict (const ML::DataItem &input) override |
| Compute predictons of all classes for multiple images. | |
| std::vector< ML::ExecutionProvider > | availableProviders () const override |
| Returns which provider is supported by the engine and available on the host. | |
| std::optional< ML::ExecutionProvider > | provider () const override |
| Returns which provider is used by the engine to run the model. | |
| Public Member Functions inherited from ImFusion::ML::Engine | |
| Engine (const std::string &name) | |
| std::string | name () const |
| Returns the name of the operation as defined in the factories. | |
| virtual void | configure (const Properties *properties) override |
| Configure the Engine according to the properties. | |
| virtual void | configuration (Properties *properties) const override |
| Serialize the current object configuration into the given Properties object. | |
| virtual bool | isIdentical (const Engine *other) const |
| Check whether this engine instance is the same as other. | |
| virtual void | checkInputFields (const DataItem &input) |
| Check that inputs specified in the config are present in the input item. | |
| virtual void | checkOutputFields (const DataItem &input) |
| Check that outputs specified in the config are present in the predicted item. | |
| std::optional< ByteBuffer > | loadModelArtifact () const |
| Convenience function to load the model artifact specified in p_modelFile either from the model file or from a resource repository. | |
| Public Member Functions inherited from ImFusion::Configurable | |
| virtual void | configureDefaults () |
| Retrieve the properties of this object, replaces values with their defaults and sets it again. | |
| void | registerParameter (ParameterBase *param) |
| Register the given Parameter or SubProperty, so that it will be configured during configure()/configuration(). | |
| void | unregisterParameter (const ParameterBase *param) |
| Remove the given Parameter or SubProperty from the list of registered parameters. | |
| Configurable (const Configurable &rhs) | |
| Configurable (Configurable &&rhs) noexcept | |
| Configurable & | operator= (const Configurable &) |
| Configurable & | operator= (Configurable &&) noexcept |
Protected Member Functions | |
| bool | loadModel () |
| Load model architecture and weights from file, and return whether it was successful This method has to be called before any prediction. | |
| void | onModelFileChanged () override |
| Function that gets called when the model file of the engine changes. | |
| void | onForceCPUChanged () override |
| Function that gets called when the forceCPU flag of the engine changes. | |
| Protected Member Functions inherited from ImFusion::ML::Engine | |
| virtual void | init (const Properties &properties) |
| Configures the engine from properties + connect signals. | |
| void | logInputToDataLogger (const DataItem &input) const |
Sends all SISBasedElement inputs to the Data Logger when p_logInputToDataLogger is enabled. | |
| virtual void | connectSignals () |
| Connect the signals like onModelFileChanged, onForceCPUChanged, ... (We do not do this automatically because children class need to call this after they register their parameters). | |
Additional Inherited Members | |
| Static Public Member Functions inherited from ImFusion::ML::Engine | |
| static std::vector< std::string > | availableEngines (EngineLanguage language=EngineLanguage::Any) |
| List all registered inference engines for a given implementation language. | |
| static bool | isRegistered (const std::string &engineName, bool quiet=true, EngineLanguage language=EngineLanguage::Any) |
| Check if an engine is registered for the selected implementation language. | |
| static std::unique_ptr< Engine > | create (const std::string &engineName, const Properties &properties, EngineLanguage language=EngineLanguage::Any) |
| Factory function to create an engine for the selected implementation language. | |
| Public Attributes inherited from ImFusion::ML::Engine | |
| Parameter< std::string > | p_modelFile = {"ModelFile", "", nullptr} |
| Parameters shared by all engines. | |
| Parameter< bool > | p_forceCPU = {"ForceCPU", false, nullptr} |
| Whether to force run on CPU even if GPU is present. | |
| Parameter< std::vector< std::string > > | p_inputFields = {"EngineInputFields", std::vector<std::string>{}, nullptr} |
| Input field names expected by the model run by the engine. | |
| Parameter< std::vector< std::string > > | p_outputFields = {"EngineOutputFields", std::vector<std::string>{}, nullptr} |
| Output field names returned by the model run by the engine. | |
| Parameter< std::vector< std::string > > | p_ignoreOutputFields = {"EngineOutputFieldsToIgnore", std::vector<std::string>{}, nullptr} |
| Output field names to be ignored by the engine. | |
| Parameter< std::string > | p_version = {"Version", "", nullptr} |
| Version of the engine used to train and save the model. | |
| Parameter< bool > | p_logInputToDataLogger = {"LogInputToDataLogger", false, this} |
When true, each engine input SharedImageSet is sent to the Data Logger. | |
| Public Attributes inherited from ImFusion::Configurable | |
| Signal | signalParametersChanged |
| Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted. | |
| Protected Attributes inherited from ImFusion::ML::Engine | |
| EngineConfiguration | m_config |
| Configuration object. | |
| std::string | m_name = "" |
| Name of the engine interface (e.g. "torch"). | |
| Protected Attributes inherited from ImFusion::Configurable | |
| std::vector< Param > | m_params |
| List of all registered Parameter and SubProperty instances. | |
|
overridevirtual |
Compute predictons of all classes for multiple images.
Implements ImFusion::ML::Engine.
|
overridevirtual |
Returns which provider is supported by the engine and available on the host.
Implements ImFusion::ML::Engine.
|
overridevirtual |
Returns which provider is used by the engine to run the model.
Implements ImFusion::ML::Engine.
|
overrideprotectedvirtual |
Function that gets called when the model file of the engine changes.
Reimplemented from ImFusion::ML::Engine.
|
overrideprotectedvirtual |
Function that gets called when the forceCPU flag of the engine changes.
Reimplemented from ImFusion::ML::Engine.