Skip to content

Commit

Permalink
add
Browse files Browse the repository at this point in the history
  • Loading branch information
DayBreak-u committed Jul 30, 2020
1 parent f32a927 commit ba4ccef
Show file tree
Hide file tree
Showing 27 changed files with 27 additions and 229 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ __pycache__/
# Distribution / packaging
.Python
build/
.idea/
develop-eggs/
downloads/
eggs/
Expand Down
1 change: 1 addition & 0 deletions .idea/chineseocr_lite_new.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 2 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,9 @@ RUN pip3 install --user -U pip -i https://pypi.tuna.tsinghua.edu.cn/simple/ \
&& pip3 config set global.index-url https://mirrors.aliyun.com/pypi/simple/


RUN source ~/.bash_profile && pip3 install -r requirements.txt \
&& pip3 install ./resource/torch-1.2.0+cpu-cp36-cp36m-manylinux1_x86_64.whl \
&& pip3 install ./resource/torchvision-0.4.0+cpu-cp36-cp36m-manylinux1_x86_64.whl

RUN source ~/.bash_profile && cd ./psenet/pse && make clean && make
RUN yum clean all && \
rm -rf /tmp/* && \
rm -rf /data/project/resource
RUN source ~/.bash_profile && pip3 install -r requirements.txt

EXPOSE 5000
EXPOSE 8000

CMD python3 flask_app.py
CMD python3 backend/main.py
119 changes: 0 additions & 119 deletions app.py

This file was deleted.

5 changes: 1 addition & 4 deletions backend/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
#!/usr/bin/env python
# encoding: utf-8
# author:alisen
# time: 2020/4/28 14:54


Binary file removed backend/dist/TrWebOcr_fontend/favicon.ico
Binary file not shown.
1 change: 0 additions & 1 deletion backend/dist/TrWebOcr_fontend/index.html

This file was deleted.

1 change: 1 addition & 0 deletions backend/dist/chineseocr_lite_fontend/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!DOCTYPE html><html lang=zh-hans><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=/favicon.ico><title>chineseocr_lite-开源的离线ocr</title><link href=/css/app.77d50329.css rel=preload as=style><link href=/css/chunk-vendors.9d96bc97.css rel=preload as=style><link href=/js/app.7dd3e457.js rel=preload as=script><link href=/js/chunk-vendors.ae13d15d.js rel=preload as=script><link href=/css/chunk-vendors.9d96bc97.css rel=stylesheet><link href=/css/app.77d50329.css rel=stylesheet></head><body><noscript><strong>We're sorry but fontend doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/js/chunk-vendors.ae13d15d.js></script><script src=/js/app.7dd3e457.js></script></body></html>

Large diffs are not rendered by default.

Large diffs are not rendered by default.

9 changes: 3 additions & 6 deletions backend/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#!/usr/bin/env python
# encoding: utf-8
# author:alisen
# time: 2020/4/28 14:54

import os
import sys

Expand All @@ -22,7 +19,7 @@
current_path = os.path.dirname(__file__)
settings = dict(
# debug=True,
static_path=os.path.join(current_path, "dist/TrWebOcr_fontend") # 配置静态文件路径
static_path=os.path.join(current_path, "dist/chineseocr_lite_fontend") # 配置静态文件路径
)


Expand All @@ -31,7 +28,7 @@ def make_app():
(r"/api/tr-run/", tr_run.TrRun),
(r"/", tr_index.Index),
(r"/(.*)", StaticFileHandler,
{"path": os.path.join(current_path, "dist/TrWebOcr_fontend"), "default_filename": "index.html"}),
{"path": os.path.join(current_path, "dist/chineseocr_lite_fontend"), "default_filename": "index.html"}),

], **settings)

Expand Down
5 changes: 1 addition & 4 deletions backend/np_encoder.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#!/usr/bin/env python
# encoding: utf-8
# author:alisen
# time: 2020/4/29 14:56


import json
import numpy as np
Expand Down
4 changes: 0 additions & 4 deletions backend/tools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
#!/usr/bin/env python
# encoding: utf-8
# author:alisen
# time: 2020/5/11 21:58

5 changes: 1 addition & 4 deletions backend/tools/get_host_ip.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#!/usr/bin/env python
# encoding: utf-8
# author:alisen
# time: 2020/5/11 22:21


import socket

Expand Down
5 changes: 1 addition & 4 deletions backend/tools/log.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#!/usr/bin/env python
# encoding: utf-8
# author:alisen
# time: 2020/5/29 10:48


import logging
from logging.handlers import RotatingFileHandler
Expand Down
5 changes: 1 addition & 4 deletions backend/tools/np_encoder.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#!/usr/bin/env python
# encoding: utf-8
# author:alisen
# time: 2020/4/29 14:56


import json
import numpy as np
Expand Down
7 changes: 2 additions & 5 deletions backend/webInterface/tr_index.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#!/usr/bin/env python
# encoding: utf-8
# author:alisen
# time: 2020/4/29 10:56


import tornado.web
import tornado.gen
Expand All @@ -15,4 +12,4 @@ class Index(tornado.web.RequestHandler):

@tornado.gen.coroutine
def get(self, *args, **kwargs):
self.render(os.path.join(BASE_PATH, 'dist/TrWebOcr_fontend/index.html'))
self.render(os.path.join(BASE_PATH, 'dist/chineseocr_lite_fontend/index.html'))
5 changes: 1 addition & 4 deletions backend/webInterface/tr_run.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#!/usr/bin/env python
# encoding: utf-8
# author:alisen
# time: 2020/4/29 10:47


import time
from model import text_predict
Expand Down
4 changes: 2 additions & 2 deletions dbnet/decode.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


class SegDetectorRepresenter:
def __init__(self, thresh=0.3, box_thresh=0.5, max_candidates=1000, unclip_ratio=1.8):
def __init__(self, thresh=0.3, box_thresh=0.5, max_candidates=1000, unclip_ratio=2.0):
self.min_size = 3
self.thresh = thresh
self.box_thresh = box_thresh
Expand All @@ -26,7 +26,7 @@ def __call__(self, pred, height, width):
thresh: [if exists] thresh hold prediction with shape (N, H, W)
thresh_binary: [if exists] binarized with threshhold, (N, H, W)
"""

pred = pred[0, :, :]
segmentation = self.binarize(pred)

Expand Down
46 changes: 0 additions & 46 deletions flask_app.py

This file was deleted.

Binary file modified models/crnn_lite_lstm.onnx
Binary file not shown.
Binary file modified models/dbnet.onnx
Binary file not shown.
18 changes: 7 additions & 11 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
scipy
numpy
opencv-python
Cython
pillow
web.py==0.40.dev0
onnxruntime
pyclipper
shapely
flask
flask-restful
tornado==5.1.1
numpy==1.19.1
opencv_python==4.3.0.36
onnxruntime==1.4.0
Shapely==1.7.0
pyclipper==1.2.0
Pillow==7.2.0

0 comments on commit ba4ccef

Please sign in to comment.