'Compute and display summary metrics for evaluation results.
Note this functin can *only* be applied on the default parameter setting'

def summarize(self):

    def _summarize(ap=1, iouThr=None, areaRng='all', maxDets=100):
        p = self.params
        iStr = '    {:<18}    {}    @[    IoU={:<9}    |    area={:>6}    |    maxDets={:>3}    ]    =    {}'
        titleStr = ('Average    Precision' if (ap == 1) else 'Average    Recall')
        typeStr = ('(AP)' if (ap == 1) else '(AR)')
        iouStr = (('%0.2f:%0.2f' % (p.iouThrs[0], p.iouThrs[(-1)])) if (iouThr is None) else ('%0.2f' % iouThr))
        areaStr = areaRng
        maxDetsStr = ('%d' % maxDets)
        aind = [i for (i, aRng) in enumerate(['all', 'small', 'medium', 'large']) if (aRng == areaRng)]
        mind = [i for (i, mDet) in enumerate([1, 10, 100]) if (mDet == maxDets)]
        if (ap == 1):
            s = self.eval['precision']
            if (iouThr is not None):
                t = np.where((iouThr == p.iouThrs))[0]
                s = s[t]
            s = s[:, :, :, aind, mind]
        else:
            s = self.eval['recall']
            s = s[:, :, aind, mind]
        if (len(s[(s > (-1))]) == 0):
            mean_s = (-1)
        else:
            mean_s = np.mean(s[(s > (-1))])
        print iStr.format(titleStr, typeStr, iouStr, areaStr, maxDetsStr, ('%.3f' % float(mean_s)))
        return mean_s
    if (not self.eval):
        raise Exception('Please    run    accumulate()    first')
    self.stats = np.zeros((12,))
    self.stats[0] = _summarize(1)
    self.stats[1] = _summarize(1, iouThr=0.5)
    self.stats[2] = _summarize(1, iouThr=0.75)
    self.stats[3] = _summarize(1, areaRng='small')
    self.stats[4] = _summarize(1, areaRng='medium')
    self.stats[5] = _summarize(1, areaRng='large')
    self.stats[6] = _summarize(0, maxDets=1)
    self.stats[7] = _summarize(0, maxDets=10)
    self.stats[8] = _summarize(0, maxDets=100)
    self.stats[9] = _summarize(0, areaRng='small')
    self.stats[10] = _summarize(0, areaRng='medium')
    self.stats[11] = _summarize(0, areaRng='large')
