def __init__( self, source_root, target_root, opts, latents_root=None, labels_path=None, target_transform=None, source_transform=None, ): self.target_paths = sorted(data_utils.make_dataset(target_root)) self.source_paths = sorted(data_utils.make_dataset(source_root)) self.latent_paths = None if latents_root is not None: self.latent_paths = sorted( data_utils.make_latents_dataset(latents_root) ) self.path_to_label = None if labels_path is not None: with open(labels_path) as f: labels = json.load(f)["labels"] self.path_to_label = {path: label for path, label in labels} self.source_transform = source_transform self.target_transform = target_transform self.opts = opts
def __init__(self, source_root, target_root, opts, target_transform=None, source_transform=None): self.source_paths = sorted(data_utils.make_dataset(source_root)) self.target_paths = sorted(data_utils.make_dataset(target_root)) self.source_transform = source_transform self.target_transform = target_transform self.opts = opts
def __init__(self, root=None, paths_list=None, opts=None, transform=None, return_path=False): if paths_list is None: self.paths = sorted(data_utils.make_dataset(root)) else: self.paths = data_utils.make_dataset_from_paths_list(paths_list) self.transform = transform self.opts = opts self.return_path = return_path
# =========================== if __name__ == '__main__': args = argument_parser() input_path = args.input_path output_path = args.output_path if input_path == 'voc_horse': # get all non-horse voc files: input_filenames = get_voc_classification_filenames(voc_folder_path=CONSTS.VOC_DIR, category='horse') elif input_path == 'voc_mis': # get all non-person voc files: input_filenames = get_voc_classification_filenames(voc_folder_path=CONSTS.VOC_DIR, category='person') else: input_filenames = make_dataset(dir=input_path, ext='jpg') gen_data(mode=args.mode, input_filenames=input_filenames, output_path=output_path, num_sets=args.num_sets, minimalImage_size=args.minimalImage_size, limit=args.limit) # [Filter box proposals with the selective search code] # # Feel free to change parameters # boxes_filter = selective_search.box_filter(boxes, min_size=20, topN=80) # # # draw rectangles on the original image # fig, ax = plt.subplots(figsize=(6, 6)) # ax.imshow(image) # for x1, y1, x2, y2 in boxes_filter:
def __init__(self, root, opts, transform=None): self.paths = sorted(data_utils.make_dataset(root)) self.transform = transform self.opts = opts