Installing Detectron2 on Windows
To install Detectron2 on Windows, follow the given steps:
- Install Anaconda: You can download the latest version of Anaconda from the official website and follow the installation instructions for Windows.
- Create a new conda environment:
conda create --name detectron2 python=3.7 -y
This will create a new conda environment named “detectron2” with Python 3.7.
- Activate the environment:
conda activate detectron2
Make sure you activate the newly created conda environment before proceeding with the next steps.
- Install PyTorch:
conda install pytorch torchvision cudatoolkit=10.2 -c pytorch -y
This will install PyTorch with the necessary dependencies.
- Install GCC:
Detectron2 requires GCC to be installed. Download the latest installer from the official MinGW-w64 website (https://mingw-w64.org/doku.php/download) and follow the instructions to install GCC.
- Install Visual C++:
Download and install the Visual C++ Build Tools from the official Microsoft website (https://visualstudio.microsoft.com/visual-cpp-build-tools/).
- Install Detectron2:
pip install detectron2 -f https://dl.fbaipublicfiles.com/detectron2/wheels/cpu/index.html
Note: If you have a GPU, you can use the GPU version of Detectron2 by installing the appropriate CUDA and cuDNN libraries and by using the GPU wheel instead of the CPU wheel.
With the above steps, you should have Detectron2 installed on your Windows machine. Remember to always activate the “detectron2” conda environment before using Detectron2 in your projects.