mltu icon indicating copy to clipboard operation
mltu copied to clipboard

Error with only captcha digit datasets

Open Mudr0x opened this issue 6 months ago • 0 comments

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.

Mudr0x avatar Aug 05 '24 15:08 Mudr0x