captcha/README.md

63 lines
995 B
Markdown
Raw Normal View History

2024-09-30 11:05:35 +08:00
# 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次数据集分别用于训练用于测试用于验证。
2024-09-30 11:11:03 +08:00
```shell
python captcha_gen.py
```
2024-09-30 11:05:35 +08:00
建议的数据集长度如下:
| 数据集 | 长度 |
| -------- | ------- |
| Train | 50000 |
| Test | 1000 |
| Predict | 30 |
4. 训练模型
```shell
python train.py
```
5. 测试模型
```shell
python test.py
```
6. 预测验证码
```shell
python predict.py
```