| 124 | return pInt.area() |
| 125 | |
| 126 | def compute_ap(confList, matchList,numGtCare): |
| 127 | correct = 0 |
| 128 | AP = 0 |
| 129 | if len(confList)>0: |
| 130 | confList = np.array(confList) |
| 131 | matchList = np.array(matchList) |
| 132 | sorted_ind = np.argsort(-confList) |
| 133 | confList = confList[sorted_ind] |
| 134 | matchList = matchList[sorted_ind] |
| 135 | for n in range(len(confList)): |
| 136 | match = matchList[n] |
| 137 | if match: |
| 138 | correct += 1 |
| 139 | AP += float(correct)/(n + 1) |
| 140 | |
| 141 | if numGtCare>0: |
| 142 | AP /= numGtCare |
| 143 | |
| 144 | return AP |
| 145 | |
| 146 | def transcription_match(transGt,transDet,specialCharacters=unicode('!?.:,*"()·[]/\'','utf-8'),onlyRemoveFirstLastCharacterGT=True): |
| 147 | |