当前位置: 首页>>代码示例>>Python>>正文


Python image_folder.make_dataset方法代码示例

本文整理汇总了Python中data.image_folder.make_dataset方法的典型用法代码示例。如果您正苦于以下问题:Python image_folder.make_dataset方法的具体用法?Python image_folder.make_dataset怎么用?Python image_folder.make_dataset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在data.image_folder的用法示例。

在下文中一共展示了image_folder.make_dataset方法的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from data import image_folder [as 别名]
# 或者: from data.image_folder import make_dataset [as 别名]
def __init__(self, opt):
        """Initialize this dataset class.

        Parameters:
            opt (Option class) -- stores all the experiment flags; needs to be a subclass of BaseOptions
        """
        BaseDataset.__init__(self, opt)
        self.dir_A = os.path.join(opt.dataroot, opt.phase + 'A')  # create a path '/path/to/data/trainA'
        self.dir_B = os.path.join(opt.dataroot, opt.phase + 'B')  # create a path '/path/to/data/trainB'

        self.A_paths = sorted(make_dataset(self.dir_A, opt.max_dataset_size))   # load images from '/path/to/data/trainA'
        self.B_paths = sorted(make_dataset(self.dir_B, opt.max_dataset_size))    # load images from '/path/to/data/trainB'
        self.A_size = len(self.A_paths)  # get the size of dataset A
        self.B_size = len(self.B_paths)  # get the size of dataset B
        btoA = self.opt.direction == 'BtoA'
        input_nc = self.opt.output_nc if btoA else self.opt.input_nc       # get the number of channels of input image
        output_nc = self.opt.input_nc if btoA else self.opt.output_nc      # get the number of channels of output image
        self.transform_A = get_transform(self.opt, grayscale=(input_nc == 1))
        self.transform_B = get_transform(self.opt, grayscale=(output_nc == 1)) 
开发者ID:Mingtzge,项目名称:2019-CCF-BDCI-OCR-MCZJ-OCR-IdentificationIDElement,代码行数:21,代码来源:unaligned_dataset.py


示例2: initialize

# 需要导入模块: from data import image_folder [as 别名]
# 或者: from data.image_folder import make_dataset [as 别名]
def initialize(self, opt):
        self.opt = opt
        self.root = opt.dataroot
        self.dir_A = os.path.join(opt.dataroot, opt.phase + 'A')
        self.dir_B = os.path.join(opt.dataroot, opt.phase + 'B')

        self.A_paths = make_dataset(self.dir_A)
        self.B_paths = make_dataset(self.dir_B)

        self.A_paths = sorted(self.A_paths)
        self.B_paths = sorted(self.B_paths)
        self.A_size = len(self.A_paths)
        self.B_size = len(self.B_paths)
        # self.transform = get_transform(opt)
        transform_list = [transforms.ToTensor(),
                          transforms.Normalize((0.5, 0.5, 0.5),
                                               (0.5, 0.5, 0.5))]
        self.transform = transforms.Compose(transform_list) 
开发者ID:aayushbansal,项目名称:Recycle-GAN,代码行数:20,代码来源:unaligned_triplet_dataset.py


示例3: initialize

# 需要导入模块: from data import image_folder [as 别名]
# 或者: from data.image_folder import make_dataset [as 别名]
def initialize(self, opt):
        self.opt = opt
        self.root = opt.dataroot
        self.loadSize = opt.loadSize
        self.dir_A = os.path.join(opt.dataroot, opt.phase + 'A')
        self.dir_B = os.path.join(opt.dataroot, opt.phase + 'B')

        self.A_paths = make_dataset(self.dir_A)
        self.B_paths = make_dataset(self.dir_B)            

        self.A_paths = sorted(self.A_paths)
        self.B_paths = sorted(self.B_paths)
            
        self.A_size = len(self.A_paths)
        self.B_size = len(self.B_paths)

        if opt.phase == 'train':
            self.dir_C = os.path.join(opt.dataroot, opt.phase + 'C')
            self.C_paths = make_dataset(self.dir_C)
            self.C_paths = sorted(self.C_paths)
            self.C_size = len(self.C_paths) 
