def _prepare_data_config(feed, args_path): # if `DATASET_DIR` does not exists, search ~/.paddle/dataset for a directory # named `DATASET_DIR` (e.g., coco, pascal), if not present either, download dataset_home = args_path if args_path else feed.dataset.dataset_dir if dataset_home: annotation = getattr(feed.dataset, 'annotation', None) image_dir = getattr(feed.dataset, 'image_dir', None) dataset_dir = get_dataset_path(dataset_home, annotation, image_dir) if annotation: feed.dataset.annotation = os.path.join(dataset_dir, annotation) if image_dir: feed.dataset.image_dir = os.path.join(dataset_dir, image_dir) mixup_epoch = -1 if getattr(feed, 'mixup_epoch', None) is not None: mixup_epoch = feed.mixup_epoch data_config = { 'ANNO_FILE': feed.dataset.annotation, 'IMAGE_DIR': feed.dataset.image_dir, 'USE_DEFAULT_LABEL': feed.dataset.use_default_label, 'IS_SHUFFLE': feed.shuffle, 'SAMPLES': feed.samples, 'WITH_BACKGROUND': feed.with_background, 'MIXUP_EPOCH': mixup_epoch, 'TYPE': type(feed.dataset).__source__ } if len(getattr(feed.dataset, 'images', [])) > 0: data_config['IMAGES'] = feed.dataset.images return data_config
def check_or_download_dataset(self): if self.dataset_dir: # NOTE: ImageFolder is only used for prediction, in # infer mode, image_dir is set by set_images # so we only check anno_path here self.dataset_dir = get_dataset_path(self.dataset_dir, self.anno_path, None)
def get_roidb(self): if not self.roidbs: data_dir = get_dataset_path(self.dataset_dir, self.anno_path, self.image_dir) if data_dir: self.dataset_dir = data_dir self.load_roidb_and_cname2cid() return self.roidbs
def get_roidb(self): """ 获取数据源 :return: list[dict] , Roidb 数据源 """ if not self.roidbs: data_dir = get_dataset_path(self.dataset_dir, self.anno_path, self.image_dir) if data_dir: self.dataset_dir = data_dir self.load_roidb_and_cname2cid() return self.roidbs
def check_or_download_dataset(self): self.dataset_dir = get_dataset_path(self.dataset_dir, self.anno_path, self.image_dir)