def __init__(self, img_folder, target_folder, transform=None, size=256, randomcrop=224, hflip=0.5, vflip=0.5, train=True): ''' :param img_folder: :param transform: :param additional_transform: :param final_transformation: ''' self.img_folder = img_folder self.size = size #for resizing self.randomCrop = randomcrop #randomcrop self.hflip = hflip self.vflip = vflip self.transforms = transform self.train = train self.file_names = get_images(img_folder) self.target_names = get_images(target_folder)
def __init__(self, img_folder, shuffle=True, train=True, num_images=2, size=256, randomcrop=196, hflip=0.5, vflip=0.5): ''' :param img_folder: :param transform: :param additional_transform: :param final_transformation: ''' self.img_folder = img_folder self.size = size self.num_images = num_images #for resizing self.randomCrop = randomcrop #randomcrop self.hflip = hflip self.vflip = vflip self.shuffle = shuffle self.train = train self.file_names = get_images(img_folder)
def __init__(self, opts, img_folder, attribute_file): ''' :param opts: :param img_folder: :param attribute_file: ''' self.img_folder = img_folder self.attribute_file = attribute_file self.opts = opts self.file_names = get_images(img_folder) #load_attributes self.load_attribute() self.data_dictionary()
def __init__(self, opts): ''' :param opts: :param img_folder: :param attribute_file: ''' self.opts = opts self.file_names = get_images(self.opts.dir) self.file_len = len(self.file_names) if path.exists(self.opts.dict_name_0) and path.exists( self.opts.dict_name_1): self.load_dict() else: self.create_dict() self.label_to_name_dict = { v: k for k, v in self.name_to_label_dict.items() } self.save_dict()