开发者ID:csqiangwen,项目名称:Single-Image-Reflection-Removal-Beyond-Linearity,代码行数:23,代码来源:synthesis_dataset.py


示例4: initialize

# 需要导入模块: from data import image_folder [as 别名]
# 或者: from data.image_folder import make_dataset [as 别名]
def initialize(self, opt):
        self.opt = opt
        self.root = opt.dataroot
        self.phase = opt.phase
        self.dir_C = os.path.join(opt.dataroot, opt.phase + 'C')
        if opt.phase == 'train':
            self.dir_A = os.path.join(opt.dataroot, opt.phase + 'A')
            self.dir_B = os.path.join(opt.dataroot, opt.phase + 'B')
            self.dir_W = os.path.join(opt.dataroot, opt.phase + 'W')

        self.C_paths = make_dataset(self.dir_C)
        if opt.phase == 'train':
            self.A_paths = make_dataset(self.dir_A)
            self.B_paths = make_dataset(self.dir_B)
            self.W_paths = make_dataset(self.dir_W)

        self.C_paths = sorted(self.C_paths)
        if opt.phase == 'train':
            self.A_paths = sorted(self.A_paths)
            self.B_paths = sorted(self.B_paths)
            self.W_paths = sorted(self.W_paths)

        self.C_size = len(self.C_paths) 
开发者ID:csqiangwen,项目名称:Single-Image-Reflection-Removal-Beyond-Linearity,代码行数:25,代码来源:removal_dataset.py


示例5: initialize

# 需要导入模块: from data import image_folder [as 别名]
# 或者: from data.image_folder import make_dataset [as 别名]
def initialize(self, opt):
		self.opt = opt

		### input A (label maps)
		self.label_paths = sorted(make_dataset(opt.label_root))
		# self.simage_paths = sorted(make_dataset(opt.input_image_root))
		### input B (real images)
		if opt.isTrain:
			self.rimage_paths = sorted(make_dataset(opt.real_image_root))

		### instance maps
		if not opt.no_instance:
			self.dir_inst = os.path.join(opt.dataroot, opt.phase + '_inst')
			self.inst_paths = sorted(make_dataset(self.dir_inst))

		### load precomputed instance-wise encoded features
		if opt.load_features:                              
			self.dir_feat = os.path.join(opt.dataroot, opt.phase + '_feat')
			print('----------- loading features from %s ----------' % self.dir_feat)
			self.feat_paths = sorted(make_dataset(self.dir_feat))

		x = 'train' if opt.isTrain else 'test'
		self.crop_coor = torch.load('../data/%s/%s/face_crop_coor.torch'% (opt.dataset_name, x))
		self.dataset_size = len(self.label_paths) 
开发者ID:Kuzphi,项目名称:EverybodyDanceNow-Temporal-FaceGAN,代码行数:26,代码来源:aligned_dataset_GAN.py


示例6: initialize

# 需要导入模块: from data import image_folder [as 别名]
# 或者: from data.image_folder import make_dataset [as 别名]
def initialize(self, opt):
		self.opt = opt
		self.root = opt.dataroot
		self.dir_A = os.path.join(opt.dataroot, 'synthia', 'RGB')
		self.dir_B = os.path.join(opt.dataroot, 'cityscapes', 'leftImg8bit')
		self.dir_A_label = os.path.join(opt.dataroot, 'synthia', 'GT', 'parsed_LABELS')
		self.dir_B_label = os.path.join(opt.dataroot, 'cityscapes', 'gtFine')
		
		self.A_paths = make_dataset(self.dir_A)
		self.B_paths = make_dataset(self.dir_B)
		
		self.A_paths = sorted(self.A_paths)
		self.B_paths = sorted(self.B_paths)
		self.A_size = len(self.A_paths)
		self.B_size = len(self.B_paths)
		
		self.A_labels = make_dataset(self.dir_A_label)
		self.B_labels = make_cs_labels(self.dir_B_label)
		
		self.A_labels = sorted(self.A_labels)
		self.B_labels = sorted(self.B_labels)
		
		self.transform = get_transform(opt)
		self.label_transform = get_label_transform(opt) 
