Skip to content

Commit

Permalink
Merge pull request #120 from ctripcorp/119-support-paddleocr-detect-l…
Browse files Browse the repository at this point in the history
…imit-config

feat:support paddleocr config
  • Loading branch information
clgwlg authored Oct 25, 2022
2 parents 9a6ecde + b244c7f commit d376c53
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
8 changes: 8 additions & 0 deletions flybirds/core/config_manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,14 @@ def __init__(self, user_data, config):
return_value(frame_config.get("useAirtestRecord", False),
False)
)
self.ocr_det_limit_type = user_data.get(
"ocr_det_limit_type",
return_value(frame_config.get("ocr_det_limit_type", "max"), "max")
)
self.ocr_det_limit_side_len = user_data.get(
"ocr_det_limit_side_len",
return_value(frame_config.get("ocr_det_limit_side_len", 960), 960)
)
self.set_frame_info_attrs(user_data)
self.set_other_attrs(user_data)

Expand Down
1 change: 1 addition & 0 deletions flybirds/core/plugin/event/active_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def run(context):
USE: behave -D browser=safari ...
"""
log.info(f'[active_before_all] user_data:{context.config.userdata}')
GlobalContext.set_global_cache('userdata', context.config.userdata)
active_tag_value_provider = active_tag_init()
log.info(f'[active_before_all] active_tag_provider:'
f'{active_tag_value_provider}')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@ def ocr_init(lang=None):
from paddleocr import PaddleOCR
# Paddleocr support languages
# example`ch`, `en`, `fr`, `german`, `korean`, `japan`
det_limit_type = gr.get_frame_config_value("ocr_det_limit_type")
det_limit_side_len = gr.get_frame_config_value("ocr_det_limit_side_len")
ocr = PaddleOCR(use_angle_cls=True,
lang=ocr_lang) # need to run only once to download and load model into memory
lang=ocr_lang,
det_limit_type=det_limit_type,
det_limit_side_len=det_limit_side_len)
# need to run only once to download and load model into memory

return ocr

4 changes: 3 additions & 1 deletion flybirds/template/config/flybirds_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@
"verifyPosNotChangeCount": 5,
"screenRecordTime": 90,
"useSnap": false,
"useAirtestRecord": false
"useAirtestRecord": false,
"ocr_det_limit_type": "max",
"ocr_det_limit_side_len": 960
},
"report": {},
"log": {}
Expand Down

0 comments on commit d376c53

Please sign in to comment.