도커를 통한 시선 예측

아래 github의 경우 시선을 예측하는 환경이 구축되어 있다. 비교적 친절하게 환경 구축 방법을 제시하였는데 Ubuntu 16.04와 Conda를 통해 설치가 가능하다고 한다.

이에 따라 해당 환경을 구축하여 실행해보고자 한다.

먼저 아래와 같이 도커파일을 작성하자.

FROM ubuntu:16.04

# Install Dependencies of gaze estimation [https://github.com/david-wb/gaze-estimation]
RUN apt-get update -y
RUN apt-get install build-essential cmake pkg-config  libx11-dev libatlas-base-dev  libgtk-3-dev libboost-python-dev curl vim git wget libgl1-mesa-glx  -y

ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
ENV PATH /opt/conda/bin:$PATH

# Install Dependencies of Miniconda
RUN apt-get update --fix-missing && \
    apt-get install -y wget bzip2 curl git && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

# Install miniconda3
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \
    /bin/bash ~/miniconda.sh -b -p /opt/conda && \
    rm ~/miniconda.sh && \
    /opt/conda/bin/conda clean -tipsy && \
    ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \
    echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc && \
    echo "conda activate ge-linux" >> ~/.bashrc

RUN git clone https://github.com/david-wb/gaze-estimation.git
RUN cd gaze-estimation
RUN conda env create -f /gaze-estimation/env-linux.yml

RUN /gaze-estimation/scripts/fetch_models.sh
#RUN /bin/bash -c "source activate my_env && pip install torch" 
#docker build  --no-cache . -f my_dockerfile.Dockerfile -t gaze 
#ENTRYPOINT [ "/gaze-estimation", "--" ]
CMD [ "/bin/bash" ]

작성한 도커파일을 아래의 명령어로 실행하게 되면 간단히 환경구축은 끝이난다.

docker build . -f my_dockerfile.Dockerfile -t gaze
GitHub - david-wb/gaze-estimation: A deep learning based gaze estimation framework implemented with PyTorch
A deep learning based gaze estimation framework implemented with PyTorch - GitHub - david-wb/gaze-estimation: A deep learning based gaze estimation framework implemented with PyTorch


docker run -it d --runtime nvidia --network host --privileged -v /project/project/gaze-estimation/video:/video -e DISPLAY=$DISPLAY gaze