Skip to content

create_deep_ocrCreateDeepOcrCreateDeepOcrcreate_deep_ocrT_create_deep_ocr🔗

Short description🔗

create_deep_ocrCreateDeepOcrCreateDeepOcrcreate_deep_ocrT_create_deep_ocr — Create a Deep OCR model.

Signature🔗

create_deep_ocr( attribute.name GenParamName, attribute.value GenParamValue, out deep_ocr DeepOcrHandle )void CreateDeepOcr( const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* DeepOcrHandle )static void HOperatorSet.CreateDeepOcr( HTuple genParamName, HTuple genParamValue, out HTuple deepOcrHandle )def create_deep_ocr( gen_param_name: MaybeSequence[str], gen_param_value: MaybeSequence[Union[int, float, str]] ) -> HHandle

Herror T_create_deep_ocr( const Htuple GenParamName, const Htuple GenParamValue, Htuple* DeepOcrHandle )

void HDlModelOcr::HDlModelOcr( const HTuple& GenParamName, const HTuple& GenParamValue )

void HDlModelOcr::HDlModelOcr( const HString& GenParamName, const HString& GenParamValue )

void HDlModelOcr::HDlModelOcr( const char* GenParamName, const char* GenParamValue )

void HDlModelOcr::HDlModelOcr( const wchar_t* GenParamName, const wchar_t* GenParamValue ) (Windows only)

public HDlModelOcr( HTuple genParamName, HTuple genParamValue )

public HDlModelOcr( string genParamName, string genParamValue )

void HDlModelOcr::CreateDeepOcr( const HTuple& GenParamName, const HTuple& GenParamValue )

void HDlModelOcr::CreateDeepOcr( const HString& GenParamName, const HString& GenParamValue )

void HDlModelOcr::CreateDeepOcr( const char* GenParamName, const char* GenParamValue )

void HDlModelOcr::CreateDeepOcr( const wchar_t* GenParamName, const wchar_t* GenParamValue ) (Windows only)

void HDlModelOcr.CreateDeepOcr( HTuple genParamName, HTuple genParamValue )

void HDlModelOcr.CreateDeepOcr( string genParamName, string genParamValue )

Description🔗

create_deep_ocrCreateDeepOcr creates a Deep OCR model out of pretrained components and returns its handle in DeepOcrHandledeepOcrHandledeep_ocr_handle. The handle states all parameters needed to run an inference.

A Deep OCR model usually consists of two components that are searched in the directory $HALCONROOT/dl/ by default:

  • 'detection_model': detects words (connected characters) in the image.

  • 'recognition_model': recognizes the word in the detected image part.

The following options may be set using GenParamNamegenParamNamegen_param_name and according GenParamValuegenParamValuegen_param_value:

  • 'mode'"mode": Specify a mode and with it, which component is executed. Supported values:

    • 'detection'"detection": Perform only the detection part. Hence, the model will merely localize the word regions within the image.

    • 'recognition'"recognition": Perform only the recognition part. The model expects a tight crop of a single word. If the alignment is enabled, the word crop can be wider, less precise and include background. Before the actual recognition, the alignment applies a transformation step to accurately position the word.

    • 'auto'"auto": Perform both parts, detection of the words and their recognition.

    • 'empty'"empty": This mode creates an empty Deep OCR model handle. Neither recognition nor detection model components are instantiated. Recognition and detection components can be set subsequently using set_deep_ocr_paramSetDeepOcrParam.

    Default: 'auto'"auto".

The character set, which the model can recognize through its recognition component, can be retrieved using get_deep_ocr_paramGetDeepOcrParam with 'recognition_alphabet'"recognition_alphabet".

To get an overview of the Deep OCR workflow see OCR / Deep OCR.

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

This operator returns a handle. Note that the state of an instance of this handle type may be changed by specific operators even though the handle is used as an input parameter by those operators.

Parameters🔗

GenParamNamegenParamNamegen_param_name (input_control) attribute.name(-array) → (string)HTuple (HString)HTuple (string)MaybeSequence[str]Htuple (char*)

Name of the generic parameter.

Default: [][]
List of values: 'mode'"mode"

GenParamValuegenParamValuegen_param_value (input_control) attribute.value(-array) → (string / integer / real)HTuple (HString / Hlong / double)HTuple (string / int / long / double)MaybeSequence[Union[int, float, str]]Htuple (char* / Hlong / double)

Value of the generic parameter.

Default: [][]
List of values: 'auto', 'detection', 'empty', 'recognition'"auto", "detection", "empty", "recognition"

DeepOcrHandledeepOcrHandledeep_ocr_handle (output_control) deep_ocr → (handle)HTuple (HHandle)HDlModelOcr, HTuple (IntPtr)HHandleHtuple (handle)

Handle of the Deep OCR model.

Result🔗

If the parameters are valid, the operator create_deep_ocrCreateDeepOcr returns the value 2 (H_MSG_TRUE). If necessary, an exception is raised.

Combinations with other operators🔗

Combinations

Possible successors

write_deep_ocrWriteDeepOcr, apply_deep_ocrApplyDeepOcr, get_deep_ocr_paramGetDeepOcrParam, set_deep_ocr_paramSetDeepOcrParam

Module🔗

OCR/OCV