开发者ID:Luodian,项目名称:MADAN,代码行数:26,代码来源:synthia_cityscapes.py


示例7: initialize

# 需要导入模块: from data import image_folder [as 别名]
# 或者: from data.image_folder import make_dataset [as 别名]
def initialize(self, opt):
		self.opt = opt
		self.root = opt.dataroot
		self.dir_A = os.path.join(opt.dataroot, 'gta5', 'images')
		self.dir_B = os.path.join(opt.dataroot, 'cityscapes', 'leftImg8bit')
		self.dir_A_label = os.path.join(opt.dataroot, 'gta5', 'labels')
		self.dir_B_label = os.path.join(opt.dataroot, 'cityscapes', 'gtFine')
		
		self.A_paths = make_dataset(self.dir_A)
		self.B_paths = make_dataset(self.dir_B)
		
		self.A_paths = sorted(self.A_paths)
		self.B_paths = sorted(self.B_paths)
		self.A_size = len(self.A_paths)
		self.B_size = len(self.B_paths)
		
		self.A_labels = make_dataset(self.dir_A_label)
		self.B_labels = make_cs_labels(self.dir_B_label)
		
		self.A_labels = sorted(self.A_labels)
		self.B_labels = sorted(self.B_labels)
		
		self.transform = get_transform(opt)
		self.label_transform = get_label_transform(opt) 
开发者ID:Luodian,项目名称:MADAN,代码行数:26,代码来源:gta5_cityscapes.py


示例8: initialize

# 需要导入模块: from data import image_folder [as 别名]
# 或者: from data.image_folder import make_dataset [as 别名]
def initialize(self, dataroot, load_size=64):
        self.root = dataroot
        self.load_size = load_size

        self.dir_p0 = os.path.join(self.root, 'p0')
        self.p0_paths = make_dataset(self.dir_p0)
        self.p0_paths = sorted(self.p0_paths)

        self.dir_p1 = os.path.join(self.root, 'p1')
        self.p1_paths = make_dataset(self.dir_p1)
        self.p1_paths = sorted(self.p1_paths)

        transform_list = []
        transform_list.append(transforms.Scale(load_size))
        transform_list += [transforms.ToTensor(),
            transforms.Normalize((0.5, 0.5, 0.5),(0.5, 0.5, 0.5))]

        self.transform = transforms.Compose(transform_list)

        # judgement directory
        self.dir_S = os.path.join(self.root, 'same')
        self.same_paths = make_dataset(self.dir_S,mode='np')
        self.same_paths = sorted(self.same_paths) 
开发者ID:richzhang,项目名称:PerceptualSimilarity,代码行数:25,代码来源:jnd_dataset.py


示例9: __init__

# 需要导入模块: from data import image_folder [as 别名]
# 或者: from data.image_folder import make_dataset [as 别名]
def __init__(self, opt):
        """Initialize this dataset class.

        Parameters:
            opt (Option class) -- stores all the experiment flags; needs to be a subclass of BaseOptions
        """
        BaseDataset.__init__(self, opt)
        self.dir_AB = os.path.join(opt.dataroot, opt.phase)  # get the image directory
        self.AB_paths = sorted(make_dataset(self.dir_AB, opt.max_dataset_size))  # get image paths
        assert(self.opt.load_size >= self.opt.crop_size)   # crop_size should be smaller than the size of loaded image
        self.input_nc = self.opt.output_nc if self.opt.direction == 'BtoA' else self.opt.input_nc
        self.output_nc = self.opt.input_nc if self.opt.direction == 'BtoA' else self.opt.output_nc 
开发者ID:Mingtzge,项目名称:2019-CCF-BDCI-OCR-MCZJ-OCR-IdentificationIDElement,代码行数:14,代码来源:aligned_dataset.py


示例10: __init__

