44 Commits
Author SHA1 Message Date
Cmake 89145c9064 feat: 新增目标类型检测与物品分类
Build and Push / build (push) Successful in 6m17s
- /api/detection/object:YOLO11n COCO 80 类,返回 class/confidence/box,按类内 NMS
- /api/classify/object:YOLO11n-cls ImageNet 1000 类,softmax 取 top-5
- 两个模型不入镜像(models/ 挂载卷),启动时存在即加载,缺失只影响对应接口
- 类型展示目录补两条能力 + 两个模型(2.62M / 2.81M 参数)
- 试用页补字段映射
2026-12-03 21:46:04 +08:00
Hermes 2225f04866 feat(rotate): 双图旋转改为上游的环带模板匹配算法
Build and Push / build (push) Successful in 5m59s
原来那版是「RotNet(内圈) − RotNet(外圈) 取模」,纯粹自己凑的,与上游毫无对应关系,
所以结果 344 无法解释也无法校验。

按上游 solve_double_rotate 逐行移植(pkg/opencv/opencv.cpp 新增 cv_double_rotate):
  1) 内圈:rot90 四次数「整行只有纯黑/纯白」的行数 → 上下左右剪边 → 按短边取偶数直径 resize
  2) 外圈:从中心沿四条射线找第一个非纯黑非纯白像素 → 外扩 resize_check_pixel → 剪边 resize
  3) 两边各做圆环 mask(半径 R / 内半径 R-check_pixel)得到环带
  4) 内圈环带按候选角 getRotationMatrix2D+warpAffine 旋转,与外圈环带 matchTemplate
     (TM_CCOEFF_NORMED) 取最大相似度;粗搜 1..360 step 10,命中更好就追加 angle±10 细化窗口,
     最多保留 5 个候选(与上游边遍历边追加的行为一致)
  5) inner_angle = raw_angle * speed_ratio/(speed_ratio+1)

返回结构也对齐上游:{angle(兼容), inner_angle, raw_angle, similarity};
剪不出有效环带时返回 -2,HTTP 层映射成 400。
2026-12-03 18:14:42 +08:00
Hermes 5a5850e9be fix: 旋转预处理对齐上游 BILINEAR、点选顺序换成真匈牙利算法
Build and Push / build (push) Successful in 4m24s
对照上游 Python + onnxruntime 做了 A/B(模型直接用仓库里那几份 onnx),结论:

1) 旋转:同一张官方例图,上游预处理预测 229,我们预测 319,差 90°。
   逐项排除后锁定在 resize 滤波器:上游 solve_single_rotate 用 PIL 的 BILINEAR,
   我们用了 imaging.Lanczos;把 Go 的裁剪 + BILINEAR 复现出来正好是 229。
   → preprocessRotation 改 imaging.Linear。这是 360 类分类器,缩放核足以改变 argmax。

2) 点选顺序:我们的 "hungarian" 其实是逐行贪心,不是匈牙利算法。
   同一组检测框实测:
     贪心    0.7289 + 0.6894 + 0.7238 = 2.1421(顺序错:提示第1个对到目标第2个)
     全局最优 0.6721 + 0.8752 + 0.7238 = 2.2711(与上游 linear_sum_assignment 一致)
   → 新增 hungarianAssign(增广路 O(n^3),行数>列数时补方阵),
     未匹配位置按上游填 [0,0,0,0] 而不是 null。

3) 顺带清掉 Math 里每次请求都打印的 DEBUG 输出(output 前 10 个值 / 位置0 argmax)。

A/B 还确认了两件「不是 bug」的事:
· OCR 官方例图我们出 'jepv',上游 Python 也是 'jepv' → 大小写是模型行为,不是移植问题
· Math 官方例图上游读出 '8×1=?' 计算 8,我们返回 8 → 一致
2026-12-03 17:36:41 +08:00
Hermes 68f181e0ac fix: 相似度改走双输出 Siamese(对齐上游 AntiCAP),阴影滑块补尺寸校验
Build and Deploy / build (push) Failing after 3m8s
Build and Deploy / deploy (push) Skipped
对照上游 https://github.com/81NewArk/AntiCAP 逐项核对后修两处:

