Search code examples
pytorchcomputer-visionobject-detectiondetectron

Detectron2 Installation based on pytorch and cuda versions


I am fairly new to Object Detection and I'm trying to install Detectron2 on colab. My Pytorch version is 1.12 whereas Cuda version is 11.2. I referred the website https://detectron2.readthedocs.io/en/latest/tutorials/install.html to find the most appropriate installation command but I can't understand which one to go for since neither the pytorch version nor the Cuda version is available there.


Solution

  • This is how they install detectron2 in the official colab tutorial:

    !python -m pip install pyyaml==5.1
    import sys, os, distutils.core
    # Note: This is a faster way to install detectron2 in Colab, 
    but it does not include all functionalities.
    # See https://detectron2.readthedocs.io/tutorials/install.html 
    for full installation instructions
    !git clone 'https://github.com/facebookresearch/detectron2'
    dist = distutils.core.run_setup("./detectron2/setup.py")
    !python -m pip install {' '.join([f"'{x}'" for x in dist.install_requires])}
    sys.path.insert(0, os.path.abspath('./detectron2'))
    
    # Properly install detectron2. (Please do not install twice in both ways)
    # !python -m pip install 'git+https://github.com/facebookresearch/detectron2.git'
    

    You can find the whole notebook here: https://colab.research.google.com/drive/16jcaJoc6bCFAQ96jDe2HwtXj7BMD_-m5#scrollTo=FsePPpwZSmqt