返回一个验证码的array形式和对应的字符串标签 :return:tuple (str, numpy.array)
(img_path, img_name)
| 66 | |
| 67 | @staticmethod |
| 68 | def gen_captcha_text_image(img_path, img_name): |
| 69 | """ |
| 70 | 返回一个验证码的array形式和对应的字符串标签 |
| 71 | :return:tuple (str, numpy.array) |
| 72 | """ |
| 73 | # 文件 |
| 74 | label = img_name.split("_")[-1].replace('.jpg','') |
| 75 | # 文件 |
| 76 | img_file = os.path.join(img_path, img_name) |
| 77 | captcha_image = Image.open(img_file) |
| 78 | captcha_array = np.array(captcha_image) # 向量化 |
| 79 | return label, captcha_array |
| 80 | |
| 81 | |
| 82 | def get_train_batch(self, n, size=64): |
no outgoing calls
no test coverage detected