diff --git a/internal/captcha/handler.go b/internal/captcha/handler.go index 7eae4c0..a3fe279 100644 --- a/internal/captcha/handler.go +++ b/internal/captcha/handler.go @@ -35,9 +35,9 @@ var modelConfigs = map[string]struct { "Rotation-RotNetR.onnx": {remote: "[AntiCAP]-Rotation-RotNetR.onnx", optional: false}, "Siamese-ResNet18.onnx": {remote: "[AntiCAP]-Siamese-ResNet18.onnx", optional: false}, "CharSets.txt": {remote: "[Dddd]-CharSets.txt", optional: false}, - // Detection 模型需要 OpenCV 4.8+ 支持,暂标记为可选 - "Detection_Icon.onnx": {remote: "Detection_Icon.onnx", optional: true}, - "Detection_Text.onnx": {remote: "Detection_Text.onnx", optional: true}, + // Detection 模型已转换为 opset 12,兼容 OpenCV 4.6 + "Detection_Icon.onnx": {remote: "Detection_Icon.onnx", optional: false}, + "Detection_Text.onnx": {remote: "Detection_Text.onnx", optional: false}, } // 从 Gitea 仓库下载(公开仓库,无需认证) @@ -96,11 +96,11 @@ func (h *Handler) loadModels() { } } - // 加载 YOLO 检测模型(需要 OpenCV 4.8+) + // 加载 YOLO 检测模型(opset 12 兼容 OpenCV 4.6) iconPath := filepath.Join(h.modelPath, "Detection_Icon.onnx") if _, err := os.Stat(iconPath); err == nil { if err := opencv.LoadYOLO("icon", iconPath, ""); err != nil { - fmt.Printf("提示: Icon 检测模型加载失败 (需要 OpenCV 4.8+): %v\n", err) + fmt.Printf("警告: 加载 Icon 检测模型失败: %v\n", err) } else { fmt.Println("Icon 检测模型加载成功") } @@ -109,7 +109,7 @@ func (h *Handler) loadModels() { textPath := filepath.Join(h.modelPath, "Detection_Text.onnx") if _, err := os.Stat(textPath); err == nil { if err := opencv.LoadYOLO("text", textPath, ""); err != nil { - fmt.Printf("提示: Text 检测模型加载失败 (需要 OpenCV 4.8+): %v\n", err) + fmt.Printf("警告: 加载 Text 检测模型失败: %v\n", err) } else { fmt.Println("Text 检测模型加载成功") } diff --git a/models/Detection_Icon.onnx b/models/Detection_Icon.onnx index 46830cd..7ceb9bb 100644 Binary files a/models/Detection_Icon.onnx and b/models/Detection_Icon.onnx differ diff --git a/models/Detection_Text.onnx b/models/Detection_Text.onnx index 8c5e405..555d6bf 100644 Binary files a/models/Detection_Text.onnx and b/models/Detection_Text.onnx differ