( ap=1, iouThr=None, areaRng='all', maxDets=100 )
| 426 | Note this functin can *only* be applied on the default parameter setting |
| 427 | ''' |
| 428 | def _summarize( ap=1, iouThr=None, areaRng='all', maxDets=100 ): |
| 429 | p = self.params |
| 430 | iStr = ' {:<18} {} @[ IoU={:<9} | area={:>6s} | maxDets={:>3d} ] = {:0.3f}' |
| 431 | titleStr = 'Average Precision' if ap == 1 else 'Average Recall' |
| 432 | typeStr = '(AP)' if ap==1 else '(AR)' |
| 433 | iouStr = '{:0.2f}:{:0.2f}'.format(p.iouThrs[0], p.iouThrs[-1]) \ |
| 434 | if iouThr is None else '{:0.2f}'.format(iouThr) |
| 435 | |
| 436 | aind = [i for i, aRng in enumerate(p.areaRngLbl) if aRng == areaRng] |
| 437 | mind = [i for i, mDet in enumerate(p.maxDets) if mDet == maxDets] |
| 438 | if ap == 1: |
| 439 | # dimension of precision: [TxRxKxAxM] |
| 440 | s = self.eval['precision'] |
| 441 | # print(s) |
| 442 | # IoU |
| 443 | if iouThr is not None: |
| 444 | t = np.where(iouThr == p.iouThrs)[0] |
| 445 | s = s[t] |
| 446 | s = s[:,:,:,aind,mind] |
| 447 | else: |
| 448 | # dimension of recall: [TxKxAxM] |
| 449 | s = self.eval['recall'] |
| 450 | if iouThr is not None: |
| 451 | t = np.where(iouThr == p.iouThrs)[0] |
| 452 | s = s[t] |
| 453 | s = s[:,:,aind,mind] |
| 454 | if len(s[s>-1])==0: |
| 455 | # print("HERE") |
| 456 | mean_s = -1 |
| 457 | else: |
| 458 | mean_s = np.mean(s[s>-1]) |
| 459 | print(iStr.format(titleStr, typeStr, iouStr, areaRng, maxDets, mean_s)) |
| 460 | return mean_s |
| 461 | def _summarizeDets(): |
| 462 | stats = np.zeros((12,)) |
| 463 | stats[0] = _summarize(1) |
nothing calls this directly
no outgoing calls
no test coverage detected