Split the single "3d" captcha type into three independent expert models: - 3d_text: 3D perspective text OCR (renamed from old "3d", CTC-based ThreeDCNN) - 3d_rotate: rotation angle regression (new RegressionCNN, circular loss) - 3d_slider: slider offset regression (new RegressionCNN, SmoothL1 loss) CAPTCHA_TYPES expanded from 3 to 5 classes. Classifier samples updated to 50000 (10000 per class). New generators, model, dataset, training utilities, and full pipeline/export/CLI support for all subtypes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
39 lines
986 B
Python
39 lines
986 B
Python
"""
|
||
训练 3D 滑块验证码回归模型 (RegressionCNN)
|
||
|
||
用法: python -m training.train_3d_slider
|
||
"""
|
||
|
||
from config import (
|
||
IMAGE_SIZE,
|
||
SYNTHETIC_3D_SLIDER_DIR,
|
||
REAL_3D_SLIDER_DIR,
|
||
)
|
||
from generators.threed_slider_gen import ThreeDSliderGenerator
|
||
from models.regression_cnn import RegressionCNN
|
||
from training.train_regression_utils import train_regression_model
|
||
|
||
|
||
def main():
|
||
img_h, img_w = IMAGE_SIZE["3d_slider"]
|
||
model = RegressionCNN(img_h=img_h, img_w=img_w)
|
||
|
||
print("=" * 60)
|
||
print("训练 3D 滑块验证码回归模型 (RegressionCNN)")
|
||
print(f" 输入尺寸: {img_h}×{img_w}")
|
||
print(f" 任务: 预测滑块偏移 x 坐标")
|
||
print("=" * 60)
|
||
|
||
train_regression_model(
|
||
model_name="threed_slider",
|
||
model=model,
|
||
synthetic_dir=SYNTHETIC_3D_SLIDER_DIR,
|
||
real_dir=REAL_3D_SLIDER_DIR,
|
||
generator_cls=ThreeDSliderGenerator,
|
||
config_key="3d_slider",
|
||
)
|
||
|
||
|
||
if __name__ == "__main__":
|
||
main()
|