eVision Python API
Loading...
Searching...
No Matches
eVision.EasyDeepLearning.EDeepLearningTool Class Reference

eVision.EasyDeepLearning.EDeepLearningTool represents the common operations of deep learning tools. More...

Inheritance diagram for eVision.EasyDeepLearning.EDeepLearningTool:

Public Member Functions

None Load (self, str filePath)
 Loads a deep learning tool.
None Load (self, eVision.ESerializer|None serializer)
 Loads a deep learning tool.
eVision.EasyDeepLearning.EDeepLearningTool|None Clone (self)
 Clones this tool.
None Save (self, str filePath, bool includeTrainingModel)
 Saves the settings, inference and training model of the deep learning tool.
None Save (self, str filePath)
 Saves the settings, inference and training model of the deep learning tool.
None Save (self, eVision.ESerializer|None serializer, bool includeTrainingModel)
 Saves the settings, inference and training model of the deep learning tool.
None Save (self, eVision.ESerializer|None serializer)
 Saves the settings, inference and training model of the deep learning tool.
None SerializeSettings (self, eVision.ESerializer|None serializer)
 Serializes the tool settings.
None SerializeInferenceModel (self, eVision.ESerializer|None serializer)
 Serializes the inference model of the tool.
None SerializeTrainingModel (self, eVision.ESerializer|None serializer)
 Serializes the training model of the tool.
None SaveSettings (self, str filePath)
 Saves the settings of the tool to a file.
None SaveInferenceModel (self, str filePath)
 Saves the tool's inference model to a file.
None SaveTrainingModel (self, str filePath)
 Saves the tool's training model to a file.
None LoadSettings (self, str filePath)
 Loads the settings of a tool.
None LoadInferenceModel (self, str filePath)
 Loads the tool's inference model.
None LoadTrainingModel (self, str filePath)
 Loads the tool's training model.
None UnloadInferenceModel (self)
 Unloads the inference model.
None UnloadTrainingModel (self)
 Unloads the training model.
None UnloadModels (self)
 Unloads the inference and training model.
bool HasInferenceModel (self)
 Whether the inference model is loaded or created when the tool is not yet trained.
bool HasTrainingModel (self)
 Whether the training model is loaded or created when the tool is not yet trained.
bool IsTrained (self)
 Tells whether the deep learning tool has been trained.
str GetAvailableDeviceName (self, int i)
 Name of the i-th device of the current engine.
eVision.EasyDeepLearning.EDeepLearningDevice GetAvailableDevice (self, int i)
 i-th eVision.EasyDeepLearning.EDeepLearningDevice of the current engine.
None SetActiveDevice (self, eVision.EasyDeepLearning.EDeepLearningDevice device)
 Sets the device with which to run or train the model.
eVision.EasyDeepLearning.EDeepLearningDevice GetActiveDevice (self, int i)
 Gets the active device.
eVision.EasyDeepLearning.EDeepLearningDevice GetActiveDevice (self)
 Gets the active device.
bool HasEngineSetupData (self)
 Whether the inference model has engine setup data.
None ClearEngineSetupData (self)
 Clears the engine data saved in the inference model.
bool IsTraining (self)
 Indicates whether the object is currently training.
int WaitForTrainingCompletion (self, int timeout)
 Waits until the training is complete or the timeout is expired.
int WaitForTrainingCompletion (self)
 Waits until the training is complete or the timeout is expired.
int WaitForIterationCompletion (self)
 Waits until an iteration is complete.
int StopTraining (self, bool wait)
 Stops training and returns the last completed iteration.
None SetLearningRate (self, eVision.EasyDeepLearning.EDeepLearningLearningRateType type, list[float] parameters)
 Specifies how the value of the learning rate and how it evolves during training.
