@@ -18,17 +18,87 @@ class AerialDataset(CustomDataset):
1818 The ``img_suffix`` is fixed to '.jpg' and ``seg_map_suffix`` is fixed to
1919 '.png'.
2020 """
21- CLASSES = ('paved-area' , 'dirt' , 'grass' , 'gravel' , 'water' , 'rocks' , 'pool' , 'vegetation' ,
22- 'roof' , 'wall' , 'window' , 'door' , 'fence' , 'fence-pole' , 'person' , 'dog' , 'car' , 'bicycle' , 'tree' , 'bald-tree' , 'ar-marker' , 'obstacle' , 'conflicting' , 'unlabeled' )
23-
24- PALETTE = [[128 , 64 , 128 ], [130 , 76 , 0 ], [0 , 102 , 0 ], [112 , 103 , 87 ], [28 , 42 , 168 ], [48 , 41 , 30 ], [0 , 50 , 89 ], [107 , 142 , 35 ], [70 , 70 , 70 ], [102 , 102 , 156 ], [254 , 228 , 12 ], [254 , 148 , 12 ], [190 , 153 , 153 ], [153 , 153 , 153 ], [255 , 22 , 96 ], [102 , 51 , 0 ], [9 , 143 , 150 ], [119 , 11 , 32 ], [51 , 51 , 0 ], [190 , 250 , 190 ], [112 , 150 , 146 ], [2 , 135 , 115 ], [255 , 0 , 0 ], [0 , 0 , 0 ]]
21+ AERIAL_CLASSES = ('sidewalk' , 'earth' , 'grass' , 'sand' , 'water' , 'rock' , 'swimming pool' , 'plant' ,
22+ 'building' , 'wall' , 'windowpane' , 'door' , 'fence' , 'pole' , 'person' , 'animal' , 'car' , 'bicycle' , 'tree' , 'television receiver' , 'microwave' , 'coffee table' , 'trade name' , 'sconce' )
23+ CLASSES = (
24+ 'wall' , 'building' , 'sky' , 'floor' , 'tree' , 'ceiling' , 'road' , 'bed ' ,
25+ 'windowpane' , 'grass' , 'cabinet' , 'sidewalk' , 'person' , 'earth' ,
26+ 'door' , 'table' , 'mountain' , 'plant' , 'curtain' , 'chair' , 'car' ,
27+ 'water' , 'painting' , 'sofa' , 'shelf' , 'house' , 'sea' , 'mirror' , 'rug' ,
28+ 'field' , 'armchair' , 'seat' , 'fence' , 'desk' , 'rock' , 'wardrobe' ,
29+ 'lamp' , 'bathtub' , 'railing' , 'cushion' , 'base' , 'box' , 'column' ,
30+ 'signboard' , 'chest of drawers' , 'counter' , 'sand' , 'sink' ,
31+ 'skyscraper' , 'fireplace' , 'refrigerator' , 'grandstand' , 'path' ,
32+ 'stairs' , 'runway' , 'case' , 'pool table' , 'pillow' , 'screen door' ,
33+ 'stairway' , 'river' , 'bridge' , 'bookcase' , 'blind' , 'coffee table' ,
34+ 'toilet' , 'flower' , 'book' , 'hill' , 'bench' , 'countertop' , 'stove' ,
35+ 'palm' , 'kitchen island' , 'computer' , 'swivel chair' , 'boat' , 'bar' ,
36+ 'arcade machine' , 'hovel' , 'bus' , 'towel' , 'light' , 'truck' , 'tower' ,
37+ 'chandelier' , 'awning' , 'streetlight' , 'booth' , 'television receiver' ,
38+ 'airplane' , 'dirt track' , 'apparel' , 'pole' , 'land' , 'bannister' ,
39+ 'escalator' , 'ottoman' , 'bottle' , 'buffet' , 'poster' , 'stage' , 'van' ,
40+ 'ship' , 'fountain' , 'conveyer belt' , 'canopy' , 'washer' , 'plaything' ,
41+ 'swimming pool' , 'stool' , 'barrel' , 'basket' , 'waterfall' , 'tent' ,
42+ 'bag' , 'minibike' , 'cradle' , 'oven' , 'ball' , 'food' , 'step' , 'tank' ,
43+ 'trade name' , 'microwave' , 'pot' , 'animal' , 'bicycle' , 'lake' ,
44+ 'dishwasher' , 'screen' , 'blanket' , 'sculpture' , 'hood' , 'sconce' ,
45+ 'vase' , 'traffic light' , 'tray' , 'ashcan' , 'fan' , 'pier' , 'crt screen' ,
46+ 'plate' , 'monitor' , 'bulletin board' , 'shower' , 'radiator' , 'glass' ,
47+ 'clock' , 'flag' )
48+
49+ AERIAL_PALETTE = [[128 , 64 , 128 ], [130 , 76 , 0 ], [0 , 102 , 0 ], [112 , 103 , 87 ], [28 , 42 , 168 ], [48 , 41 , 30 ], [0 , 50 , 89 ], [107 , 142 , 35 ], [70 , 70 , 70 ], [102 , 102 , 156 ], [254 , 228 , 12 ], [254 , 148 , 12 ], [190 , 153 , 153 ], [153 , 153 , 153 ], [255 , 22 , 96 ], [102 , 51 , 0 ], [9 , 143 , 150 ], [119 , 11 , 32 ], [51 , 51 , 0 ], [190 , 250 , 190 ], [112 , 150 , 146 ], [2 , 135 , 115 ], [255 , 0 , 0 ], [0 , 0 , 0 ]]
50+ PALETTE = [[120 , 120 , 120 ], [180 , 120 , 120 ], [6 , 230 , 230 ], [80 , 50 , 50 ],
51+ [4 , 200 , 3 ], [120 , 120 , 80 ], [140 , 140 , 140 ], [204 , 5 , 255 ],
52+ [230 , 230 , 230 ], [4 , 250 , 7 ], [224 , 5 , 255 ], [235 , 255 , 7 ],
53+ [150 , 5 , 61 ], [120 , 120 , 70 ], [8 , 255 , 51 ], [255 , 6 , 82 ],
54+ [143 , 255 , 140 ], [204 , 255 , 4 ], [255 , 51 , 7 ], [204 , 70 , 3 ],
55+ [0 , 102 , 200 ], [61 , 230 , 250 ], [255 , 6 , 51 ], [11 , 102 , 255 ],
56+ [255 , 7 , 71 ], [255 , 9 , 224 ], [9 , 7 , 230 ], [220 , 220 , 220 ],
57+ [255 , 9 , 92 ], [112 , 9 , 255 ], [8 , 255 , 214 ], [7 , 255 , 224 ],
58+ [255 , 184 , 6 ], [10 , 255 , 71 ], [255 , 41 , 10 ], [7 , 255 , 255 ],
59+ [224 , 255 , 8 ], [102 , 8 , 255 ], [255 , 61 , 6 ], [255 , 194 , 7 ],
60+ [255 , 122 , 8 ], [0 , 255 , 20 ], [255 , 8 , 41 ], [255 , 5 , 153 ],
61+ [6 , 51 , 255 ], [235 , 12 , 255 ], [160 , 150 , 20 ], [0 , 163 , 255 ],
62+ [140 , 140 , 140 ], [250 , 10 , 15 ], [20 , 255 , 0 ], [31 , 255 , 0 ],
63+ [255 , 31 , 0 ], [255 , 224 , 0 ], [153 , 255 , 0 ], [0 , 0 , 255 ],
64+ [255 , 71 , 0 ], [0 , 235 , 255 ], [0 , 173 , 255 ], [31 , 0 , 255 ],
65+ [11 , 200 , 200 ], [255 , 82 , 0 ], [0 , 255 , 245 ], [0 , 61 , 255 ],
66+ [0 , 255 , 112 ], [0 , 255 , 133 ], [255 , 0 , 0 ], [255 , 163 , 0 ],
67+ [255 , 102 , 0 ], [194 , 255 , 0 ], [0 , 143 , 255 ], [51 , 255 , 0 ],
68+ [0 , 82 , 255 ], [0 , 255 , 41 ], [0 , 255 , 173 ], [10 , 0 , 255 ],
69+ [173 , 255 , 0 ], [0 , 255 , 153 ], [255 , 92 , 0 ], [255 , 0 , 255 ],
70+ [255 , 0 , 245 ], [255 , 0 , 102 ], [255 , 173 , 0 ], [255 , 0 , 20 ],
71+ [255 , 184 , 184 ], [0 , 31 , 255 ], [0 , 255 , 61 ], [0 , 71 , 255 ],
72+ [255 , 0 , 204 ], [0 , 255 , 194 ], [0 , 255 , 82 ], [0 , 10 , 255 ],
73+ [0 , 112 , 255 ], [51 , 0 , 255 ], [0 , 194 , 255 ], [0 , 122 , 255 ],
74+ [0 , 255 , 163 ], [255 , 153 , 0 ], [0 , 255 , 10 ], [255 , 112 , 0 ],
75+ [143 , 255 , 0 ], [82 , 0 , 255 ], [163 , 255 , 0 ], [255 , 235 , 0 ],
76+ [8 , 184 , 170 ], [133 , 0 , 255 ], [0 , 255 , 92 ], [184 , 0 , 255 ],
77+ [255 , 0 , 31 ], [0 , 184 , 255 ], [0 , 214 , 255 ], [255 , 0 , 112 ],
78+ [92 , 255 , 0 ], [0 , 224 , 255 ], [112 , 224 , 255 ], [70 , 184 , 160 ],
79+ [163 , 0 , 255 ], [153 , 0 , 255 ], [71 , 255 , 0 ], [255 , 0 , 163 ],
80+ [255 , 204 , 0 ], [255 , 0 , 143 ], [0 , 255 , 235 ], [133 , 255 , 0 ],
81+ [255 , 0 , 235 ], [245 , 0 , 255 ], [255 , 0 , 122 ], [255 , 245 , 0 ],
82+ [10 , 190 , 212 ], [214 , 255 , 0 ], [0 , 204 , 255 ], [20 , 0 , 255 ],
83+ [255 , 255 , 0 ], [0 , 153 , 255 ], [0 , 41 , 255 ], [0 , 255 , 204 ],
84+ [41 , 0 , 255 ], [41 , 255 , 0 ], [173 , 0 , 255 ], [0 , 245 , 255 ],
85+ [71 , 0 , 255 ], [122 , 0 , 255 ], [0 , 255 , 184 ], [0 , 92 , 255 ],
86+ [184 , 255 , 0 ], [0 , 133 , 255 ], [255 , 214 , 0 ], [25 , 194 , 194 ],
87+ [102 , 255 , 0 ], [92 , 0 , 255 ]]
88+ # PALETTE = None
89+ # CLASSES = None
2590
2691 def __init__ (self , ** kwargs ):
2792 super (AerialDataset , self ).__init__ (
2893 img_suffix = '.jpg' ,
2994 seg_map_suffix = '.png' ,
3095 reduce_zero_label = True ,
31- ** kwargs )
96+ ** kwargs
97+ )
98+ self .CLASSES , self .PALETTE = self .get_classes_and_palette (self .AERIAL_CLASSES , self .AERIAL_PALETTE )
99+ # print("self.classes len ", len(self.CLASSES))
100+ # print("self.palette len ", len(self.PALETTE))
101+
32102
33103 def results2img (self , results , imgfile_prefix , to_label_id , indices = None ):
34104 """Write the segmentation results to images.
@@ -49,6 +119,7 @@ def results2img(self, results, imgfile_prefix, to_label_id, indices=None):
49119 list[str: str]: result txt files which contains corresponding
50120 semantic segmentation images.
51121 """
122+ print ("IN RESULTS 2 IMG" )
52123 if indices is None :
53124 indices = list (range (len (self )))
54125
@@ -95,7 +166,7 @@ def format_results(self,
95166 the image paths, tmp_dir is the temporal directory created
96167 for saving json/png files when img_prefix is not specified.
97168 """
98-
169+ print ( "IN FORMAT RESULTS" )
99170 if indices is None :
100171 indices = list (range (len (self )))
101172
@@ -105,3 +176,5 @@ def format_results(self,
105176 result_files = self .results2img (results , imgfile_prefix , to_label_id ,
106177 indices )
107178 return result_files
179+
180+
0 commit comments