captcha/README.md

69 lines
1.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Captcha Recognition
基于深度神经网络(DNN)的验证码识别
## 使用方法
1. 克隆项目到本地
```shell
git clone https://git.taurusxin.com/taurusxin/captcha.git
cd captcha
```
2. 创建虚拟环境并安装依赖
```shell
python -m venv .venv
# Windows
.venv\Scripts\Activate.ps1
# Linux/MacOS
source .venv/bin/activate
# 先安装 PyTorch GPU 版本cuda 12.4
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124
# 然后再安装其他依赖
pip install -r requirements.txt
```
3. 根据提示生成数据集生成3次数据集分别用于训练用于测试用于验证。
```shell
python captcha_gen.py
```
建议的数据集长度如下:
| 数据集 | 长度 |
| -------- | ------- |
| Train | 50000 |
| Test | 1000 |
| Predict | 30 |
4. 训练模型
```shell
python train.py
```
5. 测试模型
```shell
python test.py
```
6. 预测验证码
```shell
python predict.py
```
7. 输出 onnx 模型
```shell
python export_onnx.py
```