1) 相似度(internal/captcha/handler.go + pkg/onnx)
   上游是 outputs = session.run(None, feed); emb1, emb2 = outputs[0], outputs[1]
   —— 模型本身分别吐出两路 embedding。
   旧实现只 run 了 1 个输出(onnx.cpp 里 Run 的 output_count = 1),
   再把这个张量从中间切成两半当两个 embedding,
   实测四组完全不同的输入返回同一个值(0.49188173),等于接口失效。
   现在新增 onnx_run_dual_input_two_outputs 取前两个输出,
   两路各算 L2 距离后 1/(1+dist);单输出模型保留旧路径回退并打日志。

2) 阴影滑块(pkg/opencv + internal/handler)
   上游 solve_slider_comparison 要求 target 与 background 同尺寸
   (PIL ImageChops.difference 的硬前提),旧实现不校验,
   尺寸不同时直接抛 OpenCV -209 尺寸不匹配,返回 500。
   现在前置校验并返回 400 + 明确原因;SliderMatch 也补了「滑块不能大于背景」的校验。

预处理与旋转逻辑核对结论:preprocessSiamese(105×105 / ImageNet norm)与
preprocessRotation(正方形中心裁剪 + h/√2 + 224 / ImageNet norm)与上游一致,未改。
2026-12-03 08:23:51 +08:00
admin 47970834ec fix: remove ImageNet normalization for YOLO (match Ultralytics default)
Build and Deploy / build (push) Successful in 2m45s
Build and Deploy / deploy (push) Successful in 10s
- Ultralytics YOLO only does /255 normalization, no ImageNet mean/std
- This was causing detection box coordinate drift
2026-07-18 05:37:54 +00:00
admin e423f2ddd3 docs: add comments to rotation preprocessing
Build and Deploy / build (push) Successful in 2m40s
Build and Deploy / deploy (push) Successful in 9s
2026-07-17 23:14:27 +00:00
admin 10a2acaf7b fix: use letterbox preprocessing for YOLO (same as ultralytics)
Build and Deploy / build (push) Successful in 3m12s
Build and Deploy / deploy (push) Successful in 9s
- Keep aspect ratio with gray padding instead of stretching
- Add ImageNet normalization (mean/std)
- Proper coordinate restoration with offset/scale
- This matches original Python ultralytics preprocessing
2026-07-17 21:02:13 +00:00
admin 16e49a6d9e fix: lower threshold for small order images (284x106)
Build and Deploy / build (push) Successful in 2m42s
Build and Deploy / deploy (push) Successful in 9s
2026-07-17 20:52:36 +00:00
admin 1187a35fcf fix: correct YOLO output format [features, boxes] with clear comments
Build and Deploy / build (push) Successful in 2m41s
Build and Deploy / deploy (push) Successful in 8s
2026-07-17 20:25:23 +00:00
admin 3ef9742376 fix: YOLO output format is [boxes, features] not [features, boxes]
Build and Deploy / build (push) Successful in 2m40s
Build and Deploy / deploy (push) Successful in 9s
2026-07-17 20:18:14 +00:00
admin e2ac2fbfcc debug: print YOLO output values and max confidence
Build and Deploy / build (push) Successful in 2m43s
Build and Deploy / deploy (push) Successful in 9s
2026-07-17 14:43:59 +00:00
admin c096e364cd fix: lower confidence threshold for small order images
Build and Deploy / build (push) Successful in 2m42s
Build and Deploy / deploy (push) Successful in 9s
2026-07-17 14:18:48 +00:00
admin 5cb160432a fix: scale YOLO coordinates from 640x640 to original image size, add debug output
Build and Deploy / build (push) Successful in 2m42s
Build and Deploy / deploy (push) Successful in 9s
2026-07-17 13:14:41 +00:00
admin b0555e2281 feat: implement YOLO detection using ONNX Runtime (OpenCV 4.6 incompatible with YOLO11)
Build and Deploy / build (push) Successful in 2m43s
Build and Deploy / deploy (push) Successful in 9s
2026-07-17 12:59:36 +00:00
admin 588f0a846b fix: another UTF-8 string index bug in debug output
Build and Deploy / build (push) Successful in 2m44s
Build and Deploy / deploy (push) Successful in 9s
2026-07-17 12:54:32 +00:00
admin e17549c508 docs: add detailed comment for UTF-8 charset fix
Build and Deploy / build (push) Successful in 2m39s
Build and Deploy / deploy (push) Successful in 1s
2026-07-17 12:45:34 +00:00
admin f7cfc4a888 fix: use string slice for CHARS to handle UTF-8 multibyte chars correctly
Build and Deploy / build (push) Successful in 2m43s
Build and Deploy / deploy (push) Successful in 9s
2026-07-17 12:43:17 +00:00
admin 5a86d68228 debug: print full CHARS mapping and all 51 indices
Build and Deploy / build (push) Successful in 2m41s
Build and Deploy / deploy (push) Successful in 10s
2026-07-17 12:33:49 +00:00
admin 65c77452c2 debug: show raw indices and fix boundary check
Build and Deploy / build (push) Successful in 2m43s
Build and Deploy / deploy (push) Successful in 9s
2026-07-17 12:26:31 +00:00
admin ae4bf8dd36 debug: print argmax results for Math CTC decode
Build and Deploy / build (push) Successful in 2m42s
Build and Deploy / deploy (push) Successful in 9s
2026-07-17 12:19:55 +00:00
admin 0145bf9e44 debug: add logging for Math ONNX output
Build and Deploy / build (push) Successful in 2m41s
Build and Deploy / deploy (push) Successful in 9s
2026-07-17 12:12:48 +00:00
admin a3665ed63a fix: correct Math decode - output is [num_positions, batch, num_chars]
Build and Deploy / build (push) Successful in 3m3s
Build and Deploy / deploy (push) Successful in 11s
2026-07-17 11:53:17 +00:00
admin f2bc0ecdb2 fix: correct Math model output format - [T,B,C] not [C,B,T]
Build and Deploy / build (push) Successful in 2m45s
Build and Deploy / deploy (push) Successful in 9s
2026-07-17 11:48:15 +00:00
admin 6c123b7231 fix: correct Math model output transpose from [C,B,T] to [B,T,C]
Build and Deploy / build (push) Successful in 2m44s
Build and Deploy / deploy (push) Successful in 9s
2026-07-17 11:38:24 +00:00
admin 2fceca847f fix: use separate variable for evalMathExpression result
Build and Deploy / build (push) Successful in 2m43s
Build and Deploy / deploy (push) Successful in 9s
2026-07-17 11:25:29 +00:00
admin 7dae9a0901 fix: avoid GetOutputShape CGO crash by using fixed output dimensions
Build and Deploy / build (push) Failing after 2m24s
Build and Deploy / deploy (push) Has been skipped
2026-07-17 11:02:00 +00:00
admin dc58cc1dba fix: add panic recovery and boundary checks for Math function
Build and Deploy / deploy (push) Has been cancelled
Build and Deploy / build (push) Has been cancelled
2026-07-17 10:59:47 +00:00
admin 89b688424a fix: rename min function to avoid conflict with builtin
Build and Deploy / build (push) Successful in 2m39s
Build and Deploy / deploy (push) Successful in 9s
2026-07-17 10:57:45 +00:00
admin 8c8787135d fix: rewrite Math preprocessing and decode to match original AntiCAP implementation
Build and Deploy / build (push) Successful in 2m42s
Build and Deploy / deploy (push) Successful in 9s
2026-07-17 10:33:04 +00:00
admin 0c2225bdbb fix: handle dynamic dimensions in Math output shape
Build and Deploy / build (push) Successful in 2m42s
Build and Deploy / deploy (push) Successful in 9s
2026-07-17 10:24:41 +00:00
admin 61f3223885 fix: correct Math CRNN output transpose and CTC decoding
Build and Deploy / build (push) Successful in 2m43s
Build and Deploy / deploy (push) Successful in 9s
2026-07-17 10:03:40 +00:00
admin bd8db9ba27 docs: mark Detection models as optional (YOLO11 requires special post-processing)
Build and Deploy / build (push) Successful in 3m10s
Build and Deploy / deploy (push) Successful in 1s
2026-07-17 01:32:36 +00:00
admin 151f3f07e0 fix: convert YOLO PT to ONNX opset 12 for OpenCV 4.6 compatibility
Build and Deploy / build (push) Successful in 3m0s
Build and Deploy / deploy (push) Successful in 9s
2026-07-17 01:26:01 +00:00
admin ee578298b9 fix: mark Detection models as optional (requires OpenCV 4.8+)
Build and Deploy / build (push) Failing after 2m58s
Build and Deploy / deploy (push) Has been skipped
2026-07-17 01:20:04 +00:00
admin d918fb1654 fix: parse charset as JSON array instead of line-by-line
Build and Deploy / build (push) Successful in 5m43s
Build and Deploy / deploy (push) Successful in 9s
2026-07-17 00:42:42 +00:00
admin 3b45e76a7b fix: mark Detection models as required now they are available
Build and Deploy / deploy (push) Has been cancelled
Build and Deploy / build (push) Has been cancelled
2026-07-17 00:02:37 +00:00
admin eb995760f7 fix: upgrade ONNX Runtime to 1.18.0 for IR v10, mark Detection models as optional
Build and Deploy / build (push) Successful in 2m43s
Build and Deploy / deploy (push) Has been skipped
2026-07-16 23:49:03 +00:00
admin 28998964ef fix: 移除未使用的 import
Build and Deploy / build (push) Failing after 2m55s
Build and Deploy / deploy (push) Has been skipped
2026-07-16 22:45:08 +00:00
admin 015b1406e2 feat: 完整实现 CGO 版本 - ONNX Runtime + OpenCV DNN (YOLO)
Build and Deploy / build (push) Failing after 2m22s
Build and Deploy / deploy (push) Has been skipped
2026-07-16 21:27:26 +00:00
admin 7afefe5e9f feat: 实现 ONNX Runtime CGO 绑定和 OCR/Math 推理逻辑
Build and Deploy / build (push) Failing after 2m23s
Build and Deploy / deploy (push) Has been skipped
2026-07-16 21:14:34 +00:00
admin 5dacb61122 fix: 恢复模型原始文件名
Build and Deploy / build (push) Successful in 2m37s
Build and Deploy / deploy (push) Has been skipped
2026-07-16 19:55:23 +00:00
admin e9d3bdbc68 fix: 从 Gitea 仓库下载模型(无需认证)
Build and Deploy / build (push) Has been cancelled
Build and Deploy / deploy (push) Has been cancelled
2026-07-16 19:52:57 +00:00
admin a3750ffce4 feat: 启动时自动下载缺失的模型文件
Build and Deploy / deploy (push) Has been cancelled
Build and Deploy / build (push) Has been cancelled
2026-07-16 19:51:13 +00:00
admin 524c404194 feat: initial commit - Go + CGO captcha recognition service
Build and Deploy / build-frontend (push) Failing after 2s
Build and Deploy / build-backend (push) Has been skipped
Build and Deploy / build-docker (push) Has been skipped
Build and Deploy / deploy (push) Has been skipped
Features:
- Go + CGO ONNX/OpenCV wrapper for high performance
- SQLite (default) / MySQL database support
- Optional Redis caching
- JWT authentication system
- Multiple captcha recognition APIs:
  - OCR text recognition
  - Slider captcha matching
  - Image similarity comparison
  - Rotation captcha detection
  - Object detection
- React frontend with install wizard
- Docker and docker-compose support
- Gitea CI/CD pipeline

Project structure:
- cmd/server: Main entry point
- internal/: Core business logic
- pkg/onnx: ONNX Runtime CGO wrapper
- pkg/opencv: OpenCV CGO wrapper
- web/: React frontend
- deploy/: Deployment configs
- scripts/: Utility scripts
2026-07-16 08:56:38 +00:00