def __init__(self, config: YOLOConfig, dataset_list: str, dataset_type: str='converted_coco', image_path_prefix: str='', training: bool=True):
    self.dataset = parse_dataset(dataset_list=dataset_list, dataset_type=dataset_type, image_path_prefix=image_path_prefix)
    self._metayolos = []
    if (config.layer_count['yolo'] > 0):
        for i in range(config.layer_count['yolo']):
            self._metayolos.append(config.find_metalayer('yolo', i))
    elif (config.layer_count['yolo_tpu'] > 0):
        for i in range(config.layer_count['yolo_tpu']):
            self._metayolos.append(config.find_metalayer('yolo_tpu', i))
    else:
        raise RuntimeError('YOLODataset: model does not have a yolo or yolo_tpu layer')
    self._metanet = config.net
    self._metayolos_np = np.zeros((len(self._metayolos), (7 + len(self._metayolos[(- 1)].mask))), dtype=np.float32)
    for (i, metayolo) in enumerate(self._metayolos):
        self._metayolos_np[(i, 0)] = metayolo.height
        self._metayolos_np[(i, 1)] = metayolo.width
        self._metayolos_np[(i, 2)] = metayolo.channels
        self._metayolos_np[(i, 3)] = metayolo.classes
        self._metayolos_np[(i, 4)] = metayolo.label_smooth_eps
        self._metayolos_np[(i, 5)] = metayolo.max
        self._metayolos_np[(i, 6)] = metayolo.iou_thresh
        for (j, mask) in enumerate(metayolo.mask):
            self._metayolos_np[(i, (7 + j))] = mask
    self._anchors_np = np.zeros((len(self._metayolos[(- 1)].anchors) * 2), dtype=np.float32)
    for (i, anchor) in enumerate(self._metayolos[(- 1)].anchors):
        self._anchors_np[(2 * i)] = (anchor[0] / self._metanet.width)
        self._anchors_np[((2 * i) + 1)] = (anchor[1] / self._metanet.height)
    self._augmentation: List[str] = []
    if config.net.mosaic:
        self._augmentation.append('mosaic')
    if (training and (len(self._augmentation) > 0)):
        self._augmentation_batch = int((config.net.batch * 0.3))
        self._training = True
    else:
        self._augmentation_batch = 0
        self._training = False
    self._augmentation_cache = [self._get_dataset(i) for i in range(_AUGMETATION_CACHE_SIZE)]
    self._augmentation_cache_index = 0
def __init__(self, config: YOLOConfig, dataset_list: str, dataset_type: str='converted_coco', image_path_prefix: str=, training: bool=True):
    self.dataset = parse_dataset(dataset_list=dataset_list, dataset_type=dataset_type, image_path_prefix=image_path_prefix)
    self._metayolos = []
    if (config.layer_count['yolo'] > 0):
        for i in range(config.layer_count['yolo']):
            self._metayolos.append(config.find_metalayer('yolo', i))
    elif (config.layer_count['yolo_tpu'] > 0):
        for i in range(config.layer_count['yolo_tpu']):
            self._metayolos.append(config.find_metalayer('yolo_tpu', i))
    else:
        raise RuntimeError('YOLODataset: model does not have a yolo or yolo_tpu layer')
    self._metanet = config.net
    self._metayolos_np = np.zeros((len(self._metayolos), (7 + len(self._metayolos[(- 1)].mask))), dtype=np.float32)
    for (i, metayolo) in enumerate(self._metayolos):
        self._metayolos_np[(i, 0)] = metayolo.height
        self._metayolos_np[(i, 1)] = metayolo.width
        self._metayolos_np[(i, 2)] = metayolo.channels
        self._metayolos_np[(i, 3)] = metayolo.classes
        self._metayolos_np[(i, 4)] = metayolo.label_smooth_eps
        self._metayolos_np[(i, 5)] = metayolo.max
        self._metayolos_np[(i, 6)] = metayolo.iou_thresh
        for (j, mask) in enumerate(metayolo.mask):
            self._metayolos_np[(i, (7 + j))] = mask
    self._anchors_np = np.zeros((len(self._metayolos[(- 1)].anchors) * 2), dtype=np.float32)
    for (i, anchor) in enumerate(self._metayolos[(- 1)].anchors):
        self._anchors_np[(2 * i)] = (anchor[0] / self._metanet.width)
        self._anchors_np[((2 * i) + 1)] = (anchor[1] / self._metanet.height)
    self._augmentation: List[str] = []
    if config.net.mosaic:
        self._augmentation.append('mosaic')
    if (training and (len(self._augmentation) > 0)):
        self._augmentation_batch = int((config.net.batch * 0.3))
        self._training = True
    else:
        self._augmentation_batch = 0
        self._training = False
    self._augmentation_cache = [self._get_dataset(i) for i in range(_AUGMETATION_CACHE_SIZE)]
    self._augmentation_cache_index = 0