docstr: :param annotation_fn:
  :param lexicon_fn:
  :param valid_target_len:
  :param img_width_range: only needed for training set
  :param word_len:
  :param epochs:
  :return:
docstr_tok: [":","param","annotation_fn",":",":","param","lexicon_fn",":",":","param","valid_target_len",":",":","param","img_width_range",":","only","needed","for","training","set",":","param","word_len",":",":","param","epochs",":",":","return",":"]
code: def __init__(
      self, annotation_fn, buckets, epochs=1000, max_width=None
  ):
      """
      :param annotation_fn:
      :param lexicon_fn:
      :param valid_target_len:
      :param img_width_range: only needed for training set
      :param word_len:
      :param epochs:
      :return:
      """
      self.epochs = epochs
      self.max_width = max_width
  
      self.bucket_specs = buckets
      self.bucket_data = BucketData()
  
      dataset = TFRecordDataset([annotation_fn])
      dataset = dataset.map(self._parse_record)
      dataset = dataset.shuffle(buffer_size=10000)
      self.dataset = dataset.repeat(self.epochs)
  
file_path: attention-ocr/aocr/util/data_gen.py
imports: from __future__ import absolute_import
  import sys
  import numpy
  import tensorflow
  from PIL import Image
  from six import BytesIO
  from .bucketdata import BucketData
label_desc: Use image node_id 2 to create a new DataGen object from inherited base classes: object with example: obj = DataGen(annotation_fn, buckets, epochs, max_width)