View Source Evision.DNN.TextRecognitionModel (Evision v0.1.15)

Link to this section Summary

Types

t()

Type that represents an Evision.DNN.TextRecognitionModel struct.

Functions

Get the decoding method

Get the vocabulary for recognition.

Given the @p input frame, create input blob, run net and return recognition result

Given the @p input frame, create input blob, run net and return recognition result

Set the decoding method options for "CTC-prefix-beam-search" decode usage

Set the decoding method options for "CTC-prefix-beam-search" decode usage

Set the decoding method of translating the network output into string

Set the vocabulary for recognition.

Variant 1:

Create text recognition model from network represented in one of the supported formats Call setDecodeType() and setVocabulary() after constructor to initialize the decoding method

Create text recognition model from network represented in one of the supported formats Call setDecodeType() and setVocabulary() after constructor to initialize the decoding method

Link to this section Types

@type t() :: %Evision.DNN.TextRecognitionModel{ref: reference()}

Type that represents an Evision.DNN.TextRecognitionModel struct.

  • ref. reference()

    The underlying erlang resource variable.

Link to this section Functions

@spec getDecodeType(t()) :: binary() | {:error, String.t()}

Get the decoding method

Return

@return the decoding method

Python prototype (for reference):

getDecodeType() -> retval
@spec getVocabulary(t()) :: [binary()] | {:error, String.t()}

Get the vocabulary for recognition.

Return
  • retval: std::vector<std::string>

@return vocabulary the associated vocabulary

Python prototype (for reference):

getVocabulary() -> retval
@spec recognize(t(), Evision.Mat.maybe_mat_in()) :: binary() | {:error, String.t()}

Given the @p input frame, create input blob, run net and return recognition result

Positional Arguments
Return

@return The text recognition result

Python prototype (for reference):

recognize(frame) -> retval
Link to this function

recognize(self, frame, roiRects)

View Source
@spec recognize(t(), Evision.Mat.maybe_mat_in(), [Evision.Mat.maybe_mat_in()]) ::
  [binary()] | {:error, String.t()}

Given the @p input frame, create input blob, run net and return recognition result

Positional Arguments
  • frame: Evision.Mat.

    The input image

  • roiRects: [Evision.Mat].

    List of text detection regions of interest (cv::Rect, CV_32SC4). ROIs is be cropped as the network inputs

Return
  • results: [string].

    A set of text recognition results.

Python prototype (for reference):

recognize(frame, roiRects) -> results
Link to this function

setDecodeOptsCTCPrefixBeamSearch(self, beamSize)

View Source
@spec setDecodeOptsCTCPrefixBeamSearch(t(), integer()) :: t() | {:error, String.t()}

Set the decoding method options for "CTC-prefix-beam-search" decode usage

Positional Arguments
  • beamSize: int.

    Beam size for search

Keyword Arguments
  • vocPruneSize: int.

    Parameter to optimize big vocabulary search, only take top @p vocPruneSize tokens in each search step, @p vocPruneSize <= 0 stands for disable this prune.

Return

Python prototype (for reference):

setDecodeOptsCTCPrefixBeamSearch(beamSize[, vocPruneSize]) -> retval
Link to this function

setDecodeOptsCTCPrefixBeamSearch(self, beamSize, opts)

View Source
@spec setDecodeOptsCTCPrefixBeamSearch(t(), integer(), [{atom(), term()}, ...] | nil) ::
  t() | {:error, String.t()}

Set the decoding method options for "CTC-prefix-beam-search" decode usage

Positional Arguments
  • beamSize: int.

    Beam size for search

Keyword Arguments
  • vocPruneSize: int.

    Parameter to optimize big vocabulary search, only take top @p vocPruneSize tokens in each search step, @p vocPruneSize <= 0 stands for disable this prune.

Return

Python prototype (for reference):

setDecodeOptsCTCPrefixBeamSearch(beamSize[, vocPruneSize]) -> retval
Link to this function

setDecodeType(self, decodeType)

View Source
@spec setDecodeType(t(), binary()) :: t() | {:error, String.t()}

Set the decoding method of translating the network output into string

Positional Arguments
  • decodeType: string.The decoding method of translating the network output into string, currently supported type:
    • "CTC-greedy" greedy decoding for the output of CTC-based methods
    • "CTC-prefix-beam-search" Prefix beam search decoding for the output of CTC-based methods
Return

Python prototype (for reference):

setDecodeType(decodeType) -> retval
Link to this function

setVocabulary(self, vocabulary)

View Source
@spec setVocabulary(t(), [binary()]) :: t() | {:error, String.t()}

Set the vocabulary for recognition.

Positional Arguments
  • vocabulary: [string].

    the associated vocabulary of the network.

Return

Python prototype (for reference):

setVocabulary(vocabulary) -> retval
Link to this function

textRecognitionModel(model)

View Source
@spec textRecognitionModel(binary()) :: t() | {:error, String.t()}
@spec textRecognitionModel(Evision.DNN.Net.t()) :: t() | {:error, String.t()}

Variant 1:

Create text recognition model from network represented in one of the supported formats Call setDecodeType() and setVocabulary() after constructor to initialize the decoding method

Positional Arguments
  • model: string.

    Binary file contains trained weights

Keyword Arguments
  • config: string.

    Text file contains network configuration

Return

Python prototype (for reference):

TextRecognitionModel(model[, config]) -> <dnn_TextRecognitionModel object>

Variant 2:

Create Text Recognition model from deep learning network Call setDecodeType() and setVocabulary() after constructor to initialize the decoding method

Positional Arguments
Return

Python prototype (for reference):

TextRecognitionModel(network) -> <dnn_TextRecognitionModel object>
Link to this function

textRecognitionModel(model, opts)

View Source
@spec textRecognitionModel(binary(), [{atom(), term()}, ...] | nil) ::
  t() | {:error, String.t()}

Create text recognition model from network represented in one of the supported formats Call setDecodeType() and setVocabulary() after constructor to initialize the decoding method

Positional Arguments
  • model: string.

    Binary file contains trained weights

Keyword Arguments
  • config: string.

    Text file contains network configuration

Return

Python prototype (for reference):

TextRecognitionModel(model[, config]) -> <dnn_TextRecognitionModel object>