Skip to content

Error with only captcha digit datasets #59

Description

@Mudr0x

Hello,

I'm testing your captcha to text tutorial and it works fine with alphanum captcha datasets, but fails with only digits captcha datasets (I'm testing a 4-digit captcha dataset):

C:\Projects\Captcha Solver\mltu-main\Tutorials\02_captcha_to_text>python inferenceModel.py 0%| | 0/28 [00:00<?, ?it/s] Traceback (most recent call last): File "C:\Projects\Captcha Solver\mltu-main\Tutorials\02_captcha_to_text\inferenceModel.py", line 41, in <module> cer = get_cer(prediction_text, label) File "C:\Users\mudro\AppData\Local\Programs\Python\Python310\lib\site-packages\mltu\utils\text_utils.py", line 79, in get_cer for pred_tokens, tgt_tokens in zip(preds, target): TypeError: 'int' object is not iterable

I fixed the code in inferenceModel.py with:
`
for image_path, label in tqdm(df):
image = cv2.imread(image_path.replace("\", "/"))

    prediction_text = model.predict(image)

    cer = get_cer(prediction_text, str(label).zfill(4))
    print(f"Image: {image_path}, Label: {str(label).zfill(4)}, Prediction: {prediction_text}, CER: {cer}")

    accum_cer.append(cer)

`

This code runs correctly but gives now bad predition results.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions