## Installation ### Requirements - Linux or macOS with Python ≥ 3.6 - PyTorch ≥ 1.8 and [torchvision](https://github.com/pytorch/vision/) that matches the PyTorch installation. Install them together at [pytorch.org](https://pytorch.org) to make sure of this - OpenCV is optional but needed by demo and visualization ### Build Detectron2 from Source gcc & g++ ≥ 5.4 are required. [ninja](https://ninja-build.org/) is optional but recommended for faster build. After having them, run: ``` python -m pip install 'git+https://github.com/facebookresearch/detectron2.git' # (add --user if you don't have permission) # Or, to install it from a local clone: git clone https://github.com/facebookresearch/detectron2.git python -m pip install -e detectron2 # On macOS, you may need to prepend the above commands with a few environment variables: CC=clang CXX=clang++ ARCHFLAGS="-arch x86_64" python -m pip install ... ``` To __rebuild__ detectron2 that's built from a local clone, use `rm -rf build/ **/*.so` to clean the old build first. You often need to rebuild detectron2 after reinstalling PyTorch. ### Install Pre-Built Detectron2 (Linux only) Choose from this table to install [v0.6 (Oct 2021)](https://github.com/facebookresearch/detectron2/releases):
CUDA | torch 1.10 | torch 1.9 | torch 1.8 |
---|---|---|---|
11.3 | install | ||
11.1 | install | install | install |
10.2 | install | install | install |
10.1 | install | ||
cpu | install | install | install |