MCPcopy Create free account
hub / github.com/SAMMiCA/ChangeSim / __init__

Method __init__

script/dataloader.py:25–61  ·  view source on GitHub ↗

ChangeSim Dataloader Please download ChangeSim Dataset in https://github.com/SAMMiCA/ChangeSim Args: crop_size (tuple): Image resize shape (H,W) (default: (320, 240)) num_classes (int): Number of target change detection class

(self, crop_size=(320, 240), num_classes=5, set='train')

Source from the content-addressed store, hash-verified

23
24class ChangeSim(data.Dataset):
25 def __init__(self, crop_size=(320, 240), num_classes=5, set='train'):
26 """
27 ChangeSim Dataloader
28 Please download ChangeSim Dataset in https://github.com/SAMMiCA/ChangeSim
29
30 Args:
31 crop_size (tuple): Image resize shape (H,W) (default: (320, 240))
32 num_classes (int): Number of target change detection class
33 5 for multi-class change detection
34 2 for binary change detection (default: 5)
35 set (str): 'train' or 'test' (defalut: 'train')
36 """
37 self.crop_size = crop_size
38 self.num_classes = num_classes
39 self.set = set
40 self.blacklist=[]
41 train_list = ['Warehouse_0', 'Warehouse_1', 'Warehouse_2', 'Warehouse_3', 'Warehouse_4', 'Warehouse_5']
42 test_list = ['Warehouse_6', 'Warehouse_7', 'Warehouse_8', 'Warehouse_9']
43 self.image_total_files = []
44 if set == 'train':
45 for map in train_list:
46 self.image_total_files += glob.glob('../Query/Query_Seq_Train/' + map + '/Seq_0/rgb/*.png')
47 self.image_total_files += glob.glob('../Query/Query_Seq_Train/' + map + '/Seq_1/rgb/*.png')
48 elif set == 'test':
49 for map in test_list:
50 self.image_total_files += glob.glob('../Query/Query_Seq_Test/' + map + '/Seq_0/rgb/*.png')
51 self.image_total_files += glob.glob('../Query/Query_Seq_Test/' + map + '/Seq_1/rgb/*.png')
52 # if not max_iters == None:
53 # self.image_total_files = self.image_total_files * int(np.ceil(float(max_iters) / len(self.image_total_files)))
54 # self.image_total_files = self.image_total_files[:max_iters]
55
56 self.seg = Object_Labeling.SegHelper(idx2color_path='./utils/idx2color.txt', num_class=self.num_classes)
57
58 #### Color Transform ####
59 self.color_transform = transforms.Compose([transforms.ColorJitter(0.4, 0.4, 0.4, 0.25),
60 transforms.ToTensor()])
61 # self.transform = Compose([Resize(crop_size), ToTensor()])
62
63 def __len__(self):
64 return len(self.image_total_files)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected