mmdetection docker安装

通过镜像环境安装mmdetection

遇到的问题:

1、没有cuda

解决:在环境中指定CUDA

2、GCC版本太低

解决:升级GCC到5.3版本

dockerfile 如下:

FROM repo.jd.local/public/das:pytorch1.1.0-py3-gpu

# 维护者信息, 或其它标签信息
LABEL maintainer=rengang@jd.com

# CUDA 环境
ENV FORCE_CUDA 1


RUN yum install -y tar
# RUN yum -y install centos-release-scl
# RUN yum -y install devtoolset-7-gcc devtoolset-7-gcc-c++ devtoolset-7-binutils
# RUN echo "source /opt/rh/devtoolset-7/enable" >>/etc/profile

# 升级GCC版本
RUN wget https://copr.fedoraproject.org/coprs/hhorak/devtoolset-4-rebuild-bootstrap/repo/epel-7/hhorak-devtoolset-4-rebuild-bootstrap-epel-7.repo -O /etc/yum.repos.d/devtoolset-4.repo
RUN yum install devtoolset-4-gcc devtoolset-4-gcc-c++ devtoolset-4-binutils -y
RUN echo "source /opt/rh/devtoolset-4/enable" >>/etc/profile

# RUN yum -y install centos-release-scl
# RUN yum -y install devtoolset-6-gcc devtoolset-6-gcc-c++ devtoolset-6-binutils
# RUN echo "source /opt/rh/devtoolset-6/enable" >>/etc/profile

# RUN wget https://ftp.gnu.org/gnu/gcc/gcc-5.2.0/gcc-5.2.0.tar.bz2 &&
#     tar -jxvf gcc-5.2.0.tar.bz2  && 

#     cd gcc-5.2.0 && 
#     ./contrib/download_prerequisites && 

#     mkdir gcc5.2 
#     cd gcc5.2 

#     make -j8 


#     make install 


# 2.a 通过pip安装软件包
RUN source activate base 
    && export PIP_CONFIG_FILE= 
    && pip install --no-cache-dir -i https://pypi.tuna.tsinghua.edu.cn/simple 
            imagecorruptions
            matplotlib
            # mmcv>=0.2.15
            mmcv
            numpy
            pycocotools
            six
            terminaltables

    && rm -rf ~/.cache/pip/*


# RUN git clone https://github.com/open-mmlab/mmcv.git 
#     && cd mmcv 
#     && pip install -e . 


# 从github上面拉取源码进行安装,以keras官方提供的方法为例
RUN git clone https://github.com/open-mmlab/mmdetection.git 
    && cd mmdetection 
    && source /etc/profile 
    && python setup.py develop 

  

原文地址:https://www.cnblogs.com/Allen-rg/p/12196952.html