Documentation
¶
Index ¶
- Variables
- type Config
- type Engine
- func (e *Engine) Close() error
- func (e *Engine) DecodeImage(data []byte) (image.Image, error)
- func (e *Engine) DetectBoundingBoxes(data []byte) ([]utils.Box, error)
- func (e *Engine) GetConfig(modelName string) common.ModelConfig
- func (e *Engine) ImageDetectBoundingBoxes(img image.Image) ([]utils.Box, error)
- func (e *Engine) ImageRunOCR(img image.Image) ([]Result, error)
- func (e *Engine) Init() error
- func (e *Engine) IsReady() bool
- func (e *Engine) RegisterWorkflow(name string, factory WorkflowFactory)
- func (e *Engine) RunOCR(data []byte) ([]Result, error)
- type Option
- type Result
- type Workflow
- type WorkflowFactory
Constants ¶
This section is empty.
Variables ¶
var DefaultORTLibPath string = getDefaultORTLibPath()
DefaultORTLibPath is the default path to the ONNX Runtime shared library (set by init from GOOS).
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Models map[string]common.ModelConfig
EnableBoxMerge bool
WorkflowType string // "PaddleOCR" (default) or "GLM-OCR"
}
Config holds all configuration for the Engine.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine coordinates the detect → classify → recognize pipeline.
func (*Engine) DetectBoundingBoxes ¶
func (*Engine) ImageDetectBoundingBoxes ¶
func (*Engine) RegisterWorkflow ¶
func (e *Engine) RegisterWorkflow(name string, factory WorkflowFactory)
type Option ¶
type Option func(*Engine)
Option configures an Engine before initialization.
func WithBoxMerge ¶
WithBoxMerge enables or disables box merging.
func WithModelConfig ¶
func WithModelConfig(modelName string, config common.ModelConfig) Option
WithModelConfig sets the model config for the named model.
func WithWorkflowType ¶
WithWorkflowType sets the workflow type ("PaddleOCR" or "GLM-OCR").
type Result ¶
type Result struct {
Box [][2]int `json:"box"` // [[x1,y1],[x2,y2],[x3,y3],[x4,y4]]
Text string `json:"text"`
Score float64 `json:"score"`
Children []Result `json:"children,omitempty"`
}
Result is a single detected text region. When Children is non-empty, this is a merged parent region containing child text lines.
type Workflow ¶
type Workflow struct {
// contains filtered or unexported fields
}
Workflow holds the three-stage pipeline components.
func NewGLMOCRWorkflow ¶
func NewGLMOCRWorkflow(engineConf *Config, configSrc common.ConfigSource) *Workflow
func NewPaddleOCRWorkflow ¶
func NewPaddleOCRWorkflow(engineConf *Config, configSrc common.ConfigSource) *Workflow
func NewWorkflow ¶
func NewWorkflow( detector detect.Detector, classifier classify.Classifier, recognizer recognize.Recognizer, configSrc common.ConfigSource, ) *Workflow
func (*Workflow) DetectOnly ¶
DetectOnly runs only the detection model and returns boxes.
type WorkflowFactory ¶
type WorkflowFactory func(engineConf *Config, configSrc common.ConfigSource) *Workflow