View Source Evision.Zoo.TextDetection.DB (Evision v0.1.38)

Real-time Scene Text Detection with Differentiable Binarization

  • IC15 model is trained on IC15 dataset, which can detect English text instances only.
  • TD500 model is trained on TD500 dataset, which can detect both English & Chinese instances.

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()
  | :ic15_resnet18
  | :ic15_resnet50
  | :td500_resnet18
  | :td500_resnet50,
  nil | Keyword.t()
) :: {:error, String.t()} | Evision.DNN.TextDetectionModelDB.t()

Initialize model.

Positional arguments
  • model: String.t() | :ic15_resnet18 | :ic15_resnet50 | :td500_resnet18 | :td500_resnet50

    • 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 :ic15_resnet18, :ic15_resnet50, :td500_resnet18 or :td500_resnet50, 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(:default_model | :quant_model) :: {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).