# 需要导入模块: from data import image_folder [as 别名]
# 或者: from data.image_folder import make_dataset [as 别名]
def __init__(self, opt):
        """Initialize this dataset class.

        Parameters:
            opt (Option class) -- stores all the experiment flags; needs to be a subclass of BaseOptions
        """
        BaseDataset.__init__(self, opt)
        self.A_paths = sorted(make_dataset(opt.dataroot, opt.max_dataset_size))
        input_nc = self.opt.output_nc if self.opt.direction == 'BtoA' else self.opt.input_nc
        self.transform = get_transform(opt, grayscale=(input_nc == 1)) 
开发者ID:Mingtzge,项目名称:2019-CCF-BDCI-OCR-MCZJ-OCR-IdentificationIDElement,代码行数:12,代码来源:single_dataset.py


示例11: __init__

# 需要导入模块: from data import image_folder [as 别名]
# 或者: from data.image_folder import make_dataset [as 别名]
def __init__(self, opt):
        """Initialize this dataset class.

        Parameters:
            opt (Option class) -- stores all the experiment flags; needs to be a subclass of BaseOptions
        """
        BaseDataset.__init__(self, opt)
        self.dir = os.path.join(opt.dataroot, opt.phase)
        self.AB_paths = sorted(make_dataset(self.dir, opt.max_dataset_size))
        assert(opt.input_nc == 1 and opt.output_nc == 2 and opt.direction == 'AtoB')
        self.transform = get_transform(self.opt, convert=False) 
开发者ID:Mingtzge,项目名称:2019-CCF-BDCI-OCR-MCZJ-OCR-IdentificationIDElement,代码行数:13,代码来源:colorization_dataset.py


示例12: initialize

# 需要导入模块: from data import image_folder [as 别名]
# 或者: from data.image_folder import make_dataset [as 别名]
def initialize(self, opt):
        self.opt = opt
        self.root = opt.dataroot
        self.dir_A = os.path.join(opt.dataroot, opt.phase + 'A')
        self.dir_B = os.path.join(opt.dataroot, opt.phase + 'B')

        self.A_paths = make_dataset(self.dir_A)
        self.B_paths = make_dataset(self.dir_B)

        self.A_paths = sorted(self.A_paths)
        self.B_paths = sorted(self.B_paths)
        self.A_size = len(self.A_paths)
        self.B_size = len(self.B_paths)
        self.transform = get_transform(opt) 
开发者ID:aayushbansal,项目名称:Recycle-GAN,代码行数:16,代码来源:unaligned_dataset.py


示例13: __init__

# 需要导入模块: from data import image_folder [as 别名]
# 或者: from data.image_folder import make_dataset [as 别名]
def __init__(self, opt):
        """Initialize this dataset class.

        Parameters:
            opt (Option class) -- stores all the experiment flags; needs to be a subclass of BaseOptions
        """
        BaseDataset.__init__(self, opt)
        self.A_paths = sorted(make_dataset(opt.dataroot, opt.max_dataset_size))
        self.transform = get_transform(opt, grayscale=(self.opt.input_nc == 1)) 
开发者ID:WANG-Chaoyue,项目名称:EvolutionaryGAN-pytorch,代码行数:11,代码来源:single_dataset.py


示例14: initialize

# 需要导入模块: from data import image_folder [as 别名]
# 或者: from data.image_folder import make_dataset [as 别名]
def initialize(self, opt):
        self.opt = opt
        self.root = opt.dataroot
        self.dir_AB = os.path.join(opt.dataroot, opt.phase)

        self.AB_paths = sorted(make_dataset(self.dir_AB))

        assert(opt.resize_or_crop == 'resize_and_crop')

        transform_list = [transforms.ToTensor(),
                          transforms.Normalize((0.5, 0.5, 0.5),
                                               (0.5, 0.5, 0.5))]

        self.transform = transforms.Compose(transform_list) 
开发者ID:arnabgho,项目名称:iSketchNFill,代码行数:16,代码来源:aligned_dataset.py


示例15: initialize

