HRFormer icon indicating copy to clipboard operation
HRFormer copied to clipboard

cocostuff dataset validation bug

Open chencheng1203 opened this issue 3 years ago • 0 comments

in the segmentation folder -> segmentation_val/segmentor/tester.py line183

def __relabel(self, label_map):
    height, width = label_map.shape
    label_dst = np.zeros((height, width), dtype=np.uint8)
    for i in range(self.configer.get('data', 'num_classes')):
        label_dst[label_map == i] = self.configer.get('data', 'label_list')[i]
  
    label_dst = np.array(label_dst, dtype=np.uint8)
  
    return label_dst

if self.configer.exists('data', 'reduce_zero_label') and self.configer.get('data', 'reduce_zero_label'):
    label_img = label_img + 1
    label_img = label_img.astype(np.uint8)
if self.configer.exists('data', 'label_list'):
    label_img_ = self.__relabel(label_img)
else:
    label_img_ = label_img

for cocostuff dataset (171 num classes), the origin predicted classes range from 0-170, after +1, it range from 1-171, then feed the label_img into __relabel() func. However, the loop in __relabel() range from 0-170, and the class 171 is not be operated.

chencheng1203 avatar Apr 25 '22 08:04 chencheng1203