Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

significant performance increase by moving mandatory condition to the top #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions script.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,22 +176,29 @@ def char_fill(detNums, matchMat):
gtCharCounts[gtNum][detNum][gtCharNum] = 1

def one_to_one_match(row, col):
valid = recallMat[row,col] >= evaluationParams['AREA_RECALL_CONSTRAINT'] and precisionMat[row,col] >= evaluationParams['AREA_PRECISION_CONSTRAINT']
if not valid:
return False

cont = 0
for j in range(len(recallMat[0])):
if recallMat[row,j] >= evaluationParams['AREA_RECALL_CONSTRAINT'] and precisionMat[row,j] >= evaluationParams['AREA_PRECISION_CONSTRAINT'] :
cont = cont +1
if cont > 1:
return False

if (cont != 1):
return False
cont = 0
for i in range(len(recallMat)):
if recallMat[i,col] >= evaluationParams['AREA_RECALL_CONSTRAINT'] and precisionMat[i,col] >= evaluationParams['AREA_PRECISION_CONSTRAINT'] :
cont = cont +1
if cont > 1:
return False
if (cont != 1):
return False

if recallMat[row,col] >= evaluationParams['AREA_RECALL_CONSTRAINT'] and precisionMat[row,col] >= evaluationParams['AREA_PRECISION_CONSTRAINT'] :
return True
return False
return True

def one_to_many_match(gtNum):
many_sum = 0
Expand Down