41 lines
970 B
Python
41 lines
970 B
Python
"""
|
||
训练 3D 立体验证码识别模型 (ThreeDCNN)
|
||
|
||
用法: python -m training.train_3d
|
||
"""
|
||
|
||
from config import (
|
||
THREED_CHARS,
|
||
IMAGE_SIZE,
|
||
SYNTHETIC_3D_DIR,
|
||
REAL_3D_DIR,
|
||
)
|
||
from generators.threed_gen import ThreeDCaptchaGenerator
|
||
from models.threed_cnn import ThreeDCNN
|
||
from training.train_utils import train_ctc_model
|
||
|
||
|
||
def main():
|
||
img_h, img_w = IMAGE_SIZE["3d"]
|
||
model = ThreeDCNN(chars=THREED_CHARS, img_h=img_h, img_w=img_w)
|
||
|
||
print("=" * 60)
|
||
print("训练 3D 立体验证码识别模型 (ThreeDCNN)")
|
||
print(f" 字符集: {THREED_CHARS} ({len(THREED_CHARS)} 字符)")
|
||
print(f" 输入尺寸: {img_h}×{img_w}")
|
||
print("=" * 60)
|
||
|
||
train_ctc_model(
|
||
model_name="threed",
|
||
model=model,
|
||
chars=THREED_CHARS,
|
||
synthetic_dir=SYNTHETIC_3D_DIR,
|
||
real_dir=REAL_3D_DIR,
|
||
generator_cls=ThreeDCaptchaGenerator,
|
||
config_key="threed",
|
||
)
|
||
|
||
|
||
if __name__ == "__main__":
|
||
main()
|