Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func ValidateModels ¶
ValidateModels 在导入和加载时校验配套配置,不接受自定义算子或外部权重。
Types ¶
type PaddleConfig ¶
type PaddleConfig struct {
Library string `json:"library"`
Worker string `json:"worker"`
Directory string `json:"directory"`
Thresholds Thresholds `json:"thresholds"`
}
PaddleConfig 指定一组检测和识别模型,Linux 使用原生辅助进程以兼容静态内核。
type PaddleProvider ¶
type PaddleProvider struct {
Config func() PaddleConfig
// contains filtered or unexported fields
}
func (*PaddleProvider) Available ¶
func (p *PaddleProvider) Available() bool
type Provider ¶
type Provider interface {
Available() bool
Recognize(context.Context, string) ([]map[string]string, error)
}
Provider 只负责识别,结果存储和搜索索引由调用方统一维护。 结果保留字符串列,兼容现有 OCR HTTP 接口的 ocrJSON 字段。
type ProviderID ¶
type ProviderID string
const ( Tesseract ProviderID = "tesseract" PaddleOCR ProviderID = "paddleocr" )
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry 串行调度识别,避免多个调用同时占用模型内存。
func NewRegistry ¶
func NewRegistry() *Registry
func (*Registry) Available ¶
func (r *Registry) Available(id ProviderID) bool
type Thresholds ¶
type Thresholds struct {
Detection *float64 `json:"detection"`
Box *float64 `json:"box"`
Recognition *float64 `json:"recognition"`
}
Thresholds 仅覆盖本次识别的后处理参数,空值保留模型检测配置和既有识别阈值。
func (Thresholds) Validate ¶
func (t Thresholds) Validate() error
type WorkerRequest ¶
type WorkerRequest struct {
Config PaddleConfig `json:"config"`
Image string `json:"image"`
}
Click to show internal directories.
Click to hide internal directories.