# Buggy code
def _evaluate_cityscapes(self, results, logger, imgfile_prefix):
    """Evaluation in Cityscapes protocol.

    Args:
        results (list): Testing results of the dataset.
        logger (logging.Logger | str | None): Logger used for printing
            related information during evaluation. Default: None.
        imgfile_prefix (str | None): The prefix of output image file

    Returns:
        dict[str: float]: Cityscapes evaluation results.
    """
    try:
        import cityscapesscripts.evaluation.evalPixelLevelSemanticLabeling as CSEval  # noqa
    except ImportError:
        raise ImportError(
            'Please run "pip install citscapesscripts" to '
            "install cityscapesscripts first."
        )
    msg = "Evaluating in Cityscapes style"
    if logger is None:
        msg = "\n" + msg
    print_log(msg, logger=logger)

    result_files, tmp_dir = self.format_results(results, imgfile_prefix)

    if tmp_dir is None:
        result_dir = imgfile_prefix
    else:
        result_dir = tmp_dir.name

    eval_results = dict()
    print_log(f"Evaluating results under {result_dir} ...", logger=logger)

    CSEval.args.evalInstLevelScore = True
    CSEval.args.predictionPath = osp.abspath(result_dir)
    CSEval.args.evalPixelAccuracy = True
    CSEval.args.JSONOutput = False

    seg_map_list = []
    pred_list = []

    # when evaluating with official cityscapesscripts,
    # **_gtFine_labelIds.png is used
    for seg_map in mmcv.scandir(self.ann_dir, "gtFine_labelIds.png", recursive=True):
        seg_map_list.append(osp.join(self.ann_dir, seg_map))
        pred_list.append(CSEval.getPrediction(CSEval.args, seg_map))

    eval_results.update(CSEval.evaluateImgLists(pred_list, seg_map_list, CSEval.args))

    if tmp_dir is not None:
        tmp_dir.cleanup()

    return eval_results


# Traceback (ValueError)
Traceback (most recent call last):
File "tools/test.py", line 142, in <module>
main()
File "tools/test.py", line 120, in main
outputs = single_gpu_test(model, data_loader, args.show, args.show_dir)
File "/root/code/mmsegmentation/mmseg/apis/test.py", line 62, in single_gpu_test
out_file=out_file)
File "/root/code/mmsegmentation/mmseg/models/segmentors/base.py", line 253, in show_result
img = img * 0.5 + color_seg * 0.5
ValueError: operands could not be broadcast together with shapes (1600,1600,3) (512,512,3)

# Fixed code
def _evaluate_cityscapes(self, results, logger, imgfile_prefix):
    """Evaluation in Cityscapes protocol.

    Args:
        results (list): Testing results of the dataset.
        logger (logging.Logger | str | None): Logger used for printing
            related information during evaluation. Default: None.
        imgfile_prefix (str | None): The prefix of output image file

    Returns:
        dict[str: float]: Cityscapes evaluation results.
    """
    try:
        import cityscapesscripts.evaluation.evalPixelLevelSemanticLabeling as CSEval  # noqa
    except ImportError:
        raise ImportError(
            'Please run "pip install cityscapesscripts" to '
            "install cityscapesscripts first."
        )
    msg = "Evaluating in Cityscapes style"
    if logger is None:
        msg = "\n" + msg
    print_log(msg, logger=logger)

    result_files, tmp_dir = self.format_results(results, imgfile_prefix)

    if tmp_dir is None:
        result_dir = imgfile_prefix
    else:
        result_dir = tmp_dir.name

    eval_results = dict()
    print_log(f"Evaluating results under {result_dir} ...", logger=logger)

    CSEval.args.evalInstLevelScore = True
    CSEval.args.predictionPath = osp.abspath(result_dir)
    CSEval.args.evalPixelAccuracy = True
    CSEval.args.JSONOutput = False

    seg_map_list = []
    pred_list = []

    # when evaluating with official cityscapesscripts,
    # **_gtFine_labelIds.png is used
    for seg_map in mmcv.scandir(self.ann_dir, "gtFine_labelIds.png", recursive=True):
        seg_map_list.append(osp.join(self.ann_dir, seg_map))
        pred_list.append(CSEval.getPrediction(CSEval.args, seg_map))

    eval_results.update(CSEval.evaluateImgLists(pred_list, seg_map_list, CSEval.args))

    if tmp_dir is not None:
        tmp_dir.cleanup()

    return eval_results