Align task API and add FunCaptcha support
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
三种求解方法 (按优先级):
|
||||
1. 模板匹配: 背景图 + 模板图 → Canny → matchTemplate
|
||||
2. 边缘检测: 单图 Canny → findContours → 筛选方形轮廓
|
||||
3. CNN 兜底: ONNX 推理 → sigmoid → x 百分比 → 像素
|
||||
3. CNN 兜底: ONNX 推理 → sigmoid → 缺口中心 x 百分比 → 像素
|
||||
|
||||
OpenCV 延迟导入,未安装时退化到 CNN only。
|
||||
"""
|
||||
@@ -60,6 +60,7 @@ class SlideSolver(BaseSolver):
|
||||
|
||||
Returns:
|
||||
{"gap_x": int, "gap_x_percent": float, "confidence": float, "method": str}
|
||||
其中 gap_x 统一表示缺口中心点的 x 坐标。
|
||||
"""
|
||||
bg = self._load_image(bg_image)
|
||||
|
||||
@@ -168,12 +169,11 @@ class SlideSolver(BaseSolver):
|
||||
arr = arr[np.newaxis, np.newaxis, :, :] # (1, 1, H, W)
|
||||
|
||||
outputs = self._onnx_session.run(None, {"input": arr})
|
||||
percent = float(outputs[0][0][0])
|
||||
|
||||
gap_x = int(percent * orig_w)
|
||||
center_ratio = float(outputs[0][0][0])
|
||||
gap_x = int(center_ratio * orig_w)
|
||||
return {
|
||||
"gap_x": gap_x,
|
||||
"gap_x_percent": percent,
|
||||
"gap_x_percent": center_ratio,
|
||||
"confidence": 0.5, # CNN 无置信度
|
||||
"method": "cnn",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user