FisFilter_DL_ReadCharacters_Deploy
Header: | FIL.h |
---|---|
Namespace: | fil |
Module: | DL_OCR |
Loads a deep learning model and prepares its execution on a specific target device.
Syntax
void fil::FisFilter_DL_ReadCharacters_Deploy ( const ftl::Optional<fil::ReadCharactersModelDirectory>& inModelDirectory, const fil::OcrPretrainedModel::Type inPretrainedModelType, const ftl::Optional<fil::DeviceKind::Type>& inDeviceType, const int inDeviceIndex, const ftl::Optional<fil::OcrDeployHint>& inExecutionHint, fil::ReadCharactersModelId& outModelId )
Parameters
Name | Type | Range | Default | Description | |
---|---|---|---|---|---|
inModelDirectory | const Optional<ReadCharactersModelDirectory>& | NIL | A Read Characters model stored in a specific disk directory. If not set, model is chosen on the basis of inPretrainedModelType. | ||
inPretrainedModelType | const OcrPretrainedModel::Type | Scalable | Type of a pretrained model (distributed with Deep Learning add-on) to deploy. Ignored if inModelDirectory is set. | ||
inDeviceType | const Optional<DeviceKind::Type>& | NIL | A type of a device selected for deploying and executing the model. If not set, device depending on version (CPU/GPU) of installed Deep Learning add-on is selected. If not set, device depending on version (CPU/GPU) of installed Deep Learning add-on is selected. | ||
inDeviceIndex | const int | 0 - | 0 | An index of a device selected for deploying and executing the model. | |
inExecutionHint | const Optional<OcrDeployHint>& | NIL | Prepares the model for an execution with provided settings in advance | ||
outModelId | ReadCharactersModelId& | Identifier of the deployed model |
Description
The pretrained models are described here.
Hints
- In most cases, this filter should be placed in the INITIALIZE section.
- Executing this filter may take several seconds.
- This filter should be connected to DL_ReadCharacters through the ModelId ports.
- By default, the model distributed with Deep Learning add-on will be deployed. If you have a model trained for a specific case, you can set inModelDirectory to it. Please note, that inModelDirectory have to point to existing directory, containing subdirectory named "models", which, in turn, contains file named "model" .
- If inExecutionHint is set to NIL, first execution of DL_ReadCharacters will likely take much more time than following ones. To avoid this, fill inExecutionHint with expected parameters of following calls to DL_ReadCharacters. A size of an analysed area may be obtained from the diagnostic output of DL_ReadCharacters. If you still experience huge performance hit on some calls to DL_ReadCharacters, add another DL_ReadCharacters_Deploy with inExecutionHint filled with parameters from a problematic call to DL_ReadCharacters.
Remarks
- Passing NIL as inTargetDevice (which is default), is identical to passing DeviceKind::CUDA on GPU version of Deep Learning add-on and DeviceKind::CPU on CPU version on Deep Learning add-on.
- GPU version of Deep Learning add-on supports DeviceKind::CUDA and DeviceKind::CPU as inTargetDevice value.
- CPU version of Deep Learning add-on supports only DeviceKind::CPU as inTargetDevice value.
See Also
- DL_ReadCharacters – Performs optical character recognition using a pretrained deep learning model.