def write_pascal_segmentation_result(self, pred_segmentations):
        """
        Write pred segmentation to res_file_folder
        :param pred_segmentations: the pred segmentation results
        :param res_file_folder: the saving folder
        :return: [None]
        """
        result_dir = os.path.join(self.result_path, 'results')
        if not os.path.exists(result_dir):
            os.mkdir(result_dir)
        year_folder = os.path.join(self.result_path, 'results', 'VOC' + self.year)
        if not os.path.exists(year_folder):
            os.mkdir(year_folder)
        res_file_folder = os.path.join(self.result_path, 'results', 'VOC' + self.year, 'Segmentation')
        if not os.path.exists(res_file_folder):
            os.mkdir(res_file_folder)

        result_dir = os.path.join(self.result_path, 'results', 'VOC' + self.year, 'Segmentation')
        if not os.path.exists(result_dir):
            os.mkdir(result_dir)

        pallete = self.get_pallete(256)

        for i, index in enumerate(self.image_set_index):
            segmentation_result = np.uint8(np.squeeze(np.copy(pred_segmentations[i])))
            segmentation_result = PIL.Image.fromarray(segmentation_result)
            segmentation_result.putpalette(pallete)
            segmentation_result.save(os.path.join(result_dir, '%s.png'%(index)))

        Write pred segmentation to res_file_folder
        :param pred_segmentations: the pred segmentation results
        :param res_file_folder: the saving folder
        :return: [None]
        
lib/dataset/pascal_voc.py