Docs /Templates/ sinapsis-easyocr

EasyOCR

sinapsis-easyocrOCReasyocrdocumentimageoptical_character_recognition

Python template · sinapsis_easyocr.templates.easy_ocr

Overview

EasyOCR template for performing Optical Character Recognition (OCR) on images.

Capabilities

Capabilities: not set

Installation

Install the published package using pip or uv.

Terminalbash
pip install sinapsis-easyocr==1.0.0
uv pip install sinapsis-easyocr==1.0.0
uv add sinapsis-easyocr==1.0.0

Configuration

Effective fields from the inspector schema, including nested Pydantic model fields.

metadata
sinapsis_core.template_base.base_models.TemplateMetadata | None
Optional
Default: null
img_width
int
Optional
Default: 1024
img_height
int
Optional
Default: 1024
get_full_text

Enable the creation of a TextPacket containing all the individual text detections. Defaults to False.

bool
Optional
Default: false
reader_params

Params required to initialize easyocr.Reader class. Defaults to {"lang_list": ["en"]}. The full list of supported languages can be consulted in: https://www.jaided.ai/easyocr/

ReaderParams
Optional
Default: null
gpu
bool
Optional
Default: true
verbose
bool
Optional
Default: true
detector
bool
Optional
Default: true
quantize
bool
Optional
Default: true
lang_list
list[str]
Optional
Default: ["en"]
recognizer
bool
Optional
Default: true
recog_network
str
Optional
Default: "standard"
detect_network
typing.Literal['craft', 'dbnet18']
Optional
Default: "craft"
cudnn_benchmark
bool
Optional
Default: false
download_enabled
bool
Optional
Default: true
user_network_directory
str | None
Optional
Default: null
model_storage_directory
str | None
Optional
Default: null
read_text_params

Params required by easyocr.Reader.readtext method. Defaults to None.

ReaderTextParams
Optional
Default: null
x_ths
float
Optional
Default: 1
y_ths
float
Optional
Default: 0.5
detail
int
Optional
Default: 1
decoder
str
Optional
Default: "greedy"
workers
int
Optional
Default: 0
low_text
float
Optional
Default: 0.4
min_size
int
Optional
Default: 20
beamWidth
int
Optional
Default: 5
mag_ratio
float
Optional
Default: 1
paragraph
bool
Optional
Default: false
slope_ths
float
Optional
Default: 0.1
threshold
float
Optional
Default: 0.2
width_ths
float
Optional
Default: 0.5
add_margin
float
Optional
Default: 0.1
batch_size
int
Optional
Default: 1
filter_ths
float
Optional
Default: 0.003
height_ths
float
Optional
Default: 0.5
canvas_size
int
Optional
Default: 2560
ycenter_ths
float
Optional
Default: 0.5
contrast_ths
float
Optional
Default: 0.1
bbox_min_size
int
Optional
Default: 3
bbox_min_score
float
Optional
Default: 0.2
link_threshold
float
Optional
Default: 0.4
max_candidates
int
Optional
Default: 0
text_threshold
float
Optional
Default: 0.7
adjust_contrast
float
Optional
Default: 0.5
enable_img_resize
bool
Optional
Default: false

Configuration example

Example from the Python docstring:

yaml
agent:
  name: my_agent_test

templates:
- template_name: InputTemplate
  class_name: InputTemplate
  attributes: {}

- template_name: EasyOCR
  class_name: EasyOCR
  template_input: InputTemplate
  attributes:
    reader_params:
      lang_list: ["en"]
    get_full_text: False
Show schema-based configuration skeleton
yaml
templates:
  - template_name: "EasyOCR"
    class_name: "EasyOCR"
    attributes:
      img_width: 1024
      img_height: 1024
      get_full_text: false
      reader_params:
        gpu: true
        verbose: true
        detector: true
        quantize: true
        lang_list: ["en"]
        recognizer: true
        recog_network: "standard"
        detect_network: "craft"
        cudnn_benchmark: false
        download_enabled: true
        user_network_directory: null
        model_storage_directory: null
      read_text_params:
        x_ths: 1
        y_ths: 0.5
        detail: 1
        decoder: "greedy"
        workers: 0
        low_text: 0.4
        min_size: 20
        beamWidth: 5
        mag_ratio: 1
        paragraph: false
        slope_ths: 0.1
        threshold: 0.2
        width_ths: 0.5
        add_margin: 0.1
        batch_size: 1
        filter_ths: 0.003
        height_ths: 0.5
        canvas_size: 2560
        ycenter_ths: 0.5
        contrast_ths: 0.1
        bbox_min_size: 3
        bbox_min_score: 0.2
        link_threshold: 0.4
        max_candidates: 0
        text_threshold: 0.7
        adjust_contrast: 0.5
      enable_img_resize: false

Inheritance

Immediate parent: sinapsis_core.template_base.template.Template

Environment variables

Environment definitions belong to their canonical Python modules.

No directly related environment variables listed.