Dockerfile for Alphapose
This commit is contained in:
commit
fa5871bae9
6 changed files with 106 additions and 0 deletions
1
.dockerignore
Normal file
1
.dockerignore
Normal file
|
@ -0,0 +1 @@
|
||||||
|
*
|
69
Dockerfile
Normal file
69
Dockerfile
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
# 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)"
|
||||||
|
|
24
README.md
Normal file
24
README.md
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
# AlphaPose Docker
|
||||||
|
|
||||||
|
Create a docker image for [AlphaPose](http://mvig.org/research/alphapose.html) ([code at GitHub](https://github.com/MVIG-SJTU/AlphaPose)).
|
||||||
|
|
||||||
|
## Building the image
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker build --tag alphapose .
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Before the repository can be used, it is necessary to download the required auxilary models, as per [the AlphaPose installation guide](https://github.com/MVIG-SJTU/AlphaPose/blob/master/docs/INSTALL.md#models).
|
||||||
|
|
||||||
|
1. YOLOv3 Object detector can be place in the `detector/yolo/data` repository.
|
||||||
|
2. (Optionally) YOLOX models go in the `detector/yolox/data` repository.
|
||||||
|
3. A pretrained AlphaPose model can be place in the `pretrained_models` directory. See their [Model Zoo](https://github.com/MVIG-SJTU/AlphaPose/blob/master/docs/MODEL_ZOO.md) for the various options.
|
||||||
|
4. For pose tracking, see the [pose tracking module](https://github.com/MVIG-SJTU/AlphaPose/tree/master/trackers). Make sure to add the necessary folder as a volume to the `docker run` command.
|
||||||
|
|
||||||
|
### Running
|
||||||
|
|
||||||
|
```
|
||||||
|
docker run --rm --gpus all -v `pwd`/out:/out -v `pwd`/detector/yolox/data:/build/AlphaPose/detector/yolox/data -v `pwd`/detector/yolo/data:/build/AlphaPose/detector/yolo/data -v `pwd`/pretrained_models:/build/AlphaPose/pretrained_models alphapose python3 scripts/demo_inference.py --cfg configs/coco/resnet/256x192_res50_lr1e-3_1x.yaml --checkpoint pretrained_models/fast_res50_256x192.pth --gpus 0 --indir examples/demo/ --save_img --vis_fast --outdir /out
|
||||||
|
```
|
4
detector/yolo/data/.gitignore
vendored
Normal file
4
detector/yolo/data/.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# Ignore everything in this directory
|
||||||
|
*
|
||||||
|
# Except this file
|
||||||
|
!.gitignore
|
4
detector/yolox/data/.gitignore
vendored
Normal file
4
detector/yolox/data/.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# Ignore everything in this directory
|
||||||
|
*
|
||||||
|
# Except this file
|
||||||
|
!.gitignore
|
4
pretrained_models/.gitignore
vendored
Normal file
4
pretrained_models/.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# Ignore everything in this directory
|
||||||
|
*
|
||||||
|
# Except this file
|
||||||
|
!.gitignore
|
Loading…
Reference in a new issue