mltu: I can't train my private dataset

I’m trying to use captcha to text but I can’t train my dataset like you. When I tried with the dataset you gave, it worked without any problems, but when I changed my own images with yours, I had problems. A few examples from my dataset with 10129 images:

000a2544266070484f9e651067d41b1e-jhlh 000db107392d7af6a5a5239286724ea1-hlfg 0a9474ddd6ca48343277b8dd9ba4aaea-rulr

I made a change in train.py file like this: label = os.path.splitext(file)[0] -> label = os.path.splitext(file)[0].split('-')[1].

Because the names of my images are not captcha_answer.png like yours, but md5hash-captcha_answer.png. So I made a change in this way and made it take the captcha_answer parameter in the same way.

In the config.py file, since all my images are 350x100, I changed self.height = 100 and self.width = 350. Then I got the following error. Can you help me solve this?

image

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

Thanks! I solved the problem using this code.

import os
import cv2
import numpy as np
from PIL import Image


for img_path in os.listdir('Datasets/captcha_images_v2'):
    old_path = 'Datasets/captcha_images_v2/' + img_path
    
    img_pil = Image.open(old_path)
    img_np = np.array(img_pil)
    img_cv2 = cv2.cvtColor(img_np, cv2.COLOR_RGB2BGR)

    new_path = old_path.replace('captcha_images_v2', 'my_dataset')

    cv2.imwrite(new_path, img_cv2)

But before closing the issue, I want to ask you a few questions. How many epochs do you think I should use for this project? I noticed that it works when I set self.height=100, self.width=350 again. Do you think I should train this way or 50, 200? (all my images are in 100x350 format). Other than that, if you have any suggestions for this project, I’d love to hear it. Thanks again!