libkissinferencesharp 1.0.x
Kiss.Network Class Reference

This is the main class of kissinference, it allows you to load and use Kiss neural neturoks. More...

Inherits System.IDisposable.

Collaboration diagram for Kiss.Network:
Collaboration graph

Public Member Functions

delegate void ResultDlg (float[] result, Network network)
 
 Network (string path, bool verbose=false)
 Constructs a new Network object by loading a network off disk.
 
AutoResetEvent Run (Spectra spectra, ResultDlg callback)
 This method runs an inference pass on the given spectra asynchronously.
 
AutoResetEvent Run (float[] data, ResultDlg callback)
 This method runs an inference pass on the given spectra asynchronously.
 
void Dispose ()
 

Protected Member Functions

virtual void Dispose (bool disposing)
 

Properties

int InputSize [get]
 This Property holds the number of input values the loaded network expects.
 
int OutputSize [get]
 This Property holds the number of output values the loaded network expects.
 
string Purpose [get]
 This Property holds a string describeing the purpose the network was trained on.
 
string InputLabel [get]
 This Property holds a string describeing the type of input the network expects.
 
bool ComplexInput [get]
 This Property is true if the network expects a complex valued input.
 
string[] OutputLabels [get]
 This Property is an array of OutputSize with strings nameing what every output corrisponds to.
 
bool[] OutputMask [get, set]
 This Property is an array of bools enableing or disableing a given output.
 

Detailed Description

This is the main class of kissinference, it allows you to load and use Kiss neural neturoks.

Constructor & Destructor Documentation

◆ Network()

Kiss.Network.Network ( string path,
bool verbose = false )
inline

Constructs a new Network object by loading a network off disk.

Parameters
paththe path to the onnx network file to load
verboseif true is set here some extra debug information will be printed by the runtime
Exceptions
System.IO.FileLoadExceptionThrown when the network file could not be loaded
Kiss.EnviromentExceptionThrown if the enviroment is unacceptable for the operation of this libaray

References Kiss.Utils.CheckEnvThrow().

Member Function Documentation

◆ Run() [1/2]

AutoResetEvent Kiss.Network.Run ( float[] data,
ResultDlg callback )
inline

This method runs an inference pass on the given spectra asynchronously.

Parameters
dataand array of floats containing the data inference on, must be of InputSize length
callbacka delegate that will be called when inference completes, this callback will be called from a native thread in libkissiniferences thread pool
Exceptions
ArgumentExceptionThrown when the input is of an incorrect size for the network
InferenceExceptionThrown when the inference engine encounteres an internal error
Returns
The AutoResetEvent returned can be waited on to ensure that the inference is finished and the callback has been executed.

◆ Run() [2/2]

AutoResetEvent Kiss.Network.Run ( Spectra spectra,
ResultDlg callback )
inline

This method runs an inference pass on the given spectra asynchronously.

Parameters
spectrathe spectra to run inference on, must be of InputSize length
callbacka delegate that will be called when inference completes, this callback will be called from a native thread in libkissiniferences thread pool
Exceptions
ArgumentExceptionThrown when the input is of an incorrect size for the network
InferenceExceptionThrown when the inference engine encounteres an internal error
Returns
The AutoResetEvent returned can be waited on to ensure that the inference is finished and the callback has been executed.

References Kiss.Spectra.Imaginary, and Kiss.Spectra.Real.

Property Documentation

◆ InputSize

int Kiss.Network.InputSize
get

This Property holds the number of input values the loaded network expects.

For networks with a convolutional input this may be -1 designateing "Any"

◆ OutputMask

bool [] Kiss.Network.OutputMask
getset

This Property is an array of bools enableing or disableing a given output.

This Property must only be set while no inference requests are pending. Disabled outputs will set to zero, exact effect on non-disabled outputs is network depenant. For classifier networks the likelyhoods will reflect the reduction in problem space.