Skip to content

Commit

Permalink
min score and dscore support
Browse files Browse the repository at this point in the history
  • Loading branch information
pliablepixels committed Jul 5, 2019
1 parent 81a0177 commit f93d6f6
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 15 deletions.
17 changes: 11 additions & 6 deletions hook/objectconfig.ini
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ face_model=cnn
#frame_id=32
#wait=3



#[monitor-4]
# detect_pattern=(cat|dog)
# kitchen_door=313,221 392,210 418,592 367,659
Expand Down Expand Up @@ -197,17 +199,20 @@ face_model=hog
face_upsample_times=1

[alpr]
# leave this as is
# currently unused
alpr_service=plate_recognizer
# replace with your api key
alpr_key=YOURAPIKEY
# leave this as is
alpr_key=YOURKEY
# leave this as yes for now
alpr_use_after_detection_only=yes
# if yes, then it will log usage statistics of the ALPR service
alpr_stats=yes

# If you want to specify regions. See http://docs.platerecognizer.com/#regions-supported
#alpr_regions=['us','cn','kr']

# If you want to host a local SDK https://app.platerecognizer.com/sdk/
#alpr_url=https://localhost:8080/alpr
#alpr_url=https://localhost:8080

# minimal confidence for actually detecting a plate
alpr_min_dscore=0.5
# minimal conficende for the translated text
alpr_min_score=0.5
19 changes: 12 additions & 7 deletions hook/zmes_hook_helpers/alpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,16 @@ def detect(self,object):

for plates in response['results']:
label = plates['plate']
x1 = round(int(plates['box']['xmin']) * xfactor)
y1 = round(int(plates['box']['ymin']) * yfactor)
x2 = round(int(plates['box']['xmax']) * xfactor)
y2 = round(int(plates['box']['ymax']) * yfactor)
labels.append(label)
bbox.append( [x1,y1,x2,y2])
confs.append(plates['score'])
dscore = plates['dscore']
score = plates['score']
if dscore >= g.config['alpr_min_dscore'] and score >= g.config['alpr_min_score']:
x1 = round(int(plates['box']['xmin']) * xfactor)
y1 = round(int(plates['box']['ymin']) * yfactor)
x2 = round(int(plates['box']['xmax']) * xfactor)
y2 = round(int(plates['box']['ymax']) * yfactor)
labels.append(label)
bbox.append( [x1,y1,x2,y2])
confs.append(plates['score'])
else:
g.logger.debug ('ALPR: discarding plate:{} because its dscore:{}/score:{} are not in range of configured dscore:{} score:{}'.format(label,dscore,score, g.config['alpr_min_dscore'], g.config['alpr_min_score']))
return (bbox, labels, confs)
17 changes: 15 additions & 2 deletions hook/zmes_hook_helpers/common_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,20 @@
'default': 'no',
'type': 'string'
},


'alpr_min_dscore':{
'section': 'alpr',
'default': '0.3',
'type': 'float'
},
'alpr_min_dscore':{
'section': 'alpr',
'default': '0.5',
'type': 'float'
},
'alpr_min_score':{
'section': 'alpr',
'default': '0.5',
'type': 'float'
},

}

0 comments on commit f93d6f6

Please sign in to comment.