README.md 1.7 KB
Newer Older
L
lywen 已提交
1 2 3 4 5 6 7
## 本项目基于[yolo3](https://github.com/pjreddie/darknet.git) 与[crnn](https://github.com/meijieru/crnn.pytorch.git)  实现中文自然场景文字检测及识别

## 环境部署
python=3.6 pytorch=0.2.0
``` Bash
git clone https://github.com/chineseocr/chineseocr.git
cd chineseocr
L
lywen 已提交
8
sh setup.sh #(cpu sh setpu-cpu.sh)
L
lywen 已提交
9 10 11
```

## 下载模型文件   
L
Lu Cao 已提交
12 13 14
模型文件地址:
* [baidu pan](https://pan.baidu.com/s/1dEopm8VkFLuDDfVkpuzHqQ)
* [google drive](https://drive.google.com/drive/folders/1vlA6FjvicTt5GKvAfmycP5AlYxm4i9ze?usp=sharing)
L
lywen 已提交
15

L
Lu Cao 已提交
16 17
复制文件夹中的 ocr.pth, text.cfg, text.names, text.weights 到models目录

18 19 20
或者可将yolo3模型转换为keras版本,详细参考https://github.com/qqwweee/keras-yolo3.git    

或者直接运用opencv>=3.4  dnn直接调用darknet模型(参考 opencv_dnn_detect.py),cpu文本检测小于1秒。   
L
lywen 已提交
21

L
Lu Cao 已提交
22
## web服务启动
L
lywen 已提交
23 24 25 26 27 28
``` Bash
cd chineseocr## 进入chineseocr目录
ipython app.py 8080 ##8080端口号,可以设置任意端口
```

## 识别结果展示
L
lywen 已提交
29 30 31

<img width="500" height="300" src="https://github.com/chineseocr/chineseocr/blob/master/test/img1.png"/>
<img width="500" height="300" src="https://github.com/chineseocr/chineseocr/blob/master/test/4.png"/>
L
lywen 已提交
32

L
Lu Cao 已提交
33 34 35 36 37 38
## Play with Docker Container
``` Bash
docker pull zergmk2/chineseocr
docker run -d -p 8080:8080 zergmk2/chineseocr
```

L
lywen 已提交
39 40 41
## 访问服务
http://127.0.0.1:8080/ocr

L
lywen 已提交
42
<img width="500" height="300" src="https://github.com/chineseocr/chineseocr/blob/master/test/demo.png"/>
L
lywen 已提交
43 44 45 46 47 48 49 50


## 参考
1. yolo3 https://github.com/pjreddie/darknet.git   
2. crnn  https://github.com/meijieru/crnn.pytorch.git              
3. ctpn  https://github.com/eragonruan/text-detection-ctpn    
4. CTPN  https://github.com/tianzhi0549/CTPN