drivable/datasets/bdd100k.py
def results2img(
        self, results: List[np.ndarray], imgfile_prefix: str  # type: ignore
    ) -> List[str]:
        """Write the segmentation results to images."""
        mmcv.mkdir_or_exist(imgfile_prefix)
        result_files = []
        prog_bar = mmcv.ProgressBar(len(self))
        for idx in range(len(self)):
            result = results[idx]
            filename = self.img_infos[idx]["filename"]
            basename = osp.splitext(osp.basename(filename))[0]

            png_filename = osp.join(imgfile_prefix, f"{basename}.png")

            output = Image.fromarray(result.astype(np.uint8)).convert("P")
            output.save(png_filename)
            result_files.append(png_filename)
            prog_bar.update()

        return result_files
Write the segmentation results to images.
Write the segmentation results to images.
Write the segmentation results to images .
def results2img(
        self, results: List[np.ndarray], imgfile_prefix: str  
    ) -> List[str]:
        mmcv.mkdir_or_exist(imgfile_prefix)
        result_files = []
        prog_bar = mmcv.ProgressBar(len(self))
        for idx in range(len(self)):
            result = results[idx]
            filename = self.img_infos[idx]["filename"]
            basename = osp.splitext(osp.basename(filename))[0]
            png_filename = osp.join(imgfile_prefix, f"{basename}.png")
            output = Image.fromarray(result.astype(np.uint8)).convert("P")
            output.save(png_filename)
            result_files.append(png_filename)
            prog_bar.update()
        return result_files
def results2img ( self , results : List [ np . ndarray ] , imgfile_prefix : str ) -> List [ str ] : mmcv . mkdir_or_exist ( imgfile_prefix ) result_files = [ ] prog_bar = mmcv . ProgressBar ( len ( self ) ) for idx in range ( len ( self ) ) : result = results [ idx ] filename = self . img_infos [ idx ] [ "filename" ] basename = osp . splitext ( osp . basename ( filename ) ) [ 0 ] png_filename = osp . join ( imgfile_prefix , f"{basename}.png" ) output = Image . fromarray ( result . astype ( np . uint8 ) ) . convert ( "P" ) output . save ( png_filename ) result_files . append ( png_filename ) prog_bar . update ( ) return result_files
Write the segmentation results to images.
Write the segmentation results to images .
# type: ignore """Write the segmentation results to images."""
self
results
List[np.ndarray]
imgfile_prefix
str