# 需要导入模块: from data import image_folder [as 别名]
# 或者: from data.image_folder import make_dataset [as 别名]
def initialize(self, opt):
        self.opt = opt
        self.root = opt.dataroot
        self.dir_scribbles = os.path.join(opt.dataroot, 'scribbles')  #'pix2pix') #'scribbles' )  #'masks')
        self.dir_images = os.path.join(opt.dataroot, 'images') #os.path.join(opt.dataroot, 'images')

        self.classes = sorted(os.listdir(self.dir_images)) # sorted so that the same order in all cases; check if you've to change this with other models
        self.num_classes = len(self.classes)

        self.scribble_paths = []
        self.images_paths = []
        for cl in self.classes:
            self.scribble_paths.append(sorted( make_dataset( os.path.join( self.dir_scribbles , cl  )  )  ) )
            self.images_paths.append( sorted(  make_dataset( os.path.join( self.dir_images , cl  )  )  ) )

        self.cum_sizes = []
        self.sizes = []
        size =0
        for i in range(self.num_classes):
            size += len(self.scribble_paths[i])
            self.cum_sizes.append(size)
            self.sizes.append(size)

        self.transform = get_transform(opt)
        self.sparse_transform = get_sparse_transform(opt)
        self.mask_transform =  get_mask_transform(opt) 
开发者ID:arnabgho,项目名称:iSketchNFill,代码行数:28,代码来源:labeled_dataset.py


示例16: initialize

# 需要导入模块: from data import image_folder [as 别名]
# 或者: from data.image_folder import make_dataset [as 别名]
def initialize(self, opt):
        self.opt = opt
        self.root = opt.dataroot
        self.dir_A = os.path.join(opt.dataroot)

        self.A_paths = make_dataset(self.dir_A)

        self.A_paths = sorted(self.A_paths)

        self.transform = get_transform(opt) 
开发者ID:arnabgho,项目名称:iSketchNFill,代码行数:12,代码来源:single_dataset.py


示例17: initialize

# 需要导入模块: from data import image_folder [as 别名]
# 或者: from data.image_folder import make_dataset [as 别名]
def initialize(self, opt):
        self.opt = opt
        self.root = opt.dataroot    

        ### input A (label maps)
        dir_A = '_A' if self.opt.label_nc == 0 else '_label'
        self.dir_A = os.path.join(opt.dataroot, opt.phase + dir_A)
        self.A_paths = sorted(make_dataset(self.dir_A))

        ### input B (real images)
        if opt.isTrain:
            dir_B = '_B' if self.opt.label_nc == 0 else '_img'
            self.dir_B = os.path.join(opt.dataroot, opt.phase + dir_B)  
            self.B_paths = sorted(make_dataset(self.dir_B))

        ### instance maps
        if not opt.no_instance:
            self.dir_inst = os.path.join(opt.dataroot, opt.phase + '_inst')
            self.inst_paths = sorted(make_dataset(self.dir_inst))

        ### load precomputed instance-wise encoded features
        if opt.load_features:                              
            self.dir_feat = os.path.join(opt.dataroot, opt.phase + '_feat')
            print('----------- loading features from %s ----------' % self.dir_feat)
            self.feat_paths = sorted(make_dataset(self.dir_feat))

        self.dataset_size = len(self.A_paths) 
开发者ID:Lotayou,项目名称:everybody_dance_now_pytorch,代码行数:29,代码来源:aligned_dataset.py


示例18: initialize

# 需要导入模块: from data import image_folder [as 别名]
# 或者: from data.image_folder import make_dataset [as 别名]
def initialize(self, opt):
        self.opt = opt
        self.root = opt.dataroot    

        ### input A (label maps)
        dir_A = '_A' if self.opt.label_nc == 0 else '_label'
        self.dir_A = os.path.join(opt.dataroot, opt.phase + dir_A)
        self.A_paths = sorted(make_dataset(self.dir_A))

        ### input B (real images)
        #if opt.isTrain:
        dir_B = '_B' if self.opt.label_nc == 0 else '_img'
        self.dir_B = os.path.join(opt.dataroot, opt.phase + dir_B)
        self.B_paths = sorted(make_dataset(self.dir_B))

        ### instance maps
        if not opt.no_instance:
            self.dir_inst = os.path.join(opt.dataroot, opt.phase + '_inst')
            self.inst_paths = sorted(make_dataset(self.dir_inst))

        ### load precomputed instance-wise encoded features
        if opt.load_features:                              
            self.dir_feat = os.path.join(opt.dataroot, opt.phase + '_feat')
            print('----------- loading features from %s ----------' % self.dir_feat)
            self.feat_paths = sorted(make_dataset(self.dir_feat))

        self.dataset_size = len(self.A_paths)

        ### define clip length
        if opt.isTrain:
            self.clip_length = 2
        else:
            self.clip_length = min(opt.clip_length, len(self.A_paths))
        print(len(self.A_paths), self.clip_length) 
