Compare commits

..

No commits in common. "2ef0dd8a99a1d5eebdee70e05058890068e7150c" and "05a8338c7278e0fcec2a664b2f822534e344772f" have entirely different histories.

2 changed files with 7 additions and 8 deletions

View File

@ -31,10 +31,6 @@ pip install -r requirements.txt
3. 根据提示生成数据集生成3次数据集分别用于训练用于测试用于验证。
```shell
python captcha_gen.py
```
建议的数据集长度如下:
| 数据集 | 长度 |
@ -43,6 +39,10 @@ python captcha_gen.py
| Test | 1000 |
| Predict | 30 |
```shell
python captcha_gen.py
```
4. 训练模型
```shell

View File

@ -29,9 +29,8 @@ def main():
model.eval()
# random pickup some test images
pickup_count = int(input("输入验证集的图片长度默认30") or 30)
input_rect = input("输入图片的行数和列数默认5x6")
pickup_rect = [int(i) for i in input_rect.split("x")] if input_rect else [5, 6]
pickup_count = 30
pickup_rect = [5, 6]
files = os.listdir(captcha_settings.PREDICT_DATASET_PATH)
images_picked = random.sample(files, pickup_count)
@ -39,7 +38,7 @@ def main():
fig, axes = plt.subplots(nrows=pickup_rect[0], ncols=pickup_rect[1], figsize=(10, 8))
for i, image_name in enumerate(images_picked):
real_text = image_name.split(".")[0].split("_")[-1]
file_path = os.path.join(captcha_settings.PREDICT_DATASET_PATH, image_name)
file_path = os.path.join(captcha_settings.TEST_DATASET_PATH, image_name)
pred_text = predict(model, file_path)
correct = real_text == pred_text
axes[i//pickup_rect[1], i%pickup_rect[1]].imshow(plt.imread(file_path))