Skip to content

Instantly share code, notes, and snippets.

@lobrien
Created June 18, 2021 02:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lobrien/36aa7e973aedbfc58fdd02030099f2dc to your computer and use it in GitHub Desktop.
Save lobrien/36aa7e973aedbfc58fdd02030099f2dc to your computer and use it in GitHub Desktop.
Detectron2 CPU-Only Torch 1.7 Dockerfile
# Update of the Dockerfile at https://towardsdatascience.com/detectron2-the-basic-end-to-end-tutorial-5ac90e2f90e3
FROM python:3.8-slim-buster
RUN apt-get update -y
# gcc compiler and opencv prerequisites
RUN apt-get -y install nano git build-essential libglib2.0-0 libsm6 libxext6 libxrender-dev
RUN apt-get install -y python3-opencv
# Detectron2 prerequisites
RUN pip install torch==1.7.0+cpu torchvision==0.8.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
RUN pip install cython
RUN pip install -U 'git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI'
# Detectron2 - CPU copy
RUN python -m pip install detectron2 -f \
https://dl.fbaipublicfiles.com/detectron2/wheels/cpu/torch1.7/index.html
# Development packages
RUN pip install flask flask-cors requests opencv-python
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment