神经网络提取PDF表格工具来了,支持图片,还能白嫖谷歌GPU资源
interesting_areas=[]output = [[x1, y1, x2, y2]]for x in output: [x1, y1, x2, y2] = bboxes_pdf(img, pdf_page, x) bbox_camelot = [ ",".join([str(x1), str(y1), str(x2), str(y2)]) ][0] # x1,y1,x2,y2 where (x1, y1) -> left-top and (x2, y2) -> right-bottom in PDF coordinate space #print(bbox_camelot) interesting_areas.append(bbox_camelot)print(interesting_areas)output_camelot = camelot.read_pdf( filepath=pdf_file, pages=str(pg), flavor="stream", table_areas=interesting_areas)output_camelot[0].df 这样就可以将表格数据转化为Panda数据框架,方便后续处理: 针对扫描图片格式的PDF表格,可以使用Ocrmypdf包来将图片格式PDF转为文本格式。 Ocrmypdf是一个python软件包,可将基于图像的pdf转换为基于文本的PDF。 安装ocrmypdf,可以通过以下命令行将其用于macOS和Linux: brew install ocrmypdf 通过以下命令调用: ocrmypdf input_file.pdf output_file.pdf 之后就可以按照上面的方法进行表格提取了。 怎么样,这款兼容图片,又能白嫖谷歌GPU的PDF表格工具对你有帮助吗? 传送门 项目地址: 在线打标签工具:
(编辑:应用网_阳江站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |