Explorar el Código

[Docker] Add Dockerfile (#89)

* [Dockerfile] Init

* [Docker] Update

* [Docker] Update

* [Docker] Update gdal link

* [Docs] Add note about docker image

* [Docker] Add tag selected
Yizhou Chen hace 2 años
padre
commit
241cfa73b1
Se han modificado 2 ficheros con 53 adiciones y 0 borrados
  1. 28 0
      Dockerfile
  2. 25 0
      tutorials/train/README.md

+ 28 - 0
Dockerfile

@@ -0,0 +1,28 @@
+# 0. set args
+ARG PPTAG=2.4.1  # tags refers to https://hub.docker.com/r/paddlepaddle/paddle/tags
+
+# 1. pull base image
+FROM paddlepaddle/paddle:${PPTAG}
+
+# 2. install GDAL
+RUN wget https://paddlers.bj.bcebos.com/dependencies/gdal/GDAL-3.4.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl \
+	&& pip install GDAL-3.4.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl \
+	&& rm -rf GDAL-3.4.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
+
+# 3. clone paddlers
+WORKDIR /opt
+RUN git clone https://github.com/PaddlePaddle/PaddleRS.git \
+	&& chmod 777 -R /opt/PaddleRS/examples
+ENV PYTHONPATH /opt/PaddleRS
+
+# 4. install requirements
+WORKDIR /opt/PaddleRS
+RUN pip install -r /opt/PaddleRS/requirements.txt -i https://mirror.baidu.com/pypi/simple
+
+# 5. install pydensecrf
+WORKDIR /usr/src
+RUN pip install git+https://github.com/lucasb-eyer/pydensecrf.git \
+	&& rm -rf /usr/src/pydensecrf
+
+# 6. finish
+WORKDIR /opt/PaddleRS

+ 25 - 0
tutorials/train/README.md

@@ -73,6 +73,31 @@ Windows用户可以在[此站点](https://www.lfd.uci.edu/~gohlke/pythonlibs/#gd
 pip install GDAL‑3.3.3‑cp39‑cp39‑win_amd64.whl
 ```
 
+### *Docker安装
+
+1. 从dockerhub拉取:
+
+```shell
+docker pull paddlepaddle/paddlers:1.0.0  # 暂无
+```
+
+- (可选)从头开始构建,可以通过设置`PPTAG`选择PaddlePaddle的多种基础镜像,构建CPU或不同GPU环境:
+
+```shell
+git clone https://github.com/PaddlePaddle/PaddleRS
+cd PaddleRS
+docker build -t <imageName> .  # 默认为2.4.1的cpu版本
+# docker build -t <imageName> . --build-arg PPTAG=2.4.1-gpu-cuda10.2-cudnn7.6-trt7.0  # 2.4.1的gpu版本之一
+# 其余Tag可以参考:https://hub.docker.com/r/paddlepaddle/paddle/tags
+```
+
+2. 启动镜像
+
+```shell
+docker iamges  # 查看镜像的ID
+docker run -it <imageID>
+```
+
 ## 开始训练
 
 + 在安装完成PaddleRS后,使用如下命令执行单卡训练。脚本将自动下载训练数据。以DeepLab V3+图像分割模型为例: