View Source Evision.Zoo.TextRecognition.CRNN (Evision v0.2.9)
An End-to-End Trainable Neural Network for Image-based Sequence Recognition and Its Application to Scene Text Recognition.
'FP16' or 'INT8' stands for 'model quantized into FP16' or 'model quantized into int8'.
CRNN_EN
and it variants can detect digits (0-9) and letters (return lowercase letters a-z).CRNN_CH
and it variants can detect digits (0-9), upper/lower-case letters (a-z and A-Z), and some special characters.CRNN_CN
and it variants can detect digits (0-9), upper/lower-case letters (a-z and A-Z), some Chinese characters and some special characters.
Summary
Functions
Charset that contains digits (0~9) and letters (return lowercase letters a~z).
Charset that contains digits (0~9), upper/lower-case letters (a~z and A~Z), and some special characters.
Charset that contains digits (0~9), upper/lower-case letters (a~z and A~Z), some Chinese characters and some special characters.
Default configuration.
Docs in smart cell.
Get charset
Inference.
Initialize model.
Get default input size
Model URL and filename of predefined model.
Postprocessing the results.
Preprocessing the input image.
Customizable parameters from smart cell.
Smart cell tasks.
Get default target vertices
Generate quoted code from smart cell attrs.
Visualize the result.
Functions
Charset that contains digits (0~9) and letters (return lowercase letters a~z).
Content copied from charset_36_EN.txt
.
Charset that contains digits (0~9), upper/lower-case letters (a~z and A~Z), and some special characters.
Content copied from charset_94_CH.txt
.
Charset that contains digits (0~9), upper/lower-case letters (a~z and A~Z), some Chinese characters and some special characters.
Content copied from charset_94_CH.txt
.
@spec default_config() :: map()
Default configuration.
@spec docs() :: String.t()
Docs in smart cell.
@spec get_charset(:ch | :cn | :en) :: [binary()]
Get charset
@spec infer( Evision.DNN.Net.t(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), Keyword.t() ) :: String.t()
Inference.
Positional arguments
self:
Evision.DNN.Net.t()
.An initialized CRNN model.
image:
Evision.Mat.maybe_mat_in()
.Input image.
rotation_box:
Evision.Mat.maybe_mat_in()
.Rotation box.
Keyword arguments
charset:
[binary]
|:en
|:ch
|:cn
Required. The corresponding charset for the model.
to_gray:
boolean
.Required. The input image need to be converted to grayscale if the model is
:en*
.Please set to
true
if the model is:en*
.
@spec init( binary() | :en | :en_fp16 | :en_int8 | :ch | :ch_fp16 | :ch_int8 | :cn | :cn_int8, nil | Keyword.t() ) :: {:error, String.t()} | Evision.DNN.Net.t()
Initialize model.
Positional arguments
model:
String.t()
|:en
|:en_fp16
|:en_int8
|:ch
|:ch_fp16
|:ch_int8
|:cn
|:cn_int8
.
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 input_size() :: {100, 32}
Get default input size
@spec model_info( :ch | :ch_fp16 | :ch_int8 | :cn | :cn_int8 | :en | :en_fp16 | :en_int8 ) :: {String.t(), String.t()}
Model URL and filename of predefined model.
@spec postprocess(Evision.Mat.t(), :ch | :cn | :en | [String.t()]) :: String.t()
Postprocessing the results.
infer/4
will call this function automatically.
Positional arguments
image:
Evision.Mat.maybe_mat_in()
.Input image.
@spec preprocess(Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), boolean()) :: Evision.Mat.t()
Preprocessing the input image.
infer/4
will call this function automatically.
Positional arguments
image:
Evision.Mat.maybe_mat_in()
.Input image.
@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 target_vertices() :: Nx.Tensor.t()
Get default target vertices
Generate quoted code from smart cell attrs.
Visualize the result.
Positional arguments
image:
Evision.Mat.maybe_mat_in()
.Original image.
results:
Evision.Mat.maybe_mat_in()
.Results given by
infer/2
.
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).