def printResults()

in maskrcnn_benchmark/data/datasets/evaluation/cityscapes/eval_instances.py [0:0]


def printResults(avgDict, args):
    strbuffer = io.StringIO()
    # redirect all the print functions to a string buffer
    with redirect_stdout(strbuffer):

        sep = "," if args.csv else ""
        col1 = ":" if not args.csv else ""
        noCol = colors.ENDC if args.colorized else ""
        bold = colors.BOLD if args.colorized else ""
        lineLen = 65

        print("")
        if not args.csv:
            print("#" * lineLen)
        line = bold
        line += "{:<15}".format("what") + sep + col1
        line += "{:>15}".format("AP") + sep
        line += "{:>15}".format("AP_50%") + sep
        line += "{:>15}".format("AP_75%") + sep
        line += noCol
        print(line)
        if not args.csv:
            print("#" * lineLen)

        for (lI, labelName) in enumerate(args.instLabels):
            apAvg = avgDict["classes"][labelName]["ap"]
            ap50o = avgDict["classes"][labelName]["ap50%"]
            ap75o = avgDict["classes"][labelName]["ap75%"]

            line = "{:<15}".format(labelName) + sep + col1
            line += getColorEntry(apAvg, args) + sep + "{:>15.3f}".format(apAvg) + sep
            line += getColorEntry(ap50o, args) + sep + "{:>15.3f}".format(ap50o) + sep
            line += getColorEntry(ap75o, args) + sep + "{:>15.3f}".format(ap75o) + sep
            line += noCol
            print(line)

        allApAvg = avgDict["allAp"]
        allAp50o = avgDict["allAp50%"]
        allAp75o = avgDict["allAp75%"]

        if not args.csv:
            print("-" * lineLen)
        line = "{:<15}".format("average") + sep + col1
        line += getColorEntry(allApAvg, args) + sep + "{:>15.3f}".format(allApAvg) + sep
        line += getColorEntry(allAp50o, args) + sep + "{:>15.3f}".format(allAp50o) + sep
        line += getColorEntry(allAp75o, args) + sep + "{:>15.3f}".format(allAp75o) + sep
        line += noCol
        print(line)
        print("")

        return strbuffer.getvalue()