开发者ID:Lotayou,项目名称:everybody_dance_now_pytorch,代码行数:36,代码来源:aligned_pair_dataset.py


示例19: initialize

# 需要导入模块: from data import image_folder [as 别名]
# 或者: from data.image_folder import make_dataset [as 别名]
def initialize(self, opt):
        self.opt = opt
        self.root = opt.dataroot
        self.dir = os.path.join(opt.dataroot, opt.phase)
        self.paths = make_dataset(self.dir)
        self.paths = sorted(self.paths)
        self.size = len(self.paths)
        self.fineSize = opt.fineSize
        self.transform = get_transform(opt) 
开发者ID:jessemelpolio,项目名称:non-stationary_texture_syn,代码行数:11,代码来源:half_dataset.py


示例20: initialize

# 需要导入模块: from data import image_folder [as 别名]
# 或者: from data.image_folder import make_dataset [as 别名]
def initialize(self, opt):
		self.opt = opt
		self.root = opt.dataroot    

		### input A (label maps)
		dir_A = '_A' if self.opt.label_nc == 0 else '_label'
		self.dir_A = os.path.join(opt.dataroot, opt.phase + dir_A)
		self.A_paths = sorted(make_dataset(self.dir_A))
		print(len(self.A_paths))

		### input B (real images)
		if opt.isTrain:
			dir_B = '_B' if self.opt.label_nc == 0 else '_img'
			self.dir_B = os.path.join(opt.dataroot, opt.phase + dir_B)  
			self.B_paths = sorted(make_dataset(self.dir_B))

		### instance maps
		if not opt.no_instance:
			self.dir_inst = os.path.join(opt.dataroot, opt.phase + '_inst')
			self.inst_paths = sorted(make_dataset(self.dir_inst))

		### load precomputed instance-wise encoded features
		if opt.load_features:                              
			self.dir_feat = os.path.join(opt.dataroot, opt.phase + '_feat')
			print('----------- loading features from %s ----------' % self.dir_feat)
			self.feat_paths = sorted(make_dataset(self.dir_feat))

		self.dataset_size = len(self.A_paths) 
开发者ID:Kuzphi,项目名称:EverybodyDanceNow-Temporal-FaceGAN,代码行数:30,代码来源:aligned_dataset.py


示例21: initialize

# 需要导入模块: from data import image_folder [as 别名]
# 或者: from data.image_folder import make_dataset [as 别名]
def initialize(self, opt):
		# SYNTHIA as dataset 1
		# GTAV as dataset 2
		self.opt = opt
		self.root = opt.dataroot
		self.dir_A_1 = os.path.join(opt.dataroot, 'synthia', 'RGB')
		self.dir_A_2 = os.path.join(opt.dataroot, 'gta5', 'images')
		self.dir_B = os.path.join(opt.dataroot, 'cityscapes', 'leftImg8bit')
		self.dir_A_label_1 = os.path.join(opt.dataroot, 'synthia', 'GT', 'parsed_LABELS')
		self.dir_A_label_2 = os.path.join(opt.dataroot, 'gta5', 'labels')
		
		self.A_paths_1 = make_dataset(self.dir_A_1)
		self.A_paths_2 = make_dataset(self.dir_A_2)
		self.B_paths = make_dataset(self.dir_B)
		
		self.A_paths_1 = sorted(self.A_paths_1)
		self.A_paths_2 = sorted(self.A_paths_2)
		
		self.B_paths = sorted(self.B_paths)
		
		self.A_size_1 = len(self.A_paths_1)
		self.A_size_2 = len(self.A_paths_2)
		
		self.B_size = len(self.B_paths)
		
		self.A_labels_1 = make_dataset(self.dir_A_label_1)
		self.A_labels_2 = make_dataset(self.dir_A_label_2)
		
		self.A_labels_1 = sorted(self.A_labels_1)
		self.A_labels_2 = sorted(self.A_labels_2)
		
		self.transform = get_transform(opt)
		self.label_transform = get_label_transform(opt) 
