alphapose-docker/Dockerfile
2023-01-19 10:49:43 +01:00

69 lines
2.2 KiB
Docker

# thanks to Paul DeCoursey (optimuspaul@github.com) for inspiration
# see: https://github.com/MVIG-SJTU/AlphaPose/issues/1057
#FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04
#FROM nvidia/cuda:11.6.0-cudnn8-devel-ubuntu22.04
FROM nvidia/cuda:11.6.0-devel-ubuntu20.04
RUN apt clean
RUN DEBIAN_FRONTEND=noninteractive apt update && DEBIAN_FRONTEND=noninteractive apt install -y --allow-change-held-packages \
ffmpeg \
git \
build-essential \
ninja-build \
cuda-libraries-11-6 \
mesa-common-dev \
libosmesa6 libosmesa6-dev \
libgles2-mesa-dev \
libglu1-mesa-dev \
libgles2-mesa-dev \
libcublas-11-6 \
libcublas-dev-11-6 \
libcusparse-dev-11-6 \
cuda-nvcc-11-6 \
libcusolver-dev-11-6 \
cuda-nvrtc-dev-11-6 \
libcurand-dev-11-6 \
cuda-nvml-dev-11-6 \
libcufft-dev-11-6 \
cuda-toolkit-11-6 \
nvidia-cuda-toolkit \
libyaml-dev
ENV CUDA_HOME='/usr/local/cuda'
RUN DEBIAN_FRONTEND=noninteractive apt -y install python3 python3-pip
RUN pip install "torch==1.12.1+cu116" "torchvision==0.13.1+cu116" "torchaudio==0.12.1" --extra-index-url https://download.pytorch.org/whl/cu116
RUN pip install opencv-contrib-python-headless
RUN pip install pip --upgrade
RUN pip install cython pycocotools
RUN python3 -c "import torch; print(torch.version.cuda)"
RUN mkdir /build
RUN cd /build && git clone https://github.com/HaoyiZhu/HalpeCOCOAPI.git
RUN cd /build && git clone https://github.com/WildflowerSchools/AlphaPose.git
RUN cd /build/HalpeCOCOAPI/PythonAPI && python3 setup.py build develop --user
WORKDIR /build/AlphaPose
RUN TORCH_CUDA_ARCH_LIST="6.1;7.5;8.6" python3 setup.py build develop --user
RUN apt install bc -y && \
pip install boto3 && \
python3 -c "import torchvision.models as tm; tm.resnet152(pretrained=True)"
RUN pip install "cython_bbox==0.1.3"
# TODO: when working, move this dependency up
RUN pip install "numpy==1.22.4"
RUN apt install -y python3-tk
# Resnet 50 is needed for some of the AlphaPose models
# TODO: alternatively make this a build param/tag for resnet50/152
# see: https://stackoverflow.com/questions/33935807/how-to-define-a-variable-in-a-dockerfile#37639938
RUN python3 -c "import torchvision.models as tm; tm.resnet50(pretrained=True)"