None InitializeInference (self, int width, int height, eVision.EImageType imageType, int numImages)
 Initializes the neural network for inference (i.e.
None InitializeInference (self, eVision.EBaseROI img)
 Initializes the neural network for inference (i.e.
None InitializeInference (self, list[eVision._eVision.EBaseROI|None] imgList)
 Initializes the neural network for inference (i.e.
str GetLabel (self, int index)
 Gets the label from its index.
None SetLabel (self, int index, str label)
 Changes a label predicted by the tool.
None SetLabelWeight (self, int index, float weight)
 Sets the label weight.
float GetLabelWeight (self, int index)
 Gets the label weight.
None SetLabelColor (self, int index, eVision.ERGBColor c)
 Changes a label color.
eVision.ERGBColor GetLabelColor (self, int index)
 Label color.
None SetLabelOpacity (self, int index, int opacity)
 Changes a label opacity (between 0 for fully transparent and 255 for opaque color).
int GetLabelOpacity (self, int index)
 Gets the label opacity (between 0 for fully transparent and 255 for opaque color).
int GetOptimalNumImagesForBatchSize (self, eVision.EBaseROI sampleImage)
 Optimal number of images to process together for inference given the batch size and eVision.EasyDeepLearning.EDeepLearningTool.GetNumPatchesForImage.
int GetOptimalNumImagesForBatchSize (self, int imageWidth, int imageHeight)
 Optimal number of images to process together for inference given the batch size and eVision.EasyDeepLearning.EDeepLearningTool.GetNumPatchesForImage.
int GetNumPatchesForImage (self, eVision.EBaseROI sampleImage)
 Number of patches that will be extracted from an input image to perform inference.
int GetNumPatchesForImage (self, int imageWidth, int imageHeight)
 Number of patches that will be extracted from an input image to perform inference.
None Clean (self)
 Reset the engine and clean CPU and GPU memory allocated for running the model.
eVision.EasyDeepLearning.EDeepLearningToolType ToolType (self)
 Type of the deep learning tool.
bool EnableGPU (self)
 Enable the use of a GPU for training and inference of the deep learning tool.
 EnableGPU (self, bool value)
 Enable the use of a GPU for training and inference of the deep learning tool.
list[int] GPUIndexes (self)
 Indexes of the GPUs to use for computations.
 GPUIndexes (self, list[int] value)
 Indexes of the GPUs to use for computations.
int NumGPUs (self)
 Number of detected NVIDIA GPU.
str Engine (self)
 Sets the engine with which to execute or train the neural network.
 Engine (self, str value)
 Sets the engine with which to execute or train the neural network.
eVision.EasyDeepLearning.EDeepLearningInferencePrecision InferencePrecision (self)
 Inference precision.
 InferencePrecision (self, eVision.EasyDeepLearning.EDeepLearningInferencePrecision value)
 Inference precision.
int NumAvailableDevices (self)
 Available devices for the current eVision.EasyDeepLearning.EDeepLearningTool.Engine.
list[eVision._eVision.EasyDeepLearning.EDeepLearningDevice] AvailableDevices (self)
 Get all available device for the current engine.
int NumActiveDevices (self)
 Gets the number of devices with which to run or train the model.
list[eVision._eVision.EasyDeepLearning.EDeepLearningDevice] ActiveDevices (self)
 Devices with which to run or train the model.
 ActiveDevices (self, list[eVision._eVision.EasyDeepLearning.EDeepLearningDevice] value)
 Devices with which to run or train the model.
eVision.EasyDeepLearning.EDeepLearningExecutionSettings ExecutionSettings (self)
 Execution settings of the tool (engine, device(s), inference precision, batch size settings).
 ExecutionSettings (self, eVision.EasyDeepLearning.EDeepLearningExecutionSettings value)
 Execution settings of the tool (engine, device(s), inference precision, batch size settings).
eVision.EasyDeepLearning.EDeepLearningDevice EngineSetupDataDevice (self)
 Device corresponding to the engine data contained in the tool.
eVision.EasyDeepLearning.EDeepLearningInferencePrecision EngineSetupDataInferencePrecision (self)
 Inference precision corresponding to the engine data contained in the tool.
int EngineSetupDataBatchSize (self)
 Batch size corresponding to the engine data contained in the tool.
bool OptimizeBatchSize (self)
 Indicates whether to optimize the batch size (see eVision.EasyDeepLearning.EDeepLearningTool.BatchSize) to maximize the training and inference speed according to the engine, the device and the available memory.
 OptimizeBatchSize (self, bool value)
 Indicates whether to optimize the batch size (see eVision.EasyDeepLearning.EDeepLearningTool.BatchSize) to maximize the training and inference speed according to the engine, the device and the available memory.
int BatchSizeForMaximumInferenceSpeed (self)
 Computes the batch size that will maximize the inference speed on NVIDIA GPU.
int BatchSize (self)
 Batch size.
 BatchSize (self, int value)
 Batch size.
float CurrentTrainingProgression (self)
 Current training progression as a percentage (between 0 and 1).
int CurrentTrainingFinishedIterations (self)
 Number of iterations that are already finished in the current training.
int CurrentTrainingNumIterations (self)
 Total number of training iterations that will be performed during the current training of the deep learning tool.
int NumTrainedIterations (self)
 Number of iterations that were performed to train this deep learning tool.
int BestIteration (self)
 Iteration at which the minimum validation error was reached.
int ImageCacheSize (self)
 Size in byte of the image cache.
 ImageCacheSize (self, int value)
 Size in byte of the image cache.
str Path (self)
 Path of the tool when loaded or saved using eVision.EasyDeepLearning.EDeepLearningTool.Save or eVision.EasyDeepLearning.EDeepLearningTool.Load.
str InferenceModelPath (self)
 Path of the inference model when loaded or saved using eVision.EasyDeepLearning.EDeepLearningTool.SaveInferenceModel, eVision.EasyDeepLearning.EDeepLearningTool.LoadInferenceModel or eVision.EasyDeepLearning.EDeepLearningTool.SerializeInferenceModel.
str TrainingModelPath (self)
 Path of the training model when loaded or saved using eVision.EasyDeepLearning.EDeepLearningTool.SaveTrainingModel, eVision.EasyDeepLearning.EDeepLearningTool.LoadTrainingModel or eVision.EasyDeepLearning.EDeepLearningTool.SerializeTrainingModel.
str SettingsPath (self)
 Path of the settings when loaded or saved using eVision.EasyDeepLearning.EDeepLearningTool.SaveSettings, eVision.EasyDeepLearning.EDeepLearningTool.LoadSettings or eVision.EasyDeepLearning.EDeepLearningTool.SerializeSettings.
int AutoSavePeriod (self)
 Auto-save period.
 AutoSavePeriod (self, int value)
 Auto-save period.
eVision.EasyDeepLearning.EDeepLearningLearningRateType LearningRateType (self)
 Learning rate type.
list[float] LearningRateParameters (self)
 Parameters of the learning rate.
bool EnableDeterministicTraining (self)
 Whether to use deterministic training algorithm that allows to repeatable training results.
 EnableDeterministicTraining (self, bool value)
 Whether to use deterministic training algorithm that allows to repeatable training results.
int DeterministicTrainingRandomSeed (self)
 Random seed to use when eVision.EasyDeepLearning.EDeepLearningTool.EnableDeterministicTraining is set to true.
 DeterministicTrainingRandomSeed (self, int value)
 Random seed to use when eVision.EasyDeepLearning.EDeepLearningTool.EnableDeterministicTraining is set to true.
int NumLabels (self)
 Number of labels of this tool.

Static Public Member Functions

eVision.EasyDeepLearning.EDeepLearningTool|None Create (str path)
 Factory method to open a deep learning tool.
eVision.EasyDeepLearning.EDeepLearningTool|None Create (eVision.ESerializer|None serializer)
 Factory method to open a deep learning tool.
eVision.EasyDeepLearning.EDeepLearningTool|None Create (eVision.EasyDeepLearning.EDeepLearningToolType type)
 Factory method to open a deep learning tool.
int GetNumAvailableEngines ()
 Number of available engines.
str GetAvailableEngineName (int id)
 Gets the name of the engine given its id.
list[str] GetAvailableEngines ()
 Available engines.
list[eVision._eVision.EasyDeepLearning.EDeepLearningDevice] GetAvailableDevicesForEngine (str engine)
 Available devices for the specified engine.

Protected Member Functions

 _ActiveDeviceByName__setter (self, str value)
 Sets the device with which to run the model using its name.
 _ActiveDeviceById__setter (self, int value)
 Sets the device with which to run the model using its index in the list returned by eVision.EasyDeepLearning.EDeepLearningTool.AvailableDevices.
 _ActiveDevicesById__setter (self, list[int] value)
 Sets the devices with which to run the model using their index in the list returned by eVision.EasyDeepLearning.EDeepLearningTool.AvailableDevices.

Properties

 ActiveDeviceByName
 ActiveDeviceById
 ActiveDevicesById

Detailed Description

eVision.EasyDeepLearning.EDeepLearningTool represents the common operations of deep learning tools.

The class is responsible for handling CPU/GPU settings and training. Computing the result for an image is called inference and is the responsibility of the actual deep learning tools (see eVision.EasyDeepLearning.EClassifier).

Remarks:

License(s): EasyClassify or EasySegment or EasyLocate or EasyClassifyInference or EasySegmentInference or EasyLocateInference

Member Function Documentation

◆ _ActiveDeviceById__setter()

eVision.EasyDeepLearning.EDeepLearningTool._ActiveDeviceById__setter ( self,
int value )
protected

Sets the device with which to run the model using its index in the list returned by eVision.EasyDeepLearning.EDeepLearningTool.AvailableDevices.

◆ _ActiveDeviceByName__setter()

eVision.EasyDeepLearning.EDeepLearningTool._ActiveDeviceByName__setter ( self,
str value )
protected

Sets the device with which to run the model using its name.

◆ _ActiveDevicesById__setter()

eVision.EasyDeepLearning.EDeepLearningTool._ActiveDevicesById__setter ( self,
list[int] value )
protected

Sets the devices with which to run the model using their index in the list returned by eVision.EasyDeepLearning.EDeepLearningTool.AvailableDevices.

◆ ActiveDevices() [1/2]

list[eVision._eVision.EasyDeepLearning.EDeepLearningDevice] eVision.EasyDeepLearning.EDeepLearningTool.ActiveDevices ( self)

Devices with which to run or train the model.

Only multiple GPUs with the default engine is supported.

◆ ActiveDevices() [2/2]

eVision.EasyDeepLearning.EDeepLearningTool.ActiveDevices ( self,
list[eVision._eVision.EasyDeepLearning.EDeepLearningDevice] value )

Devices with which to run or train the model.

Only multiple GPUs with the default engine is supported.

◆ AutoSavePeriod() [1/2]

int eVision.EasyDeepLearning.EDeepLearningTool.AutoSavePeriod ( self)

Auto-save period.

The auto-save period is the number of training iterations between each automatic save of the model.

In order for the model to be automatically saved during the training, the tool must have been loaded or saved to a file. The path where the tool will be saved is either indicated by eVision.EasyDeepLearning.EDeepLearningTool.Path or the three paths eVision.EasyDeepLearning.EDeepLearningTool.SettingsPath, eVision.EasyDeepLearning.EDeepLearningTool.InferenceModelPath, and eVision.EasyDeepLearning.EDeepLearningTool.TrainingModelPath. If one of these path is empty, the corresponding part of the tool will not be saved automatically during training.

By default, auto save is disabled and the period is equal to 0.

◆ AutoSavePeriod() [2/2]

eVision.EasyDeepLearning.EDeepLearningTool.AutoSavePeriod ( self,
int value )

Auto-save period.

The auto-save period is the number of training iterations between each automatic save of the model.

In order for the model to be automatically saved during the training, the tool must have been loaded or saved to a file. The path where the tool will be saved is either indicated by eVision.EasyDeepLearning.EDeepLearningTool.Path or the three paths eVision.EasyDeepLearning.EDeepLearningTool.SettingsPath, eVision.EasyDeepLearning.EDeepLearningTool.InferenceModelPath, and eVision.EasyDeepLearning.EDeepLearningTool.TrainingModelPath. If one of these path is empty, the corresponding part of the tool will not be saved automatically during training.

By default, auto save is disabled and the period is equal to 0.

◆ AvailableDevices()

list[eVision._eVision.EasyDeepLearning.EDeepLearningDevice] eVision.EasyDeepLearning.EDeepLearningTool.AvailableDevices ( self)

Get all available device for the current engine.

◆ BatchSize() [1/2]

int eVision.EasyDeepLearning.EDeepLearningTool.BatchSize ( self)

Batch size.

The batch size is the number of images that are processed together during training and batch inference.

When using multi-GPUs processing (see eVision.EasyDeepLearning.EDeepLearningTool.GPUIndexes), the batch size is the number of images that each GPU will process at once.

A large batch size will increase the processing speed on GPU but also the memory requirements.

The batch size must be bigger or equal to 1 and it is commonly chosen to be a power of 2.

Remarks:

If eVision.EasyDeepLearning.EDeepLearningTool.OptimizeBatchSize is 'true', then the value of this property will be optimized automatically for training or inference according to the situation.

See also eVision.EasyDeepLearning.EDeepLearningTool.BatchSizeForMaximumInferenceSpeed.

◆ BatchSize() [2/2]

eVision.EasyDeepLearning.EDeepLearningTool.BatchSize ( self,
int value )

Batch size.

The batch size is the number of images that are processed together during training and batch inference.

When using multi-GPUs processing (see eVision.EasyDeepLearning.EDeepLearningTool.GPUIndexes), the batch size is the number of images that each GPU will process at once.

A large batch size will increase the processing speed on GPU but also the memory requirements.

The batch size must be bigger or equal to 1 and it is commonly chosen to be a power of 2.

Remarks:

If eVision.EasyDeepLearning.EDeepLearningTool.OptimizeBatchSize is 'true', then the value of this property will be optimized automatically for training or inference according to the situation.

See also eVision.EasyDeepLearning.EDeepLearningTool.BatchSizeForMaximumInferenceSpeed.

◆ BatchSizeForMaximumInferenceSpeed()

int eVision.EasyDeepLearning.EDeepLearningTool.BatchSizeForMaximumInferenceSpeed ( self)

Computes the batch size that will maximize the inference speed on NVIDIA GPU.

For all other devices, it will return 1.

Remarks:

This value is given as an indication and should not necessarily be used in practice.

You must choose a tradeoff between the overall inference speed (also called the throughput), which is limited by this value, and the time it takes to compute the result of a whole batch (also called the latency), which is minimized by making inference image per image (i.e. a batch size of 1). The tradeoff depends on your particular application.

Throw EError_DeepLearningToolNotTrained if the tool is not trained.

◆ BestIteration()

int eVision.EasyDeepLearning.EDeepLearningTool.BestIteration ( self)

Iteration at which the minimum validation error was reached.

After training, the tool is in the state it was at this best iteration.

◆ Clean()

None eVision.EasyDeepLearning.EDeepLearningTool.Clean ( self)

Reset the engine and clean CPU and GPU memory allocated for running the model.

Remarks:

This method does not clean all GPU memory. For example, some program data (CUDA kernels) will be kept in GPU memory.

◆ ClearEngineSetupData()

None eVision.EasyDeepLearning.EDeepLearningTool.ClearEngineSetupData ( self)

Clears the engine data saved in the inference model.

Use this method when your engine fails.

◆ Clone()

eVision.EasyDeepLearning.EDeepLearningTool | None eVision.EasyDeepLearning.EDeepLearningTool.Clone ( self)

Clones this tool.

◆ Create() [1/3]

eVision.EasyDeepLearning.EDeepLearningTool | None eVision.EasyDeepLearning.EDeepLearningTool.Create ( eVision.EasyDeepLearning.EDeepLearningToolType type)
static

Factory method to open a deep learning tool.

Parameters
typeType of tool to create

◆ Create() [2/3]

eVision.EasyDeepLearning.EDeepLearningTool | None eVision.EasyDeepLearning.EDeepLearningTool.Create ( eVision.ESerializer | None serializer)
static

Factory method to open a deep learning tool.

Parameters
serializerA serializer created for reading.

◆ Create() [3/3]

eVision.EasyDeepLearning.EDeepLearningTool | None eVision.EasyDeepLearning.EDeepLearningTool.Create ( str path)
static

Factory method to open a deep learning tool.

Parameters
pathPath to a deep learning tool.

◆ CurrentTrainingFinishedIterations()

int eVision.EasyDeepLearning.EDeepLearningTool.CurrentTrainingFinishedIterations ( self)

Number of iterations that are already finished in the current training.

◆ CurrentTrainingNumIterations()

int eVision.EasyDeepLearning.EDeepLearningTool.CurrentTrainingNumIterations ( self)

Total number of training iterations that will be performed during the current training of the deep learning tool.

After the end of the training, this number is the actual number of iterations performed during the training which can be lower than the number of iterations given to the training method (for example if the user called eVision.EasyDeepLearning.EDeepLearningTool.StopTraining).

◆ CurrentTrainingProgression()

float eVision.EasyDeepLearning.EDeepLearningTool.CurrentTrainingProgression ( self)

Current training progression as a percentage (between 0 and 1).

◆ DeterministicTrainingRandomSeed() [1/2]

int eVision.EasyDeepLearning.EDeepLearningTool.DeterministicTrainingRandomSeed ( self)

Random seed to use when eVision.EasyDeepLearning.EDeepLearningTool.EnableDeterministicTraining is set to true.

The default value is 42.

When eVision.EasyDeepLearning.EDeepLearningTool.EnableDeterministicTraining, the random seed is generated using a random non-deterministic source.

◆ DeterministicTrainingRandomSeed() [2/2]

eVision.EasyDeepLearning.EDeepLearningTool.DeterministicTrainingRandomSeed ( self,
int value )

Random seed to use when eVision.EasyDeepLearning.EDeepLearningTool.EnableDeterministicTraining is set to true.

The default value is 42.

When eVision.EasyDeepLearning.EDeepLearningTool.EnableDeterministicTraining, the random seed is generated using a random non-deterministic source.

◆ EnableDeterministicTraining() [1/2]

bool eVision.EasyDeepLearning.EDeepLearningTool.EnableDeterministicTraining ( self)

Whether to use deterministic training algorithm that allows to repeatable training results.

Default value: false.

Remarks:

Deterministic training is not guaranteed when:

◆ EnableDeterministicTraining() [2/2]

eVision.EasyDeepLearning.EDeepLearningTool.EnableDeterministicTraining ( self,
bool value )

Whether to use deterministic training algorithm that allows to repeatable training results.

Default value: false.

Remarks:

Deterministic training is not guaranteed when:

◆ EnableGPU() [1/2]

bool eVision.EasyDeepLearning.EDeepLearningTool.EnableGPU ( self)

Enable the use of a GPU for training and inference of the deep learning tool.

If the active engine is not the default engine, eVision.EasyDeepLearning.EDeepLearningTool.EnableGPU will be false even if the active device has a GPU device type. Setting eVision.EasyDeepLearning.EDeepLearningTool.EnableGPU to any value when the active engine is not the default one will throw an exception.

Deprecated
Deprecated in version 23.4. Scheduled to be removed in version 27.6.

◆ EnableGPU() [2/2]

eVision.EasyDeepLearning.EDeepLearningTool.EnableGPU ( self,
bool value )

Enable the use of a GPU for training and inference of the deep learning tool.

If the active engine is not the default engine, eVision.EasyDeepLearning.EDeepLearningTool.EnableGPU will be false even if the active device has a GPU device type. Setting eVision.EasyDeepLearning.EDeepLearningTool.EnableGPU to any value when the active engine is not the default one will throw an exception.

Deprecated
Deprecated in version 23.4. Scheduled to be removed in version 27.6.

◆ Engine() [1/2]

str eVision.EasyDeepLearning.EDeepLearningTool.Engine ( self)

Sets the engine with which to execute or train the neural network.

◆ Engine() [2/2]

eVision.EasyDeepLearning.EDeepLearningTool.Engine ( self,
str value )

Sets the engine with which to execute or train the neural network.

◆ EngineSetupDataBatchSize()

int eVision.EasyDeepLearning.EDeepLearningTool.EngineSetupDataBatchSize ( self)

Batch size corresponding to the engine data contained in the tool.

◆ EngineSetupDataDevice()

eVision.EasyDeepLearning.EDeepLearningDevice eVision.EasyDeepLearning.EDeepLearningTool.EngineSetupDataDevice ( self)

Device corresponding to the engine data contained in the tool.

◆ EngineSetupDataInferencePrecision()

eVision.EasyDeepLearning.EDeepLearningInferencePrecision eVision.EasyDeepLearning.EDeepLearningTool.EngineSetupDataInferencePrecision ( self)

Inference precision corresponding to the engine data contained in the tool.

◆ ExecutionSettings() [1/2]

eVision.EasyDeepLearning.EDeepLearningExecutionSettings eVision.EasyDeepLearning.EDeepLearningTool.ExecutionSettings ( self)

Execution settings of the tool (engine, device(s), inference precision, batch size settings).

◆ ExecutionSettings() [2/2]

eVision.EasyDeepLearning.EDeepLearningTool.ExecutionSettings ( self,
eVision.EasyDeepLearning.EDeepLearningExecutionSettings value )

Execution settings of the tool (engine, device(s), inference precision, batch size settings).

◆ GetActiveDevice() [1/2]

eVision.EasyDeepLearning.EDeepLearningDevice eVision.EasyDeepLearning.EDeepLearningTool.GetActiveDevice ( self)

Gets the active device.

By default, it returns the first active device.

◆ GetActiveDevice() [2/2]

eVision.EasyDeepLearning.EDeepLearningDevice eVision.EasyDeepLearning.EDeepLearningTool.GetActiveDevice ( self,
int i )

Gets the active device.

By default, it returns the first active device.

Parameters
iIndex of the active devices between 0 and eVision.EasyDeepLearning.EDeepLearningTool.NumActiveDevices.

◆ GetAvailableDevice()

eVision.EasyDeepLearning.EDeepLearningDevice eVision.EasyDeepLearning.EDeepLearningTool.GetAvailableDevice ( self,
int i )

i-th eVision.EasyDeepLearning.EDeepLearningDevice of the current engine.

Parameters
iIndex of the device between 0 and eVision.EasyDeepLearning.EDeepLearningTool.NumAvailableDevices - 1.

◆ GetAvailableDeviceName()

str eVision.EasyDeepLearning.EDeepLearningTool.GetAvailableDeviceName ( self,
int i )

Name of the i-th device of the current engine.

Parameters
iIndex of the device between 0 and eVision.EasyDeepLearning.EDeepLearningTool.NumAvailableDevices - 1.

◆ GetAvailableDevicesForEngine()

list[eVision._eVision.EasyDeepLearning.EDeepLearningDevice] eVision.EasyDeepLearning.EDeepLearningTool.GetAvailableDevicesForEngine ( str engine)
static

Available devices for the specified engine.

Parameters
engineEngine for which to get the devices

◆ GetAvailableEngineName()

str eVision.EasyDeepLearning.EDeepLearningTool.GetAvailableEngineName ( int id)
static

Gets the name of the engine given its id.

Parameters
idIndex of the available engine between 0 and eVision.EasyDeepLearning.EDeepLearningTool.GetNumAvailableEngines - 1.

◆ GetAvailableEngines()

list[str] eVision.EasyDeepLearning.EDeepLearningTool.GetAvailableEngines ( )
static

Available engines.

◆ GetLabel()

str eVision.EasyDeepLearning.EDeepLearningTool.GetLabel ( self,
int index )

Gets the label from its index.

If the tool is not trained, the method may throw an exception.

Parameters
indexIndex of the label

◆ GetLabelColor()

eVision.ERGBColor eVision.EasyDeepLearning.EDeepLearningTool.GetLabelColor ( self,
int index )

Label color.

The label colors affect how the results will be displayed.

The default label colors are the one specified in the dataset used for training.

Parameters
indexIndex of the label between 0 and eVision.EasyDeepLearning.EDeepLearningTool.NumLabels

◆ GetLabelOpacity()

int eVision.EasyDeepLearning.EDeepLearningTool.GetLabelOpacity ( self,
int index )

Gets the label opacity (between 0 for fully transparent and 255 for opaque color).

The label opacities affect with the label colors how the results will be displayed.

The default label opacities are the one specified in the dataset used for training.

Parameters
indexIndex of the label between 0 and eVision.EasyDeepLearning.EDeepLearningTool.NumLabels

◆ GetLabelWeight()

float eVision.EasyDeepLearning.EDeepLearningTool.GetLabelWeight ( self,
int index )

Gets the label weight.

If the tool is not trained, the label weights are not defined. After training, they are set to the value of the training dataset label weights.

Parameters
indexIndex of the label

◆ GetNumAvailableEngines()

int eVision.EasyDeepLearning.EDeepLearningTool.GetNumAvailableEngines ( )
static

Number of available engines.

◆ GetNumPatchesForImage() [1/2]

int eVision.EasyDeepLearning.EDeepLearningTool.GetNumPatchesForImage ( self,
eVision.EBaseROI sampleImage )

Number of patches that will be extracted from an input image to perform inference.

For EasyClassify and EasyLocate, this will always be equal to 1. For EasySegment, the number of patches will depend on the scale, patch size and sampling density parameters.

Parameters
sampleImageImage for which to get the number of patch

Reimplemented in eVision.EasyDeepLearning.ESupervisedSegmenter, and eVision.EasyDeepLearning.EUnsupervisedSegmenter.

◆ GetNumPatchesForImage() [2/2]

int eVision.EasyDeepLearning.EDeepLearningTool.GetNumPatchesForImage ( self,
int imageWidth,
int imageHeight )

Number of patches that will be extracted from an input image to perform inference.

For EasyClassify and EasyLocate, this will always be equal to 1. For EasySegment, the number of patches will depend on the scale, patch size and sampling density parameters.

Parameters
imageWidthWidth of the image for which to get the number of patch
imageHeightHeight of the image for which to get the number of patch

Reimplemented in eVision.EasyDeepLearning.ESupervisedSegmenter, and eVision.EasyDeepLearning.EUnsupervisedSegmenter.

◆ GetOptimalNumImagesForBatchSize() [1/2]

int eVision.EasyDeepLearning.EDeepLearningTool.GetOptimalNumImagesForBatchSize ( self,
eVision.EBaseROI sampleImage )

Optimal number of images to process together for inference given the batch size and eVision.EasyDeepLearning.EDeepLearningTool.GetNumPatchesForImage.

In practice, for EasyClassify and EasyLocate, this is the same as the batch size.

For EasySegment, the value will depend on the scale, patch size and sampling density parameters.

Parameters
sampleImageImage for which to get the optimal number of images

◆ GetOptimalNumImagesForBatchSize() [2/2]

int eVision.EasyDeepLearning.EDeepLearningTool.GetOptimalNumImagesForBatchSize ( self,
int imageWidth,
int imageHeight )

Optimal number of images to process together for inference given the batch size and eVision.EasyDeepLearning.EDeepLearningTool.GetNumPatchesForImage.

In practice, for EasyClassify and EasyLocate, this is the same as the batch size.

For EasySegment, the value will depend on the scale, patch size and sampling density parameters.

Parameters
imageWidthWidth of the image for which to get the optimal number of images
imageHeightHeight of the image for which to get the optimal number of images

◆ GPUIndexes() [1/2]

list[int] eVision.EasyDeepLearning.EDeepLearningTool.GPUIndexes ( self)

Indexes of the GPUs to use for computations.

Using multiple GPUs is only possible when we can process multiple images at once, i.e. during training or batch inference.

By default, all the detected GPUs will be used.

Remarks:

The GPU are indexed from 0 to eVision.EasyDeepLearning.EDeepLearningTool.NumGPUs - 1.

Deprecated

Use eVision.EasyDeepLearning.EDeepLearningTool.GetActiveDevice or eVision.EasyDeepLearning.EDeepLearningTool.ActiveDevices.

Deprecated in version 23.4. Scheduled to be removed in version 27.6.

◆ GPUIndexes() [2/2]

eVision.EasyDeepLearning.EDeepLearningTool.GPUIndexes ( self,
list[int] value )

Indexes of the GPUs to use for computations.

Using multiple GPUs is only possible when we can process multiple images at once, i.e. during training or batch inference.

By default, all the detected GPUs will be used.

Remarks:

The GPU are indexed from 0 to eVision.EasyDeepLearning.EDeepLearningTool.NumGPUs - 1.

Deprecated

Use eVision.EasyDeepLearning.EDeepLearningTool.GetActiveDevice or eVision.EasyDeepLearning.EDeepLearningTool.ActiveDevices.

Deprecated in version 23.4. Scheduled to be removed in version 27.6.

◆ HasEngineSetupData()

bool eVision.EasyDeepLearning.EDeepLearningTool.HasEngineSetupData ( self)

Whether the inference model has engine setup data.

Engine setup data allows for quicker configuration of the engine when reusing the same device, inference precision and batch size.

Use eVision.EasyDeepLearning.EDeepLearningTool.EngineSetupDataDevice, eVision.EasyDeepLearning.EDeepLearningTool.EngineSetupDataInferencePrecision, and eVision.EasyDeepLearning.EDeepLearningTool.EngineSetupDataBatchSize to retrieve the device (and engine), inference precision, and batch size for which the tool has engine setup data.

The engine setup data is stored in the tool after the first inference or after calling eVision.EasyDeepLearning.EDeepLearningTool.InitializeInference if the engine supports it. At the moment, only the TensorRT engine supports setup data. If you save the tool, the engine setup data will be saved with the tool and can be reused when loading the tool again.

The engine setup data will only be replaced when using another device and/or inference precision and/or batch size with an engine that supports engine setup data. Otherwise, this setup data will remain (for example, using an engine that does not supports setup data will leave the pervious engine setup data intact).

You can clear the engine setup data by using eVision.EasyDeepLearning.EDeepLearningTool.ClearEngineSetupData.

◆ HasInferenceModel()

bool eVision.EasyDeepLearning.EDeepLearningTool.HasInferenceModel ( self)

Whether the inference model is loaded or created when the tool is not yet trained.

◆ HasTrainingModel()

bool eVision.EasyDeepLearning.EDeepLearningTool.HasTrainingModel ( self)

Whether the training model is loaded or created when the tool is not yet trained.

◆ ImageCacheSize() [1/2]

int eVision.EasyDeepLearning.EDeepLearningTool.ImageCacheSize ( self)

Size in byte of the image cache.

The cache is used during training to store reformatted and normalized images. A correctly sized cache can reduce the hard drive accesses and the preprocessing time for each image.

◆ ImageCacheSize() [2/2]

eVision.EasyDeepLearning.EDeepLearningTool.ImageCacheSize ( self,
int value )

Size in byte of the image cache.

The cache is used during training to store reformatted and normalized images. A correctly sized cache can reduce the hard drive accesses and the preprocessing time for each image.

◆ InferenceModelPath()

str eVision.EasyDeepLearning.EDeepLearningTool.InferenceModelPath ( self)

◆ InferencePrecision() [1/2]

eVision.EasyDeepLearning.EDeepLearningInferencePrecision eVision.EasyDeepLearning.EDeepLearningTool.InferencePrecision ( self)

Inference precision.

Use eVision.EasyDeepLearning.EDeepLearningDevice.IsPrecisionSupported to check whether a device support the given precision.

◆ InferencePrecision() [2/2]

eVision.EasyDeepLearning.EDeepLearningTool.InferencePrecision ( self,
eVision.EasyDeepLearning.EDeepLearningInferencePrecision value )

Inference precision.

Use eVision.EasyDeepLearning.EDeepLearningDevice.IsPrecisionSupported to check whether a device support the given precision.

◆ InitializeInference() [1/3]

None eVision.EasyDeepLearning.EDeepLearningTool.InitializeInference ( self,
eVision.EBaseROI img )

Initializes the neural network for inference (i.e.

making predictions with the neural network).

You need to pass an image or a vector of images with the same characteristics (image resolution, image type and number of image) as the image or vector of images that you will use to make inference with this tool.

If eVision.EasyDeepLearning.EDeepLearningTool.OptimizeBatchSize is equal to true, the value of eVision.EasyDeepLearning.EDeepLearningTool.BatchSize will be recomputed.

Parameters
imgImage for which to prepare the tool for inference

◆ InitializeInference() [2/3]

None eVision.EasyDeepLearning.EDeepLearningTool.InitializeInference ( self,
int width,
int height,
eVision.EImageType imageType,
int numImages )

Initializes the neural network for inference (i.e.

making predictions with the neural network).

You need to pass an image or a vector of images with the same characteristics (image resolution, image type and number of image) as the image or vector of images that you will use to make inference with this tool.

If eVision.EasyDeepLearning.EDeepLearningTool.OptimizeBatchSize is equal to true, the value of eVision.EasyDeepLearning.EDeepLearningTool.BatchSize will be recomputed.

Parameters
widthWidth of the images for which to prepare the tool for inference
heightHeight of the images for which to prepare the tool for inference
imageTypeType of the images for which to prepare the tool for inference
numImagesNumber of images for which to prepare the tool for inference

◆ InitializeInference() [3/3]

None eVision.EasyDeepLearning.EDeepLearningTool.InitializeInference ( self,
list[eVision._eVision.EBaseROI | None] imgList )

Initializes the neural network for inference (i.e.

making predictions with the neural network).

You need to pass an image or a vector of images with the same characteristics (image resolution, image type and number of image) as the image or vector of images that you will use to make inference with this tool.

If eVision.EasyDeepLearning.EDeepLearningTool.OptimizeBatchSize is equal to true, the value of eVision.EasyDeepLearning.EDeepLearningTool.BatchSize will be recomputed.

Parameters
imgListVector of images for which to prepare the tool for inference

◆ IsTrained()

bool eVision.EasyDeepLearning.EDeepLearningTool.IsTrained ( self)

Tells whether the deep learning tool has been trained.

◆ IsTraining()

bool eVision.EasyDeepLearning.EDeepLearningTool.IsTraining ( self)

Indicates whether the object is currently training.

◆ LearningRateParameters()

list[float] eVision.EasyDeepLearning.EDeepLearningTool.LearningRateParameters ( self)

Parameters of the learning rate.

◆ LearningRateType()

eVision.EasyDeepLearning.EDeepLearningLearningRateType eVision.EasyDeepLearning.EDeepLearningTool.LearningRateType ( self)

Learning rate type.

◆ Load() [1/2]

None eVision.EasyDeepLearning.EDeepLearningTool.Load ( self,
eVision.ESerializer | None serializer )

Loads a deep learning tool.

The given eVision.ESerializer must have been created for reading.

Parameters
serializerPointer to the eVision.ESerializer created for reading.

◆ Load() [2/2]

None eVision.EasyDeepLearning.EDeepLearningTool.Load ( self,
str filePath )

Loads a deep learning tool.

The given eVision.ESerializer must have been created for reading.

Parameters
filePathFile path.

◆ LoadInferenceModel()

None eVision.EasyDeepLearning.EDeepLearningTool.LoadInferenceModel ( self,
str filePath )

Loads the tool's inference model.

The inference model is required to apply the tool on new images.

Parameters
filePathFile path.

◆ LoadSettings()

None eVision.EasyDeepLearning.EDeepLearningTool.LoadSettings ( self,
str filePath )

Loads the settings of a tool.

Parameters
filePathFile path.

◆ LoadTrainingModel()

None eVision.EasyDeepLearning.EDeepLearningTool.LoadTrainingModel ( self,
str filePath )

Loads the tool's training model.

The training model is required to continue a training.

Parameters
filePathFile path.

◆ NumActiveDevices()

int eVision.EasyDeepLearning.EDeepLearningTool.NumActiveDevices ( self)

Gets the number of devices with which to run or train the model.

◆ NumAvailableDevices()

int eVision.EasyDeepLearning.EDeepLearningTool.NumAvailableDevices ( self)

Available devices for the current eVision.EasyDeepLearning.EDeepLearningTool.Engine.

◆ NumGPUs()

int eVision.EasyDeepLearning.EDeepLearningTool.NumGPUs ( self)

Number of detected NVIDIA GPU.

Deprecated

Use eVision.EasyDeepLearning.EDeepLearningTool.NumAvailableDevices or parse the output of eVision.EasyDeepLearning.EDeepLearningTool.AvailableDevices to find the devices that are GPUs.

Deprecated in version 23.4. Scheduled to be removed in version 27.6.

◆ NumLabels()

int eVision.EasyDeepLearning.EDeepLearningTool.NumLabels ( self)

Number of labels of this tool.

If the tool is not trained, the method will throw an exception.

Remarks:

Some type of tools such as eVision.EasyDeepLearning.EUnsupervisedSegmenter may have no label at all. For these tools, there is a separate API to control the predicted labels.

◆ NumTrainedIterations()

int eVision.EasyDeepLearning.EDeepLearningTool.NumTrainedIterations ( self)

Number of iterations that were performed to train this deep learning tool.

Remarks:

This number of iteration may result from the addition of the iterations performed in several calls to the training method.

An iteration can also be called an epoch.

◆ OptimizeBatchSize() [1/2]

bool eVision.EasyDeepLearning.EDeepLearningTool.OptimizeBatchSize ( self)

Indicates whether to optimize the batch size (see eVision.EasyDeepLearning.EDeepLearningTool.BatchSize) to maximize the training and inference speed according to the engine, the device and the available memory.

Default value is true.

Remarks:

The batch size will be optimized at the start of training or during eVision.EasyDeepLearning.EDeepLearningTool.InitializeInference.

◆ OptimizeBatchSize() [2/2]

eVision.EasyDeepLearning.EDeepLearningTool.OptimizeBatchSize ( self,
bool value )

Indicates whether to optimize the batch size (see eVision.EasyDeepLearning.EDeepLearningTool.BatchSize) to maximize the training and inference speed according to the engine, the device and the available memory.

Default value is true.

Remarks:

The batch size will be optimized at the start of training or during eVision.EasyDeepLearning.EDeepLearningTool.InitializeInference.

◆ Path()

str eVision.EasyDeepLearning.EDeepLearningTool.Path ( self)

◆ Save() [1/4]

None eVision.EasyDeepLearning.EDeepLearningTool.Save ( self,
eVision.ESerializer | None serializer )

Saves the settings, inference and training model of the deep learning tool.

The given eVision.ESerializer must have been created for writing.

Parameters
serializerPointer to the eVision.ESerializer created for writing.

◆ Save() [2/4]

None eVision.EasyDeepLearning.EDeepLearningTool.Save ( self,
eVision.ESerializer | None serializer,
bool includeTrainingModel )

Saves the settings, inference and training model of the deep learning tool.

The given eVision.ESerializer must have been created for writing.

Parameters
serializerPointer to the eVision.ESerializer created for writing.
includeTrainingModelWhether to save the training model. The training model is required to continue training the tool.

◆ Save() [3/4]

None eVision.EasyDeepLearning.EDeepLearningTool.Save ( self,
str filePath )

Saves the settings, inference and training model of the deep learning tool.

The given eVision.ESerializer must have been created for writing.

Parameters
filePathFile path.

◆ Save() [4/4]

None eVision.EasyDeepLearning.EDeepLearningTool.Save ( self,
str filePath,
bool includeTrainingModel )

Saves the settings, inference and training model of the deep learning tool.

The given eVision.ESerializer must have been created for writing.

Parameters
filePathFile path.
includeTrainingModelWhether to save the training model. The training model is required to continue training the tool.

◆ SaveInferenceModel()

None eVision.EasyDeepLearning.EDeepLearningTool.SaveInferenceModel ( self,
str filePath )

Saves the tool's inference model to a file.

Parameters
filePathFile path.

◆ SaveSettings()

None eVision.EasyDeepLearning.EDeepLearningTool.SaveSettings ( self,
str filePath )

Saves the settings of the tool to a file.

Parameters
filePathFile path.

◆ SaveTrainingModel()

None eVision.EasyDeepLearning.EDeepLearningTool.SaveTrainingModel ( self,
str filePath )

Saves the tool's training model to a file.

Parameters
filePathFile path.

◆ SerializeInferenceModel()

None eVision.EasyDeepLearning.EDeepLearningTool.SerializeInferenceModel ( self,
eVision.ESerializer | None serializer )

Serializes the inference model of the tool.

Parameters
serializerPointer to eVision.ESerializer

◆ SerializeSettings()

◆ SerializeTrainingModel()

None eVision.EasyDeepLearning.EDeepLearningTool.SerializeTrainingModel ( self,
eVision.ESerializer | None serializer )

Serializes the training model of the tool.

The training model is necessary to continue training the tool.

Parameters
serializerPointer to eVision.ESerializer

◆ SetActiveDevice()

None eVision.EasyDeepLearning.EDeepLearningTool.SetActiveDevice ( self,
eVision.EasyDeepLearning.EDeepLearningDevice device )

Sets the device with which to run or train the model.

Remarks:

For CPU device, the number of thread is initialized from eVision.Easy.SetMaxNumberOfProcessingThreads.

Note that this can change eVision.EasyDeepLearning.EDeepLearningTool.InferencePrecision if the previously set value was incompatible with the device.

Parameters
deviceThe device with which to run or train the model.

◆ SetLabel()

None eVision.EasyDeepLearning.EDeepLearningTool.SetLabel ( self,
int index,
str label )

Changes a label predicted by the tool.

Remarks:

Be careful when changing one of the label of a trained tool. It can create incompatibilities with previous metrics or results computed with this tool or with the dataset used to trained the tool.

Some tools may not use this label API. For example eVision.EasyDeepLearning.EUnsupervisedSegmenter uses eVision.EasyDeepLearning.EUnsupervisedSegmenter.GoodLabel instead.

Parameters
indexIndex of the label
labelNew label

◆ SetLabelColor()

None eVision.EasyDeepLearning.EDeepLearningTool.SetLabelColor ( self,
int index,
eVision.ERGBColor c )

Changes a label color.

Parameters
indexIndex of the label between 0 and eVision.EasyDeepLearning.EDeepLearningTool.NumLabels
cNew color for the specified label

◆ SetLabelOpacity()

None eVision.EasyDeepLearning.EDeepLearningTool.SetLabelOpacity ( self,
int index,
int opacity )

Changes a label opacity (between 0 for fully transparent and 255 for opaque color).

Parameters
indexIndex of the label between 0 and eVision.EasyDeepLearning.EDeepLearningTool.NumLabels
opacityNew opacity for the specified label

◆ SetLabelWeight()

None eVision.EasyDeepLearning.EDeepLearningTool.SetLabelWeight ( self,
int index,
float weight )

Sets the label weight.

If the tool is not trained, the label weights are not defined. After training, they are set to the value of the training dataset label weights.

Parameters
indexIndex of the label
weightWeight

◆ SetLearningRate()

None eVision.EasyDeepLearning.EDeepLearningTool.SetLearningRate ( self,
eVision.EasyDeepLearning.EDeepLearningLearningRateType type,
list[float] parameters )

Specifies how the value of the learning rate and how it evolves during training.

◆ SettingsPath()

str eVision.EasyDeepLearning.EDeepLearningTool.SettingsPath ( self)

◆ StopTraining()

int eVision.EasyDeepLearning.EDeepLearningTool.StopTraining ( self,
bool wait )

Stops training and returns the last completed iteration.

If the parameter 'wait' is set to true, the method will wait for the training thread to completely stop. Otherwise, the method will return immediately.

Parameters
waitWhether to wait for the training to completely stop

◆ ToolType()

◆ TrainingModelPath()

str eVision.EasyDeepLearning.EDeepLearningTool.TrainingModelPath ( self)

◆ UnloadInferenceModel()

None eVision.EasyDeepLearning.EDeepLearningTool.UnloadInferenceModel ( self)

Unloads the inference model.

◆ UnloadModels()

None eVision.EasyDeepLearning.EDeepLearningTool.UnloadModels ( self)

Unloads the inference and training model.

◆ UnloadTrainingModel()

None eVision.EasyDeepLearning.EDeepLearningTool.UnloadTrainingModel ( self)

Unloads the training model.

◆ WaitForIterationCompletion()

int eVision.EasyDeepLearning.EDeepLearningTool.WaitForIterationCompletion ( self)

Waits until an iteration is complete.

A call to this method will block the calling thread until a training iteration in the training thread is finished. This method returns the number of trained iterations.

◆ WaitForTrainingCompletion() [1/2]

int eVision.EasyDeepLearning.EDeepLearningTool.WaitForTrainingCompletion ( self)

Waits until the training is complete or the timeout is expired.

A call to this method will block the calling thread for the shortest time between the timeout and the time it takes for the training to complete.

A negative timeout means that the method will wait until the training is complete.

The default value is set to -1.

The method returns the number of trained iterations.

◆ WaitForTrainingCompletion() [2/2]

int eVision.EasyDeepLearning.EDeepLearningTool.WaitForTrainingCompletion ( self,
int timeout )

Waits until the training is complete or the timeout is expired.

A call to this method will block the calling thread for the shortest time between the timeout and the time it takes for the training to complete.

A negative timeout means that the method will wait until the training is complete.

The default value is set to -1.

The method returns the number of trained iterations.

Parameters
timeoutTimeout in second

Property Documentation

◆ ActiveDeviceById

eVision.EasyDeepLearning.EDeepLearningTool.ActiveDeviceById
static
Initial value:
= property(None, _ActiveDeviceById__setter, None,
)

◆ ActiveDeviceByName

eVision.EasyDeepLearning.EDeepLearningTool.ActiveDeviceByName
static
Initial value:
= property(None, _ActiveDeviceByName__setter, None,
)

◆ ActiveDevicesById

eVision.EasyDeepLearning.EDeepLearningTool.ActiveDevicesById
static
Initial value:
= property(None, _ActiveDevicesById__setter, None,
)