def __init__(self, label_file, input_size=224):
        '''
        img_dir: 图片路径:img_dir + img_name.jpg构成图片的完整路径      
        '''
        # 所有图片的绝对路径
        with open(label_file, 'r') as f:
            #label_file的格式, (label_file image_label)
            self.imgs = list(map(lambda line: line.strip().split(' '), f))
      # 相关预处理的初始化
      #  self.transforms=transform
        self.img_aug=True

        self.transform= get_train_transform(size=cfg.INPUT_SIZE)
        #self.eraser = get_random_eraser( s_h=0.1, pixel_level=True)
        self.input_size = cfg.INPUT_SIZE
示例#2
0
 def __init__(self, label_file, imageset):
     '''
     img_dir: 图片路径:img_dir + img_name.jpg构成图片的完整路径      
     '''
     # 所有图片的绝对路径
     with open(label_file, 'r') as f:
         #label_file的格式, (label_file image_label)
         self.imgs = list(map(lambda line: line.strip().split(' '), f))
   # 相关预处理的初始化
   #   self.transforms=transform
     self.img_aug=True
     if imageset == 'train':
         self.transform= get_train_transform(size=cfg.INPUT_SIZE)
     else:
         self.transform = get_test_transform(size = cfg.INPUT_SIZE)
     self.input_size = cfg.INPUT_SIZE
示例#3
0
 def __init__(self, label_file, imageset):
     '''
     img_dir: 图片路径:img_dir + img_name.jpg构成图片的完整路径      
     '''
     # 所有图片的绝对路径
     label_file =  "D:\\05分类图片\\pytorch_classification-master\\data\\train.txt"
     print(label_file)
     with open(label_file, 'r') as f:
         #label_file的格式, (label_file image_label)
         self.imgs = list(map(lambda line: line.strip().split(' '), f))
   # 相关预处理的初始化
   #   self.transforms=transform
     self.img_aug=True
     if imageset == 'train':
         self.transform= get_train_transform(size=cfg.INPUT_SIZE)
     else:
         self.transform = get_test_transform(size = cfg.INPUT_SIZE)
     self.eraser = get_random_eraser( s_h=0.1, pixel_level=True)
     self.input_size = cfg.INPUT_SIZE