GithubHelp home page GithubHelp logo

formextract's Introduction

基于YOLOv5和PaddleOCR的表单提取工具

注:没有接触过机器学习,只是一个了解学习的demo

基本思路:输入表单图片(比如原型图或是设计稿),提取图片上所有表单相关的信息(包括label及其位置信息,表单域的类型及其位置信息),组合成html输出

YOLOv5

表单域的类型和位置检测使用的是yolov5 需要先针对表单类型做数据训练

docker exec -it yolov5 python detect.py --source $pwd --weight $pwd

待检测的图片和权重文件需要放在容器挂载的目录里

detect.py

yolov5的预测脚本做了一点修改

# 
+ 163 if save_txt and exist_ok:
+ 164   with open(txt_path + '.txt', 'w'):
+ 165     pass
166
167 for *xyxy, conf, cls in reversed(det):
168    if save_txt:  # Write to file
169        xywh = (xyxy2xywh(torch.tensor(xyxy).view(1, 4)) / gn).view(-1).tolist()  # normalized xywh
+ 170        cls_bk = cls
+ 171        cls = names[int(cls.item())]
172        line = (cls, *xywh, conf) if save_conf else (cls, *xywh)  # label format
173        with open(txt_path + '.txt', 'a') as f:
174          f.write(('%s ' * len(line)).rstrip() % line + '\n')
+ 175        cls = cls_bk

PaddleOCR

label的识别使用的是飞浆的OCR工具库 采用的是服务器部署的方案

Flask

使用Flask作为接口服务器的web框架

formextract's People

Contributors

sepveneto avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.