MCPcopy
hub / github.com/luyishisi/Anti-Anti-Spider / gen_captcha_text_image

Method gen_captcha_text_image

train_model.py:68–79  ·  view source on GitHub ↗

返回一个验证码的array形式和对应的字符串标签 :return:tuple (str, numpy.array)

(img_path, img_name)

Source from the content-addressed store, hash-verified

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):

Callers 3

__init__Method · 0.95
get_train_batchMethod · 0.95
get_verify_batchMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected