Documentation
¶
Index ¶
- Constants
- func InitORT()
- func LoadDict(path string)
- func PrewarmLogitsPool(size int, count int)
- func SaveTextLinesToImages(origImg image.Image, textLines []TextLine, outputDir string) error
- func SaveWithPadding(subImg image.Image, index int, outputDir string)
- type ClsEngine
- type DetEngine
- type RecEngine
- type RecognitionResult
- type TextLine
Constants ¶
View Source
const (
DictPath = "ppocrv5_dict.txt" // PP-OCRv5 的字典文件路径,已提取为全局变量
)
Variables ¶
This section is empty.
Functions ¶
func PrewarmLogitsPool ¶
PrewarmLogitsPool 暴露给外部的预热接口 size: 预期的缓冲区大小(float32 数量) count: 预先填充多少个对象到池中
func SaveTextLinesToImages ¶ added in v1.0.1
SaveTextLinesToImages 将检测到的文本行保存为本地图片文件 origImg: 原始大图 textLines: 包含坐标信息的文本行切片 outputDir: 保存路径(如 "./debug_crops")
Types ¶
type ClsEngine ¶
type ClsEngine struct {
Session *ort.DynamicAdvancedSession
}
func GetGlobalClsEngine ¶
func NewClsEngine ¶
type DetEngine ¶
type DetEngine struct {
Session *ort.AdvancedSession
InputTensor ort.Value
OutputTensor ort.Value
OutputData []float32 // 预留给结果的切片
}
DetEngine 检测引擎
var (
GlobalDetEngine *DetEngine
)
NewDetEngine 创建并初始化检测引擎
func NewDetEngine ¶
func (*DetEngine) DetectAndFixOrientation ¶
type RecEngine ¶
type RecEngine struct {
// 使用 DynamicAdvancedSession,它支持 RunWithBinding
Session *ort.DynamicAdvancedSession
}
func GetGlobalRecEngine ¶
GetGlobalRecEngine 获取全局唯一的识别引擎
type RecognitionResult ¶
RecognitionResult 代表每行文本的识别结果
func ImageToPatches ¶
func ImageToPatches(srcImg image.Image) []RecognitionResult
Click to show internal directories.
Click to hide internal directories.