📄 Awesome OCR multiple programing languages toolkits based on ONNX Runtime, OpenVINO, MNN, PaddlePaddle, TensorRT and PyTorch.
Update README and fix typos.
SWHL482319fb7dc5
diff --git a/README.md b/README.mdindex babf7b1..cab8758 100755--- a/README.md+++ b/README.md@@ -1,6 +1,6 @@<div align="center">- <img src="./assets/RapidOCR_LOGO.png" width="55%" height="55%"/>+ <img src="./assets/RapidOCR_LOGO.png" width="65%" height="65%"/></div># RapidOCR (捷智OCR- 信创级开源OCR - 为世界内容安全贡献力量)@@ -24,7 +24,8 @@<details><summary>目录</summary>-- [RapidOCR (捷智OCR)](#rapidocr-捷智ocr)+- [RapidOCR (捷智OCR- 信创级开源OCR - 为世界内容安全贡献力量)](#rapidocr-捷智ocr--信创级开源ocr---为世界内容安全贡献力量)+ - [商业支持](#商业支持)- [简介](#简介)- [近期更新(more)](#近期更新more)- [🧻2022-11-20 update:](#2022-11-20-update)@@ -55,16 +56,16 @@- [多语言示例图像](#多语言示例图像)</details>-## 提供信创平台多架构商业支持--包括Arm/X86/mips(龙芯)/RISC-V等信创CPU支持,同时兼容onnxruntime/openvino/NCNN,有意联系: [email protected] , 请先邮件咨询服务项目,即时回复联系方式+## 商业支持+- 提供信创平台多架构,包括**Arm/X86/mips(龙芯)/RISC-V**等信创CPU支持,同时兼容**ONNXRuntime/OpenVINO/NCNN**。+- 有意者邮件联系: [email protected], 请先邮件咨询服务项目,即时回复联系方式。## 简介-- 💖目前已知**运行速度最快、支持最广**,完全开源免费并支持离线部署的多平台多语言OCR SDK+- 💖目前已知**运行速度最快、支持最广**,完全开源免费并支持离线部署的多平台多语言OCR。- **中文广告**: 欢迎加入我们的QQ群下载模型及测试程序,qq群号:887298230- **缘起**:百度paddlepaddle工程化不是太好,为了方便大家在各种端上进行ocr推理,我们将它转换为onnx格式,使用`Python/C++/Java/Swift/C#` 将它移植到各个平台。-- **名称来源**: 轻快好省并智能。 基于深度学习技术的OCR技术,主打人工智能优势及小模型,以速度为使命,效果为主导。-- 基于百度的开源PaddleOCR 模型及训练,任何人可以使用本推理库,也可以根据自己的需求使用百度的paddlepaddle框架进行模型优化。+- **名称来源**: 轻快好省并智能。基于深度学习技术的OCR技术,主打人工智能优势及小模型,以速度为使命,效果为主导。+- 基于百度的开源PaddleOCR 模型及训练,任何人可以使用本推理库,也可以根据自己的需求使用百度PaddlePaddle框架进行模型优化。## 近期更新([more](./docs/change_log.md))#### 🧻2022-11-20 update:diff --git a/assets/demo.gif b/assets/demo.gifindex 6b9ef7e..fc8f0a2 100644Binary files a/assets/demo.gif and b/assets/demo.gif differdiff --git a/docs/README_en.md b/docs/README_en.mdindex 1dbcc7f..62595ea 100644--- a/docs/README_en.md+++ b/docs/README_en.md@@ -23,7 +23,7 @@<details><summary>Contents</summary>-- [RapidOCR](#rapidocr)+- [RapidOCR (Open source OCR for the security of the digital world)](#rapidocr-open-source-ocr-for-the-security-of-the-digital-world)- [Introduction](#introduction)- [Recently updates(more)](#recently-updatesmore)- [🧻2022-11-20 update:](#2022-11-20-update)@@ -38,7 +38,7 @@- [Directory structure](#directory-structure)- [Current Progress](#current-progress)- [Model related](#model-related)- - [Download models(Baidu NetDisk | [Google Drive](https://drive.google.com/drive/folders/1x_a9KpCo_1blxH1xFOfgKVkw1HYRVywY?usp=sharing))](#download-modelsbaidu-netdisk--google-drive)+ - [Download models(Baidu NetDisk | Google Drive)](#download-modelsbaidu-netdisk--google-drive)- [Model to onnx](#model-to-onnx)- [Compared](#compared)- [Text Det](#text-det)@@ -51,18 +51,18 @@- [Demo](#demo-1)- [Demonstration with C++/JVM](#demonstration-with-cjvm)- [Demonstration with .Net](#demonstration-with-net)- - [Demonstratioin with multi_language](#demonstratioin-with-multi_language)+ - [Demonstratioin with multi\_language](#demonstratioin-with-multi_language)</details>## Introduction-- Completely open source, free and support offline deployment of multi-platform and multi-language OCR SDK+- Completely open source, free and support offline deployment of multi-platform and multi-language OCR.- **Chinese Advertising**: Welcome to join our QQ group to download the model and test program, QQ group number: 887298230-- **Cause**: Baidu paddlepaddle engineering is not very good, in order to facilitate everyone to perform OCR reasoning on various terminals, we convert it to onnx format, use `Python/C++/Java/Swift/C#' to change It is ported to various platforms.+- **Cause**: Baidu paddlepaddle engineering is not very good, in order to facilitate everyone to perform OCR reasoning on various terminals, we convert it to onnx format, use `Python/C++/Java/Swift/C#` to change It is ported to various platforms.- **Name Source**: Light, fast, economical and smart. OCR technology based on deep learning technology focuses on artificial intelligence advantages and small models, with speed as the mission and effect as the leading role.-- Based on Baidu's open source PaddleOCR model and training, anyone can use this inference library, or use Baidu's paddlepaddle framework for model optimization according to their own needs.+- Based on Baidu's open source PaddleOCR model and training, anyone can use this inference library, or use Baidu's PaddlePaddle framework for model optimization according to their own needs.## Recently updates([more](./change_log_en.md))#### 🧻2022-11-20 update:diff --git a/ocrweb/static/css/favicon.jpg b/ocrweb/static/css/favicon.jpgdeleted file mode 100644index 9771b29..0000000Binary files a/ocrweb/static/css/favicon.jpg and /dev/null differdiff --git a/ocrweb/static/css/main.css b/ocrweb/static/css/main.cssindex dda5565..a1d5f28 100644--- a/ocrweb/static/css/main.css+++ b/ocrweb/static/css/main.css@@ -1,207 +1,80 @@body{- background-color: white;+ background-color:#ebedef;min-height: 100%;- margin: 0px auto;+ margin: 0;}-header{- width: 100%;- height: 80px;- background-color:#fafafa;- box-shadow:0px 4px 2px rgba(0, 0, 0, 0.1);- position: fixed;- z-index: 3;- top: 0;-}-.head-wrapper{- min-width: 1000px;- max-width: 1500px;- width: 90%;- margin: 0px auto;-}-.logo{- width: 80px;- height: 80px;- border-radius: 50%;- float: left;- overflow: hidden;-}-.title{- float: left;- line-height: 80px;- font-size: 40px;-}-header span{- font-size: 25px;- padding-left: 50px;- line-height: 80px;- float: left;-}-.link{- margin: 0px;- list-style: none;- height: auto;-}-.link li{- float: right;-}-header a{- display: block;- height: 80px;- font-size: 20px;- line-height: 80px;- padding: 0px 15px;+.btn-gen {+ /* position: absolute;top:540px; left: 500px; */+ background-color: #00a1d6;+ text-align: center;+ border-radius: 18px;+ margin-top: 5px;+ font-size: 15px;+ padding: 5px 10px;+ height: 20px;+ width: 120px;+ text-transform: uppercase;+ color: #fff;+ border:none;}-header a:hover{+.btn-gen:hover,+.btn-gen:focus {+ border-color: #23AAEE;+ background-color: #23AAEE;color: white;- background-color: gray;+ cursor: pointer;}--article{- min-width: 1000px;- max-width: 1500px;- width: 80%;+.area{+ text-align: center;height: auto;- margin: 0px auto;- margin-top: 90px;- position: relative;-}-.introduction,-.leftarea,-.rightarea{- background-color: white;- overflow: hidden;- margin-bottom: 20px;- border-radius: 0px 0px 10px 10px;- border: solid rgba(128, 128, 128, 0.2) 1px;- box-shadow:4px 4px 5px rgba(0, 0, 0, 0.2);+ margin: auto;}--.intro{- margin: 10px auto;-}-.intro li{- font-size: 25px;- margin: 10px auto;-}-.leftarea{- width: 100%;+ float: left;+ width: 50%;height: auto;position: relative;}-.small-title{- display: block;- height: 45px;- line-height: 45px;- font-size: 35px;- padding-top: 5px;- padding-bottom: 5px;- margin-bottom: 10px;- padding-left: 10px;- background-color: rgba(128, 128, 128, .1);- border-bottom: 2px gray solid;-}-.img-wrapper{- width: 98%;- min-height: 400px;- margin: 0px auto;- position: relative;- /* 添加滑动条,过宽的图片可通过滑动条查看 */- overflow-x: auto;- border: 2px gray dashed;+.rightarea{+ float: left;+ width: 50%;+ height: auto;}-.container{+.table{width: auto;height: auto;- overflow: visible;- float: left;- position: relative;-}-.img{- /* 仅设置最小高度,图片若高于400px则撑开img */- min-height: 400px;- margin: 0px auto;- position: relative;+ margin: 0 auto;+}-.btn-gen,-.btn-copy,-.btn-table-excel-{- width: 160px;- height: 25px;- line-height: 25px;- background-color: #adadad;- border-radius: 5px;- margin: 10px 12px;- font-size: 20px;- padding: 5px 10px;- text-transform: uppercase;+.span_title{+ width: 98%;+ height: 36px;+ margin-top: 4px;+ line-height: 32px;+ background-color: #00a1d6;+ border: 1px solid #00a1d6;+ border-radius: 20px;color: #fff;- float: right;-}--.button-area{+ display: inline-block;text-align: center;- display: block;- border-top: 2px gray solid;- margin-top: 10px;-}--.btn-copy,-.btn-table-excel{- width: 100px;- margin:10px 12px 10px 0px;- border: hidden;-}--.btn-gen:hover,-.btn-gen:focus,-.btn-copy:hover,-.btn-copy:focus,-.btn-table-excel:hover,-.btn-table-excel:focus{- background-color: #8a8a8a;- cursor: pointer;+ font-size: 22px;+ transition: .3s;+ box-sizing: border-box;}.uplodNote{- height: 20px;- line-height: 55px;- font-size: 18px;+ font-size: 10px;color:#A1A1A1;- float: right;}-.left{- float: left;- width: 70%;- height: 1000px;- border-style: dashed;-}-.rightarea{- width: 100%;- height: auto;-}-.div-table{- width: 98%;- height: auto;- min-height: 400px;- margin: 0 auto;-}-.table{- width: auto;- height: auto;- margin: 0 auto;-}a{text-decoration:none;}-.wrapper {- position: absolute;- z-index: 2;- float: left;- width: 100%;+/* wrapper */+.leftarea>#wrapper {+ position: absolute; top: 45px; left:0px;+ width: 98%;height: 100%;background:linear-gradient(#1a98ca, #1a98ca),@@ -223,4 +96,4 @@ a{/* 终止位置 */clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%);}-}+}\ No newline at end of filediff --git a/ocrweb/templates/index.html b/ocrweb/templates/index.htmlindex a23f444..1eed084 100644--- a/ocrweb/templates/index.html+++ b/ocrweb/templates/index.html@@ -1,77 +1,36 @@-<!--- Provided by BUPT- -->-<html lang="zh">+<!DOCTYPE html>+<html lang="en"><head><meta charset="UTF-8"><title>RapidOCR Demo</title>- <link rel=stylesheet href="../static/css/main.css">+ <link rel=stylesheet type="text/css" href="{{url_for('static', filename='css/main.css')}}"><link rel="shortcut icon" href="/static/css/favicon.ico" type="image/x-icon"/></head><body>- <header>- <div class="head-wrapper">- <div class="logo">- <img src="../static/css/favicon.jpg" height="80px" alt="logo">- </div>- <div class="title">- <b><i>Rapid🗲OCR Demo</i></b>- </div>- <span>为世界内容安全贡献力量</span>- <ul class="link">- <li>- <a href="https://github.com/RapidAI/RapidOCR/tree/main/ocrweb#readme"><b>了解Demo</b></a>- </li>- <li>- <a href="https://github.com/RapidAI/RapidOCR"><b>欢迎Star</b></a>- </li>-- </ul>- </div>- </header>- <article>- <div class="introduction" id="introduction">- <span class="small-title">项 目 简 介</span>- <ul class="intro">- <li>目前已知运行速度最快、支持最广,完全开源免费并支持离线部署的多平台多语言OCR SDK</li>- <li>中文广告: 欢迎加入我们的QQ群下载模型及测试程序,qq群号:887298230</li>- <li>缘起:百度paddlepaddle工程化不是太好,为了方便大家在各种端上进行ocr推理,我们将它转换为onnx格式,使用Python/C++/Java/Swift/C# 将它移植到各个平台。</li>- <li>名称来源: 轻快好省并智能。 基于深度学习技术的OCR技术,主打人工智能优势及小模型,以速度为使命,效果为主导。</li>- <li>基于百度的开源PaddleOCR 模型及训练,任何人可以使用本推理库,也可以根据自己的需求使用百度的paddlepaddle框架进行模型优化。</li>- </ul>- </div>-+ <h1 align="center">+ <b><i>Rapid🗲OCR Demo</i></b> + <a href="https://github.com/RapidAI/RapidOCR" style="font-size: 14px;">欢迎Star</a> + <a href="https://github.com/RapidAI/RapidOCR/tree/main/ocrweb#readme" style="font-size:14px">了解Demo</a>+ </h1>+ <div class='area'>+ <span class="btn-gen" onclick="javascript:$('#rapid_ocr').click();">试试你的图片?(可拖拽、粘贴、点击)</span>+ <input type="file" style="display: none;" name="pic" id="rapid_ocr"/>+ <span class="uplodNote">支持PNG、JPG、JPEG、BMP,图片大小不超过3M。</span>+ </div>+ <br/>+ <div class="area"><div class="leftarea" id="detectDiv">- <span class="small-title">文 本 检 测 结 果</span>- <div class="img-wrapper">- <!-- 双层包裹使wrapper完全覆盖图片 -->- <div class="container">- <div class="wrapper" id="wrapper" ></div>- <div class="img" id="img-table">- <img id="detect_img" src=""/>- </div>- </div>- </div>-- <div class='button-area' >- <span class="btn-gen" onclick="javascript:$('#rapid_ocr').click();">试试你的图片?</span>- <input type="file" style="display: none;" name="pic" id="rapid_ocr"/>- <span class="uplodNote">可拖拽、粘贴、点击,支持PNG、JPG、JPEG、BMP,图片大小不超过3M。</span>- </div>+ <span class="span_title">文 本 检 测 结 果</span><br/><br/>+ <div class="wrapper" id="wrapper" hidden></div>+ <img id="detect_img" src=""/></div><div class="rightarea" id="recogDiv">- <span id="rec_res" class="small-title">文 本 识 别 结 果</span>- <div class="div-table">- <table id="locTable" class="table" cellspacing="0" cellpadding="5"></table>- </div>- <div class="button-area">- <!-- 留下两个按钮的位置,后续完善相应功能 -->- <span class="btn-copy" onclick="copy_table()">复制</span>- <span class="btn-table-excel" onclick="table_to_excel()">导出Excel</span>- </div>+ <span id="rec_res" class="span_title">文 本 识 别 结 果</span>+ <br/><br/>+ <table id="locTable" class="table" cellspacing="0" cellpadding="5"></table></div>- </article>+ </div><script src="{{url_for('static', filename='js/jquery-3.0.0.min.js')}}"></script><script type="text/javascript">// 页面加载时,执行@@ -109,6 +68,7 @@let trans = e.originalEvent.clipboardData;handleData(trans);});+function handleData(trans) {if (trans.items) {for (let i = 0; i < trans.items.length; i++) {@@ -163,8 +123,12 @@data: JSON.stringify(upload_data),contentType: 'application/json; charset=UTF-8',dataType: 'json',+beforeSend:function(){$("#detect_img").attr('src', reader.result);+ $("#detect_img").attr("width", "95%");+ $("#detect_img").attr("height", "100%");+$("#wrapper").show();$("#locTable").hide();$("#rec_res").html("文本识别结果");@@ -182,57 +146,44 @@document.getElementById("rec_res").textContent = "文 本 检 测 结 果(Total:" + String(data["total_elapse"]) + "s)"$("#rec_res").show();}-+if (data["rec_res"]){var rec_res = JSON.parse(data["rec_res"]);- // 实现对非法图片的安全保护- // Provided by BUPT- var regex = /<([a-z][\s\S]*)>.*<\/([a-z][\s\S]*)>/i;- var full_text = "";- for(let k = 0; k < rec_res.length; k++){- var temp = rec_res[k];- var words = temp[1];- full_text = full_text + words;- }- var result = regex.test(full_text);- if(result){- alert("疑似存在恶意代码,文本结果将不会在表格中显示!");- }- else{- // console.log(data['elapse_part']);- if (data['elapse_part']){- var elapse_list = data['elapse_part'].split(',');- }else{- var elapse_list = [0, 0, 0];- }- var data = "";- data += "<tr>" +- '<th align="right">Det: ' + elapse_list[0] + 's</th>' +- '<th align="center">Cls: ' + elapse_list[1] + 's</th>' +- '<th align="left">Rec: ' + elapse_list[2] + 's</th>' +- "</tr>"- data += "<tr>" +- '<th bgcolor="#C0C0C0">序号</th>' +- '<th bgcolor="#C0C0C0">识别结果</th>' +- '<th bgcolor="#C0C0C0">置信度</th>' +- "</tr>"- for (let i = 0; i < rec_res.length; i++) {- const element = rec_res[i];- let num = element[0];-- let rec_result = element[1];- let score = Number(element[2]);- score = score.toFixed(4);- data += "<tr>"- data += "<td>" + num + "</td>";- data += "<td align='left'>" + rec_result + "</td>";- data += "<td>" + score + "</td>";- data += "</tr>"- }- document.getElementById("locTable").innerHTML = data;- $("#locTable").show();+ // console.log(data['elapse_part']);+ if (data['elapse_part']){+ var elapse_list = data['elapse_part'].split(',');+ }else{+ var elapse_list = [0, 0, 0];}+ var data = "";+ data += "<tr>" ++ '<th align="right">Det: ' + elapse_list[0] + 's</th>' ++ '<th align="center">Cls: ' + elapse_list[1] + 's</th>' ++ '<th align="left">Rec: ' + elapse_list[2] + 's</th>' ++ "</tr>"+ data += "<tr>" ++ '<th bgcolor="#C0C0C0">序号</th>' ++ '<th bgcolor="#C0C0C0">识别结果</th>' ++ '<th bgcolor="#C0C0C0">置信度</th>' ++ "</tr>"+ for (let i = 0; i < rec_res.length; i++) {+ const element = rec_res[i];+ let num = element[0];++ let rec_result = element[1];++ let score = Number(element[2]);+ score = score.toFixed(4);++ data += "<tr>"+ data += "<td>" + num + "</td>";+ data += "<td align='left'>" + rec_result + "</td>";+ data += "<td>" + score + "</td>";+ data += "</tr>"+ }+ document.getElementById("locTable").innerHTML = data;+ $("#locTable").show();}}@@ -243,16 +194,5 @@reader.readAsDataURL(targetFile)}</script>- <script>- function copy_table(){- alert("Copy the table to Pasteboard!");- }- function table_to_excel()- {- alert("Change table to Excel!");- }- </script>- <footer>- <br>- </footer></body>+</html>\ No newline at end of file