(self, drop_score=0.5, det_box_type='quad', max_rec_threads=1)
| 27 | class OpenOCRParallel: |
| 28 | |
| 29 | def __init__(self, drop_score=0.5, det_box_type='quad', max_rec_threads=1): |
| 30 | cfg_det = Config( |
| 31 | './configs/det/dbnet/repvit_db.yml').cfg # mobile model |
| 32 | # cfg_rec = Config('./configs/rec/svtrv2/svtrv2_ch.yml').cfg # server model |
| 33 | cfg_rec = Config( |
| 34 | './configs/rec/svtrv2/repsvtr_ch.yml').cfg # mobile model |
| 35 | self.text_detector = OpenDetector(cfg_det, numId=0) |
| 36 | self.text_recognizer = OpenRecognizer(cfg_rec, numId=0) |
| 37 | self.det_box_type = det_box_type |
| 38 | self.drop_score = drop_score |
| 39 | self.queue = queue.Queue( |
| 40 | ) # Queue to hold detected boxes for recognition |
| 41 | self.results = {} |
| 42 | self.lock = threading.Lock() # Lock for thread-safe access to results |
| 43 | self.max_rec_threads = max_rec_threads |
| 44 | self.stop_signal = threading.Event() # Signal to stop threads |
| 45 | |
| 46 | def start_recognition_threads(self): |
| 47 | """Start recognition threads.""" |
nothing calls this directly
no test coverage detected