Git Product home page Git Product logo

darknet-ocr's Introduction

目前支持系统:mac/ubuntu python=3.6

实现功能

  • 支持系统,macOs/linux;
  • 支持系统windows;
  • 文字检测;
  • 文字识别;
  • 支持GPU/CPU,CPU优化(opencv dnn);
  • 文字方向检测(4分类模型);
  • 支持PDF文档识别;
  • 文字检测训练;
  • CNN+CTC ocr训练;
  • 多语言( 藏语、蒙古语、 朝鲜语、 日本语、 韩语);

ocr训练数据集

ocr ctc训练数据集(压缩包解码:chineseocr)
百度网盘地址:链接: https://pan.baidu.com/s/1UcUKUUELLwdM29zfbztzdw 提取码: atwn
gofile地址:http://gofile.me/4Nlqh/uT32hAjbx 密码 https://github.com/chineseocr/chineseocr

模型文件(参考models目录)

下载地址:http://gofile.me/4Nlqh/fNHlWzVWo

编译对GPU的支持

## GPU
cd darknet && cp  Makefile-GPU Makefile && make

CPU优化

参考opencv版本编译 : https://github.com/chineseocr/opencv-for-darknet.git

docker镜像服务(CPU优化版本)

下载镜像 链接:https://pan.baidu.com/s/12F9AYVyBTz34UCXeWj3ATA 密码:5lyz

docker load -i darknet-ocr.tar
docker run -it -p 8080:8080 darknet-ocr:1.0 python app.py

web服务启动(支持文件上传及URL图像)

cd darknet-ocr
python3 app.py 8080

访问服务

http://127.0.0.1:8080/text

识别结果展示

参考

  1. darknet https://github.com/pjreddie/darknet.git
  2. ctpn https://github.com/eragonruan/text-detection-ctpn
  3. CTPN https://github.com/tianzhi0549/CTPN
  4. chineseocr https://github.com/chineseocr/chineseocr

技术支持合作

mail:[email protected]
wechat:lywen52

darknet-ocr's People

Contributors

wenlihaoyu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

darknet-ocr's Issues

数据集问题

大佬你的数据集是生成么,如果是请指点一下生成所需要考虑到的细节因素,还有您使用字符集是多少个的、有没有使用专业语料库之类的

什么python3的版本

感觉启动后好多问题都是在templates/text.htm 中的python格式各种语法报错
我的是mac的3.8的python,跑起来比较艰难

Win10下启动后立即退出

1、采用cygwin make好darknet并部署
2、pip安装了库
python app.py 8080 后,命令行直接退出,无任何提示,浏览器无法访问,
请问有人遇到过吗?

text.weights模型文件無法下載

版主您好,我點進模型文建下載時百度網盤說網頁不存在了,不知道是不是地區的關係從來沒有一次從百度網盤下在成功,方便提供其他的載點嗎,謝謝!

模型训练数据

您好!您用了多少数据进行的训练,有训练数据吗?

: Unknown error 1362440885

大神,您好:

大概测试了一下,cpu版本是没有问题的,
但gpu版本在运行时,会报:: Unknown error 1362440885 的错误,程序退出。
初步定位了下,是在:dnn/text.py 的14行:
textNet = load_net(textPath.replace('.weights','.cfg').encode(),textPath.encode(), 0)
运行这一步时,报的错, 没有其他输出信息。
请问这个是什么原因导致的? 谢谢。

日语模型识别失败

image

以下是结果:
序号 值
0 海政面憶九拳衝釘釧貝ャ割握視晩キ稼熔材井釘窒×芭赤稼村政朗台憶造_鎖劣條壊胆療塚政あ海●五困

请问日语模型是不是还不能使用

How to solve it please

I run app.py but it is a error, how to solve it? Thanks

OSError: dlopen(darknet/libdarknet.so, 10): image not found

服务起不来network_predict_image_vgg找不到

$ python3 app.py 8080
app.py:81: SyntaxWarning: "is not" with a literal. Did you mean "!="?
if 'uuid' is not None and (url is not None or imgString is not None):
Traceback (most recent call last):
File "app.py", line 14, in
from dnn.text import detect_lines
File "/Users/akore/Downloads/darknet-ocr-master/dnn/text.py", line 13, in
from dnn.darknet import load_net,predict_image,array_to_image
File "/Users/akore/Downloads/darknet-ocr-master/dnn/darknet.py", line 112, in
predict_image =lib.network_predict_image_vgg
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ctypes/init.py", line 382, in getattr
func = self.getitem(name)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ctypes/init.py", line 387, in getitem
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: dlsym(0x7ff287681f10, network_predict_image_vgg): symbol not found

darknet编译错误目前已发现两处代码错误,麻烦大佬更新下bug

<1>在src中的network.cu中1005行:
void sync_n
ets(network **nets, int n, int interval)
正确应该为:void sync_nets(network **nets, int n, int interval)
<2>在src中的maxpool_layer_kernels.cu中36,37行:
int cur_h = h_offset + istride[0] + l;
int cur_w = w_offset + j
stride[1] + m;
正确应为:
int cur_h = h_offset + istrideh + l;
int cur_w = w_offset + j
stridew + m;
<3>在src中的maxpool_layer_kernels.cu中55行:
int area = (size-1)/stride;
这个stride到底是strideh 还是stridew ,我也蒙圈了

运行报错,搜索无果,请指导,非常感谢

(base) xxxx@ubuntu:~/darknet-ocr-master$ python app.py 8080
Traceback (most recent call last):
File "app.py", line 14, in
from dnn.text import detect_lines
File "/home/xxx/darknet-ocr-master/dnn/text.py", line 13, in
from dnn.darknet import load_net,predict_image,array_to_image
File "/home/xxx/darknet-ocr-master/dnn/darknet.py", line 112, in
predict_image =lib.network_predict_image_vgg
File "/home/xxx/anaconda3/lib/python3.6/ctypes/init.py", line 357, in getattr
func = self.getitem(name)
File "/home/xxx/anaconda3/lib/python3.6/ctypes/init.py", line 362, in getitem
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: ../darknet/libdarknet.so: undefined symbol: network_predict_image_vgg

多方查找资料,也多次编译darknet但问题依然,请指导,非常感谢

UnicodeDecodeError: 'gbk' codec can't decode byte 0xaf in position...

env:
python 3.7.1
web.py==0.40.dev0

problem:
return Template(open(path).read(), filename=path, **self._keywords)
UnicodeDecodeError: 'gbk' codec can't decode byte 0xaf in position 410: illegal multibyte sequence

temporary solution

open the file lib\site-packages\web\template.py

old: return Template(open(path).read(), filename=path, **self._keywords)
new: return Template(open(path,encoding='utf-8').read(), filename=path, **self._keywords)

OpenCV报Inconsistent shape for ConcatLayer in function 使用的是身份证正面图片

223.73.120.86:30801 - - [14/Oct/2019 11:43:45] "HTTP/1.1 POST /text" - 500 Internal Server Error
Traceback (most recent call last):
  File "/opt/miniconda3/envs/darknet-ocr/lib/python3.6/site-packages/web/application.py", line 257, in process
    return self.handle()
  File "/opt/miniconda3/envs/darknet-ocr/lib/python3.6/site-packages/web/application.py", line 248, in handle
    return self._delegate(fn, self.fvars, args)
  File "/opt/miniconda3/envs/darknet-ocr/lib/python3.6/site-packages/web/application.py", line 488, in _delegate
    return handle_class(cls)
  File "/opt/miniconda3/envs/darknet-ocr/lib/python3.6/site-packages/web/application.py", line 466, in handle_class
    return tocall(*args)
  File "app.py", line 83, in POST
    res = job(uuid,url,imgString,iscut,isclass,billModel,ip)
  File "app.py", line 34, in job
    boxes,scores = detect_lines(image,scale=scale,maxScale=maxScale)
  File "/opt/darknet-ocr/dnn/text.py", line 48, in detect_lines
    scores,boxes,rate,w,h = detect_box(image,scale,maxScale)
  File "/opt/darknet-ocr/dnn/text.py", line 22, in detect_box
    out  = textNet.forward(outputName)[0]