开发者ID:Luodian,项目名称:MADAN,代码行数:35,代码来源:gta_synthia_cityscapes.py


示例22: initialize

# 需要导入模块: from data import image_folder [as 别名]
# 或者: from data.image_folder import make_dataset [as 别名]
def initialize(self, opt):
        self.opt = opt
        self.root = opt.data_directory
        self.dir_A = os.path.join(opt.data_directory)

        self.A_paths = make_dataset(self.dir_A)

        self.A_paths = sorted(self.A_paths)

        self.transform = get_transform(opt) 
开发者ID:atapour,项目名称:monocularDepth-Inference,代码行数:12,代码来源:single_dataset.py


示例23: initialize

# 需要导入模块: from data import image_folder [as 别名]
# 或者: from data.image_folder import make_dataset [as 别名]
def initialize(self, opt):
        self.opt = opt
        self.root = opt.dataroot    

        ### input A (label maps)
        dir_A = '_A' if self.opt.label_nc == 0 else '_label'
        self.dir_A = os.path.join(opt.dataroot, opt.phase + dir_A)
        self.A_paths = sorted(make_dataset(self.dir_A))

        ### input B (real images)
        if opt.isTrain or opt.use_encoded_image:
            dir_B = '_B' if self.opt.label_nc == 0 else '_img'
            self.dir_B = os.path.join(opt.dataroot, opt.phase + dir_B)  
            self.B_paths = sorted(make_dataset(self.dir_B))

        ### instance maps
        if not opt.no_instance:
            self.dir_inst = os.path.join(opt.dataroot, opt.phase + '_inst')
            self.inst_paths = sorted(make_dataset(self.dir_inst))

        ### load precomputed instance-wise encoded features
        if opt.load_features:                              
            self.dir_feat = os.path.join(opt.dataroot, opt.phase + '_feat')
            print('----------- loading features from %s ----------' % self.dir_feat)
            self.feat_paths = sorted(make_dataset(self.dir_feat))

        self.dataset_size = len(self.A_paths) 
开发者ID:thomasjhuang,项目名称:deep-learning-for-document-dewarping,代码行数:29,代码来源:aligned_dataset.py


示例24: initialize

# 需要导入模块: from data import image_folder [as 别名]
# 或者: from data.image_folder import make_dataset [as 别名]
def initialize(self, dataroots, load_size=64):
        if(not isinstance(dataroots,list)):
            dataroots = [dataroots,]
        self.roots = dataroots
        self.load_size = load_size

        # image directory
        self.dir_ref = [os.path.join(root, 'ref') for root in self.roots]
        self.ref_paths = make_dataset(self.dir_ref)
        self.ref_paths = sorted(self.ref_paths)

        self.dir_p0 = [os.path.join(root, 'p0') for root in self.roots]
        self.p0_paths = make_dataset(self.dir_p0)
        self.p0_paths = sorted(self.p0_paths)

        self.dir_p1 = [os.path.join(root, 'p1') for root in self.roots]
        self.p1_paths = make_dataset(self.dir_p1)
        self.p1_paths = sorted(self.p1_paths)

        transform_list = []
        transform_list.append(transforms.Scale(load_size))
        transform_list += [transforms.ToTensor(),
            transforms.Normalize((0.5, 0.5, 0.5),(0.5, 0.5, 0.5))]

        self.transform = transforms.Compose(transform_list)

        # judgement directory
        self.dir_J = [os.path.join(root, 'judge') for root in self.roots]
        self.judge_paths = make_dataset(self.dir_J,mode='np')
        self.judge_paths = sorted(self.judge_paths) 
开发者ID:richzhang,项目名称:PerceptualSimilarity,代码行数:32,代码来源:twoafc_dataset.py



注:本文中的data.image_folder.make_dataset方法示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。