Skip to content

Commit

Permalink
新增docker镜像构建
Browse files Browse the repository at this point in the history
  • Loading branch information
wenlihaoyu committed May 6, 2019
1 parent 2da42b1 commit 30e4bea
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 21 deletions.
33 changes: 17 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
# Python support can be specified down to the minor or micro version
# (e.g. 3.6 or 3.6.3).
# OS Support also exists for jessie & stretch (slim and full).
# See https://hub.docker.com/r/library/python/ for all supported Python
# tags from Docker Hub.
FROM floydhub/pytorch:0.2.0-py3.15
LABEL Name=chineseocr Version=0.0.1
FROM ubuntu
MAINTAINER https://github.com/chineseocr/chineseocr
LABEL version="1.0"
EXPOSE 8080

WORKDIR /app
ADD . /app
RUN cd detector/utils && sh make-for-cpu.sh
RUN git submodule init && git submodule update
RUN cd darknet/ && make && cp libdarknet.so ..
VOLUME /app/models
RUN pip install -r requirements.txt --no-cache-dir
CMD ["python3", "app.py"]
RUN apt-get update
RUN apt-get install libsm6 libxrender1 libxext-dev gcc -y
##下载Anaconda3 python 环境安装包 放置在chineseocr目录 url地址https://repo.anaconda.com/archive/Anaconda3-2019.03-Linux-x86_64.sh
WORKDIR /chineseocr
ADD . /chineseocr
RUN cd /chineseocr && sh -c '/bin/echo -e "\nyes\n\nyes" | sh Anaconda3-2019.03-Linux-x86_64.sh'
RUN echo -e "\ny" | /root/anaconda3/bin/conda install python=3.6
RUN /root/anaconda3/bin/pip install easydict opencv-contrib-python==3.4.2.16 Cython h5py pandas requests bs4 matplotlib lxml -U pillow keras==2.1.5 tensorflow==1.8 -i https://pypi.tuna.tsinghua.edu.cn/simple/
RUN /root/anaconda3/bin/pip install web.py==0.40.dev0
RUN echo -e "\ny" | /root/anaconda3/bin/conda install pytorch-cpu torchvision-cpu -c pytorch
RUN rm Anaconda3-2019.03-Linux-x86_64.sh
#RUN cd /chineseocr/text/detector/utils && sh make-for-cpu.sh
#RUN conda clean -p
#RUN conda clean -t
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,24 @@ cd chineseocr## 进入chineseocr目录
ipython app.py 8080 ##8080端口号,可以设置任意端口
```

## 构建docker镜像
``` Bash
##下载Anaconda3 python 环境安装包(https://repo.anaconda.com/archive/Anaconda3-2019.03-Linux-x86_64.sh) 放置在chineseocr目录下
##建立镜像
docker build -t chineseocr .
##启动服务
docker run -d -p 8080:8080 chineseocr /root/anaconda3/bin/python app.py

```


## 识别结果展示

<img width="500" height="300" src="https://github.com/chineseocr/chineseocr/blob/master/test/train-demo.png"/>
<img width="500" height="300" src="https://github.com/chineseocr/chineseocr/blob/master/test/idcard-demo.png"/>
<img width="500" height="300" src="https://github.com/chineseocr/chineseocr/blob/master/test/img-demo.png"/>
<img width="500" height="300" src="https://github.com/chineseocr/chineseocr/blob/master/test/line-demo.png"/>

## Play with Docker Container(镜像有些滞后)
``` Bash
docker pull zergmk2/chineseocr
docker run -d -p 8080:8080 zergmk2/chineseocr
```

## 访问服务
http://127.0.0.1:8080/ocr
Expand Down
6 changes: 6 additions & 0 deletions docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
##拉取基础镜像
docker build -t chineseocr .
##启动服务
docker run -d -p 8080:8080 chineseocr /root/anaconda3/bin/python app.py


0 comments on commit 30e4bea

Please sign in to comment.