cv2.error: OpenCV(4.0.0) /io/opencv/modules/dnn/src/layers/concat_layer.cpp:95: error: (-201:Incorrect size of input array) Inconsistent shape for ConcatLayer in function 'getMemoryShapes'

环境:
ubuntu 16.04 amd64

exec app.py error

Traceback (most recent call last):
File "app.py", line 14, in
from dnn.text import detect_lines
File "/home/wanghe/darknet-ocr/dnn/text.py", line 13, in
from dnn.darknet import load_net,predict_image,array_to_image
File "/home/wanghe/darknet-ocr/dnn/darknet.py", line 112, in
predict_image =lib.network_predict_image_vgg
File "/usr/lib64/python3.6/ctypes/init.py", line 356, in getattr
func = self.getitem(name)
File "/usr/lib64/python3.6/ctypes/init.py", line 361, in getitem
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: ../darknet/libdarknet.so: undefined symbol: network_predict_image_vgg

this is my error,i git clone darknet and make it,then exec /bin/python3 app.py 8080
i make the darknet-ocr,but it does not work,prompt make: *** There are no rules to create the target "obj" required by "all". stop

make出错

看到更新了ocr识别的模型,马上拿来用一下,自己是windows10的系统,也没有gpu,但是在编译的时候出错了,我电脑上装的MinGW来make的,请问windows系统应该怎么编译呢 是不是要改一下makefile文件,谢谢哈,或者是否可以将build好的library也直接传上来下载后直接用呢
E:\pycharm_workspace\darknet-ocr-master\darknet>make
make: *** No rule to make target 'obj', needed by 'all'. Stop.

ocr.cfg

作者你好,想问一下ocr.cfg该如何使用呢,训练数据是怎样标注的?

不管什么图片,都提示异常

127.0.0.1:48050 - - [14/Jan/2020 18:12:47] "HTTP/1.1 POST /text" - 500 Internal Server Error
Traceback (most recent call last):
File "/home/ubuntu/.local/lib/python3.5/site-packages/web/application.py", line 289, in process
return self.handle()
File "/home/ubuntu/.local/lib/python3.5/site-packages/web/application.py", line 280, in handle
return self._delegate(fn, self.fvars, args)
File "/home/ubuntu/.local/lib/python3.5/site-packages/web/application.py", line 530, in _delegate
return handle_class(cls)
File "/home/ubuntu/.local/lib/python3.5/site-packages/web/application.py", line 508, in handle_class
return tocall(*args)
File "app.py", line 66, in POST
data = json.loads(data)
File "/usr/lib/python3.5/json/init.py", line 312, in loads
s.class.name))
TypeError: the JSON object must be str, not 'bytes'

127.0.0.1:48236 - - [14/Jan/2020 18:13:35] "HTTP/1.1 POST /text" - 500 Internal Server Error

GPU版本未识别到文字

采用cpu 识别结果正常,采用gpu则没有识别到。无异常log输出。环境为多卡gtx1080ti GPU,ubuntu16

提示:识别异常

Windows10, Python 3.5.2 直接上传本地图片 /test/orc.jpeg
提示:识别异常
cmd窗口 log 如下:

python app.py 8080
http://0.0.0.0:8080/
127.0.0.1:58197 - - [13/Oct/2019 21:18:50] "HTTP/1.1 GET /text" - 200 OK
127.0.0.1:58200 - - [13/Oct/2019 21:18:50] "HTTP/1.1 GET /static/css/main.css" - 304 Not Modified
127.0.0.1:58198 - - [13/Oct/2019 21:18:50] "HTTP/1.1 GET /static/js/jquery.js" - 304 Not Modified
127.0.0.1:58199 - - [13/Oct/2019 21:18:50] "HTTP/1.1 GET /static/js/helps.js" - 304 Not Modified
127.0.0.1:58197 - - [13/Oct/2019 21:18:50] "HTTP/1.1 GET /static/img/loading.gif" - 304 Not Modified
Traceback (most recent call last):
File "C:\Users\admin\AppData\Local\Programs\Python\Python35\lib\site-packages\web.py-0.40-py3.5.egg\web\application.py", line 289, in process
return self.handle()
File "C:\Users\admin\AppData\Local\Programs\Python\Python35\lib\site-packages\web.py-0.40-py3.5.egg\web\application.py", line 280, in handle
return self._delegate(fn, self.fvars, args)
File "C:\Users\admin\AppData\Local\Programs\Python\Python35\lib\site-packages\web.py-0.40-py3.5.egg\web\application.py", line 530, in delegate
return handle_class(cls)
File "C:\Users\admin\AppData\Local\Programs\Python\Python35\lib\site-packages\web.py-0.40-py3.5.egg\web\application.py", line 508, in handle_class
return tocall(*args)
File "app.py", line 73, in POST
data = json.loads(data)
File "C:\Users\admin\AppData\Local\Programs\Python\Python35\lib\json_init
.py", line 312, in loads
s.class.name))
TypeError: the JSON object must be str, not 'bytes'

127.0.0.1:58197 - - [13/Oct/2019 21:19:00] "HTTP/1.1 POST /text" - 500 Internal Server Error

win10下关于ocr问题

win10下CPU模式,python3.6.5,已编译cpu版makefile

请问CPU模式下,config.py设置GPU为False,是否需要修改ocr.py第19行 if 1: 为 if gpu: ???

若不修改,调用predict_darknet 和 predict_cpu均无任何输出,无报错信息,程序就直接结束
image

若修改,输出结果均为乱码,如下图。
image

浏览器兼容性太差

IE, Chrome,Firefox 都无法正常显示,也无法识别图片,自带的一些图片也无法识别。
上传图片,点击识别,提示异常
1

请及时看看问题

想问下,返回的boxes坐标是什么顺序呢?

array([[ 69.375 , 70.10526316, 244.63815789, 68.64473684,
244.63815789, 101.50657895, 69.375 , 102.23684211],
[ 69.375 , 163.57894737, 361.48026316, 164.30921053,
361.48026316, 198.63157895, 69.375 , 197.90131579],
[ 57.69078947, 341.03289474, 595.16447368, 342.49342105,
595.16447368, 378.27631579, 57.69078947, 376.81578947],
[361.48026316, 249.75 , 384.84868421, 249.75 ,
384.84868421, 274.57894737, 361.48026316, 274.57894737],
[ 57.69078947, 213.96710526, 420.63157895, 221.26973684,
419.90131579, 254.86184211, 56.96052632, 247.55921053],
[ 45.27631579, 119.76315789, 314.74342105, 116.11184211,
315.47368421, 148.97368421, 46.00657895, 152.625 ],
[116.11184211, 248.28947368, 303.78947368, 252.67105263,
303.05921053, 284.07236842, 115.38157895, 280.42105263]])

这个坐标顺序是什么呢?

报错Unknown error 47391493

Ubuntu 16.04
python3.7
无GPU,编译好了darknet,config也设置了darkRoot
测试运行dnn/ocr.py 报错Unknown error 47391493
定位错误是在dnn/ocr.py 23行 ocrNet = load_net(ocrPath.replace('.weights','.cfg').encode(),ocrPath.encode(), 0)

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.