|
@@ -45,10 +45,11 @@ class RecItem:
|
|
|
|
|
|
|
|
|
class Parser(object):
|
|
|
- def __init__(self, ocr_results: List[List[OcrResult]], raw_results: List):
|
|
|
+ def __init__(self, ocr_results: List[List[OcrResult]], raw_results: List, ppocr):
|
|
|
self.result = ocr_results
|
|
|
self.res = defaultdict(RecItem)
|
|
|
self.raw_results = raw_results
|
|
|
+ self.ppocr = ppocr
|
|
|
self.keys = ["social_code", "company_name", "legal_person", "registered_capital", 'type', 'start_date',
|
|
|
"business_scope", 'expire_date', 'address', 'stamp']
|
|
|
|
|
@@ -81,10 +82,9 @@ class Parser(object):
|
|
|
|
|
|
class BusinessLicenseParser0(Parser):
|
|
|
|
|
|
- def __init__(self, ocr_results: List[List[OcrResult]], image, raw_results: List):
|
|
|
- Parser.__init__(self, ocr_results, raw_results)
|
|
|
+ def __init__(self, ocr_results: List[List[OcrResult]], image, raw_results: List, ppocr):
|
|
|
+ Parser.__init__(self, ocr_results, raw_results, ppocr)
|
|
|
self.image = image
|
|
|
- self.ocr = ocr
|
|
|
|
|
|
def social_code(self):
|
|
|
"""
|
|
@@ -254,7 +254,7 @@ class BusinessLicenseParser0(Parser):
|
|
|
经营范围
|
|
|
"""
|
|
|
ocr = PaddleOCR(use_gpu=True)
|
|
|
- bs_txt, bs_conf, ad_txt, ad_conf = BussinessParse0(ocr).detection(self.image, self.raw_results)
|
|
|
+ bs_txt, bs_conf, ad_txt, ad_conf = BussinessParse0(self.ocr).detection(self.image, self.raw_results)
|
|
|
if bool(bs_txt):
|
|
|
self.res['business_scope'] = RecItem(bs_txt, bs_conf)
|
|
|
|
|
@@ -346,8 +346,8 @@ class BusinessLicenseParser0(Parser):
|
|
|
|
|
|
class BusinessLicenseParser1(Parser):
|
|
|
|
|
|
- def __init__(self, ocr_results: List[List[OcrResult]], image, raw_results: List):
|
|
|
- Parser.__init__(self, ocr_results, raw_results)
|
|
|
+ def __init__(self, ocr_results: List[List[OcrResult]], image, raw_results: List, ppocr):
|
|
|
+ Parser.__init__(self, ocr_results, raw_results, ppocr)
|
|
|
self.image = image
|
|
|
self.ocr = PaddleOCR(use_gpu=True)
|
|
|
|