diff --git a/PPOCRLabel/PPOCRLabel.py b/PPOCRLabel/PPOCRLabel.py index 827f1cf76846d0e232e980bc21f45ae0cd1a640b..c17db91a5b5cd9d3cbb4b5bf6c87afd745d0870d 100644 --- a/PPOCRLabel/PPOCRLabel.py +++ b/PPOCRLabel/PPOCRLabel.py @@ -2285,7 +2285,7 @@ class MainWindow(QMainWindow): ''' Table Recegnition ''' - from paddleocr.ppstructure.table.predict_table import to_excel + from paddleocr import to_excel import time @@ -2309,7 +2309,7 @@ class MainWindow(QMainWindow): # ONLY SUPPORT ONE TABLE in one image hasTable = False for region in res: - if region['type'] == 'Table': + if region['type'] == 'table': if region['res']['boxes'] is None: msg = 'Can not recognise the detection box in ' + self.filePath + '. Please change manually' QMessageBox.information(self, "Information", msg) @@ -2335,10 +2335,7 @@ class MainWindow(QMainWindow): bbox = np.array(region['res']['boxes'][i]) rec_text = region['res']['rec_res'][i][0] - # polys to rectangles - x1, y1 = np.min(bbox[:, 0]), np.min(bbox[:, 1]) - x2, y2 = np.max(bbox[:, 0]), np.max(bbox[:, 1]) - rext_bbox = [[x1, y1], [x2, y1], [x2, y2], [x1, y2]] + rext_bbox = [[bbox[0], bbox[1]], [bbox[2], bbox[1]], [bbox[2], bbox[3]], [bbox[0], bbox[3]]] # save bbox to shape shape = Shape(label=rec_text, line_color=DEFAULT_LINE_COLOR, key_cls=None) diff --git a/PPOCRLabel/libs/canvas.py b/PPOCRLabel/libs/canvas.py index ae9511612a2ba83001c12ae8ed82498952207f98..81f37995126140b03650f5ddea37ea282d5ceb09 100644 --- a/PPOCRLabel/libs/canvas.py +++ b/PPOCRLabel/libs/canvas.py @@ -627,7 +627,7 @@ class Canvas(QWidget): # adaptive BBOX label & index font size if self.pixmap: h, w = self.pixmap.size().height(), self.pixmap.size().width() - fontszie = int(max(h, w) / 96) + fontszie = int(max(h, w) / 48) for s in self.shapes: s.fontsize = fontszie diff --git a/__init__.py b/__init__.py index 11436094c163db1b91f5ac38f2936a53017016c1..a7c32e9629d2e5ff04dc2ca45c6317caac8fa631 100644 --- a/__init__.py +++ b/__init__.py @@ -17,5 +17,5 @@ __version__ = paddleocr.VERSION __all__ = [ 'PaddleOCR', 'PPStructure', 'draw_ocr', 'draw_structure_result', 'save_structure_res', 'download_with_progressbar', 'sorted_layout_boxes', - 'convert_info_docx' + 'convert_info_docx', 'to_excel' ] diff --git a/paddleocr.py b/paddleocr.py index 1a236f2474cf3d5ef1fc6ab61955157bb1837db2..0b7aed36279081f50208f75272fc54c5081929a7 100644 --- a/paddleocr.py +++ b/paddleocr.py @@ -39,15 +39,15 @@ from ppocr.utils.utility import check_and_read, get_image_file_list from ppocr.utils.network import maybe_download, download_with_progressbar, is_link, confirm_model_dir_url from tools.infer.utility import draw_ocr, str2bool, check_gpu from ppstructure.utility import init_args, draw_structure_result -from ppstructure.predict_system import StructureSystem, save_structure_res +from ppstructure.predict_system import StructureSystem, save_structure_res, to_excel __all__ = [ 'PaddleOCR', 'PPStructure', 'draw_ocr', 'draw_structure_result', - 'save_structure_res', 'download_with_progressbar' + 'save_structure_res', 'download_with_progressbar', 'to_excel' ] SUPPORT_DET_MODEL = ['DB'] -VERSION = '2.6' +VERSION = '2.6.0.1' SUPPORT_REC_MODEL = ['CRNN', 'SVTR_LCNet'] BASE_DIR = os.path.expanduser("~/.paddleocr/") diff --git a/ppstructure/pdf2word/pdf2word.py b/ppstructure/pdf2word/pdf2word.py index b05886f62a871fa4f41b81f4292a848e859e2eb7..6b394094f3b24bfaa7829541f4f9a2a48f3d493f 100644 --- a/ppstructure/pdf2word/pdf2word.py +++ b/ppstructure/pdf2word/pdf2word.py @@ -181,7 +181,7 @@ class APP_Image2Doc(QWidget): # settings self.imagePaths = [] -# self.screenShotWg = ScreenShotWidget() + # self.screenShotWg = ScreenShotWidget() self.screenShot = None self.save_pdf = False self.output_dir = None @@ -358,17 +358,17 @@ class APP_Image2Doc(QWidget): self.pb.setRange(0, len(self.imagePaths)) self.pb.setValue(0) -# def screenShotSlot(self): -# ''' -# 选定图像文件和截图的转换过程只能同时进行一个 -# 截图只能同时转换一个 -# ''' -# self.screenShotWg.start() -# if self.screenShotWg.captureImage: -# self.screenShot = self.screenShotWg.captureImage -# self.imagePaths.clear() # discard openfile temp list -# self.pb.setRange(0, 1) -# self.pb.setValue(0) + # def screenShotSlot(self): + # ''' + # 选定图像文件和截图的转换过程只能同时进行一个 + # 截图只能同时转换一个 + # ''' + # self.screenShotWg.start() + # if self.screenShotWg.captureImage: + # self.screenShot = self.screenShotWg.captureImage + # self.imagePaths.clear() # discard openfile temp list + # self.pb.setRange(0, 1) + # self.pb.setValue(0) def handleStartSignal(self, lang): if self.screenShot: # for screenShot