Unverified Commit 5aacfc41 authored by Sergey Pinus's avatar Sergey Pinus Committed by GitHub
Browse files

Update ocr_paddle.py

parent eecaac36
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -206,15 +206,15 @@ class PaddleOCRModule(OCRBase):
            x1, y1, x2, y2 = blk.xyxy
            if 0 <= x1 < x2 <= im_w and 0 <= y1 < y2 <= im_h:
                cropped_img = img[y1:y2, x1:x2]
                if self.debug_mode:
                    self.logger.debug(f"Processing a block with coordinates: ({x1}, {y1}, {x2}, {y2})")
                    # Log the text from each block
                    self.logger.debug(f"Text from the block ({x1}, {y1}, {x2}, {y2}): {text}")
                try:
                    result = self.model.ocr(cropped_img, det=True, rec=True, cls=self.use_angle_cls)
                    text = self._process_result(result)
                    blk.text = text if text else ''
                    
                    if self.debug_mode:
                        self.logger.debug(f"Processing a block with coordinates: ({x1}, {y1}, {x2}, {y2})")
                        self.logger.debug(f"Text from the block ({x1}, {y1}, {x2}, {y2}): {text}")

                except Exception as e:
                    if self.debug_mode:
                        self.logger.error(f"Error recognizing block: {str(e)}")