View Source Evision.Zoo.TextDetection.PPOCRV3 (Evision v0.2.9)

Real-time Scene Text Detection with PP-OCRv3

Summary

Functions

Default configuration.

Docs in smart cell.

Inference.

Initialize model.

Model URL and filename of predefined model.

Customizable parameters from smart cell.

Smart cell tasks.

Generate quoted code from smart cell attrs.

Functions

@spec default_config() :: map()

Default configuration.

@spec docs() :: String.t()

Docs in smart cell.

@spec infer(Evision.DNN.TextDetectionModelDB.t(), Evision.Mat.maybe_mat_in()) ::
  {[{{number(), number()}, {number(), number()}, number()}], [number()]}
  | {:error, String.t()}

Inference.

Positional arguments
Return

{detections, confidence}

Link to this function

init(model_path, opts \\ [])

View Source
@spec init(binary() | :en | :cn, nil | Keyword.t()) ::
  {:error, String.t()} | Evision.DNN.TextDetectionModelDB.t()

Initialize model.

Positional arguments
  • model: String.t() | :en | :cn

    • When model is a string, it will be treat as the path to a weight file and init/2 will load the model from it.

    • When model is one of :en and :cn, init/2 will download and load the predefined model.

Keyword arguments
  • cache_dir: String.t().

    Path to the cache directory.

    Optional. Defaults to :filename.basedir(:user_cache, "", ...)

  • backend: integer().

    Specify the backend.

    Optional. Defaults to Evision.Constant.cv_DNN_BACKEND_OPENCV().

  • target: integer().

    Specify the target.

    Optional. Defaults to Evision.Constant.cv_DNN_TARGET_CPU().

@spec model_info(:en | :cn | :en_int8 | :cn_int8) :: {String.t(), String.t()}

Model URL and filename of predefined model.

@spec smartcell_params() :: Evision.Zoo.smartcell_params()

Customizable parameters from smart cell.

@spec smartcell_tasks() :: Evision.Zoo.smartcell_tasks()

Smart cell tasks.

A list of variants of the current model.

@spec to_quoted(map()) :: list()

Generate quoted code from smart cell attrs.

Link to this function

visualize(image, detections, confidences, opts \\ [])

View Source

Visualize the result.

Positional arguments
  • image: Evision.Mat.maybe_mat_in().

    Original image.

  • detections: list({{number(), number()}, {number(), number()}, number()}).

    Rotation retangulars.

  • confidences: list(number()).

    Confidence values.

Keyword arguments
  • box_color: {blue=integer(), green=integer(), red=integer()}.

    Values should be in [0, 255]. Defaults to {0, 255, 0}.

    Specify the color of the bounding box.

  • text_color: {blue=integer(), green=integer(), red=integer()}.

    Values should be in [0, 255]. Defaults to {0, 0, 255}.

    Specify the color of the text (confidence value).