Add slide and rotate interactive captcha solvers

New solver subsystem with independent models:
- GapDetectorCNN (1x128x256 grayscale → sigmoid) for slide gap detection
- RotationRegressor (3x128x128 RGB → sin/cos via tanh) for rotation angle prediction
- SlideSolver with 3-tier strategy: template match → edge detect → CNN fallback
- RotateSolver with ONNX sin/cos → atan2 inference
- Generators, training scripts, CLI commands, and slide track utility

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Hua
2026-03-11 18:07:06 +08:00
parent 90d6423551
commit 9b5f29083e
20 changed files with 1440 additions and 10 deletions

View File

@@ -34,6 +34,11 @@ REAL_3D_TEXT_DIR = REAL_DIR / "3d_text"
REAL_3D_ROTATE_DIR = REAL_DIR / "3d_rotate"
REAL_3D_SLIDER_DIR = REAL_DIR / "3d_slider"
# Solver 数据目录
SOLVER_DATA_DIR = DATA_DIR / "solver"
SLIDE_DATA_DIR = SOLVER_DATA_DIR / "slide"
ROTATE_SOLVER_DATA_DIR = SOLVER_DATA_DIR / "rotate"
# ============================================================
# 模型输出目录
# ============================================================
@@ -47,6 +52,7 @@ for _dir in [
REAL_NORMAL_DIR, REAL_MATH_DIR,
REAL_3D_TEXT_DIR, REAL_3D_ROTATE_DIR, REAL_3D_SLIDER_DIR,
CLASSIFIER_DIR, CHECKPOINTS_DIR, ONNX_DIR,
SLIDE_DATA_DIR, ROTATE_SOLVER_DATA_DIR,
]:
_dir.mkdir(parents=True, exist_ok=True)
@@ -241,3 +247,40 @@ SERVER_CONFIG = {
"host": "0.0.0.0",
"port": 8080,
}
# ============================================================
# Solver 配置 (交互式验证码求解)
# ============================================================
SOLVER_CONFIG = {
"slide": {
"canny_low": 50,
"canny_high": 150,
"cnn_input_size": (128, 256), # H, W
},
"rotate": {
"input_size": (128, 128), # H, W
"channels": 3, # RGB
},
}
SOLVER_TRAIN_CONFIG = {
"slide_cnn": {
"epochs": 50,
"batch_size": 64,
"lr": 1e-3,
"synthetic_samples": 30000,
"val_split": 0.1,
},
"rotate": {
"epochs": 80,
"batch_size": 64,
"lr": 5e-4,
"synthetic_samples": 50000,
"val_split": 0.1,
},
}
SOLVER_REGRESSION_RANGE = {
"slide": (0, 1), # 归一化百分比
"rotate": (0, 360), # 角度
}