def get_batch(self, n, size=128):
    batch_x = np.zeros([size, (self.image_height * self.image_width)])
    batch_y = np.zeros([size, (self.max_captcha * self.char_set_len)])
    max_batch = int((len(self.img_list) / size))
    if ((max_batch - 1) < 0):
        raise TrainError('训练集图片数量需要大于每批次训练的图片数量')
    if (n > (max_batch - 1)):
        n = (n % max_batch)
    s = (n * size)
    e = ((n + 1) * size)
    this_batch = self.img_list[s:e]
    for (i, img_name) in enumerate(this_batch):
        (label, image_array) = self.gen_captcha_text_image(img_name)
        image_array = self.convert2gray(image_array)
        batch_x[i, :] = (image_array.flatten() / 255)
        batch_y[i, :] = self.text2vec(label)
    return (batch_x, batch_y)
def get_batch(self, n, size=128):
    batch_x = np.zeros([size, (self.image_height * self.image_width)])
    batch_y = np.zeros([size, (self.max_captcha * self.char_set_len)])
    max_batch = int((len(self.img_list) / size))
    if ((max_batch - 1) < 0):
        raise TrainError('训练集图片数量需要大于每批次训练的图片数量')
    if (n > (max_batch - 1)):
        n = (n % max_batch)
    s = (n * size)
    e = ((n + 1) * size)
    this_batch = self.img_list[s:e]
    for (i, img_name) in enumerate(this_batch):
        (label, image_array) = self.gen_captcha_text_image(img_name)
        image_array = self.convert2gray(image_array)
        batch_x[i, :] = (image_array.flatten() / 255)
        batch_y[i, :] = self.text2vec(label)
    return (batch_x, batch_y)