Facebook AI Research’s (FAIR) discovery of the Detectron2 which helps in object detection having Mask R-CNN is created in Python as a part of DL framework.


We will go through steps of installing Facebook detectron2 in ubuntu machine with GPUs attached. Follow below steps after logging in as a root

  1. Install Python > 3.6
    #add-apt-repository ppa:jonathonf/python-3.6
    #apt-get update
    #apt-get install python3.6
    Check python version with #python –v command
  2. Install tensorflow 1.14
    #pip install tensorflow==1.14
  3. Install PyTorch 1.3
    #pip install torch==1.4.0+cu92 torchvision==0.5.0+cu92 -f 
  4. Install CUDA 9.2 and cuBLAS patch
    In Ubuntu, Go to Softwares and updates 
    è Additional Drivers. Install 414 or 386 drivers of NVIDIA CUDA. Then you need to install CUDA dependancies
    #apt-get install freeglut3 freeglut3-dev libxi-dev libxmu-dev
    Go to CUDA Zone and download proper drivers (around 1.8 GB) and some patch (if any). Run the file with instructions displayed. Once you run the file, Say “NO” to    “Install NVIDIA Accelerated Graphics Driver for Linux” (Because we already did that in first paragraph)
  5. Setup the environment variables
    #vim /etc/profile.d/cuda.sh
    And add following lines
         export PATH=$PATH:/usr/local/cuda/bin

     export CUDADIR=/usr/local/cuda
Also create the file cuda.conf and add “sudo ldconfig”
#vim /etc/ld.so.conf.d/cuda.conf


  1. Install GCC > 4.9
    Install GCC by follwing commands
    #apt update
    #apt install build-essential
    #apt-get install manpages-dev
    Now you can check GCC version by #gcc –version
  2. Build detectron2 from source
    After having the above dependencies you can install detectron2 from source by running
    #pip install ‘git+https://github.com/facebookresearch/detectron2.git’