how to make openCV use GPU on google colab
I'm trying to make OpenCV use GPU on google Colab but I can' find any good tutorial what I fond is a tutorial for Ubuntu I followed these steps
Step 1: Install NVIDIA CUDA drivers, CUDA Toolkit, and cuDNN "collab already have the drivers"
step 2: Install OpenCV and “dnn” GPU dependencies
! sudo apt-get update
! sudo apt-get upgrade
! sudo apt-get install build-essential cmake unzip pkg-config
! sudo apt-get install libjpeg-dev libpng-dev libtiff-dev
! sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev
! sudo apt-get install libv4l-dev libxvidcore-dev libx264-dev
! sudo apt-get install libgtk-3-dev
! sudo apt-get install libatlas-base-dev gfortran
! sudo apt-get install python3-dev
step 3: Download OpenCV source code
!cd ~
! wget -O opencv.zip https://github.com/opencv/opencv/archive/4.2.0.zip
! wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/4.2.0.zip
! unzip opencv.zip
! unzip opencv_contrib.zip
! mv opencv-4.2.0 opencv
! mv opencv_contrib-4.2.0 opencv_contrib
step 4:
! wget https://bootstrap.pypa.io/get-pip.py
! sudo python3 get-pip.py
! sudo pip install virtualenv virtualenvwrapper
! sudo rm -rf ~/get-pip.py ~/.cache/pip
$ nano ~/.bashrc <----- problem here I can't open this file to edit it in colab
but I get stuck at step4 cuz this tutorial is not for colab and colab give me error
/bin/bash: nano: command not found
please don't refer to a 3rd party tutorial, but report the steps YOU took, and the resp. errors.
also: "use CPU" means what, exactly ? CUDA support for cv2 ?
exactly CUDA support for cv2 I followed the tutorial which is not for colab and step 4 give me an error /bin/bash: nano: command not found
again, please edit your question, and add the steps you took.
(why would it want nano ? that's just plan bs)
did you try to build it on colab ? did you enable a gpu supported runtime there ?
I did enable GPU but when I use OpenCV’s “dnn” module with yolo it takes too long to get results that's mean that openCV doesn't use GPU
actually Idk I'm just following the steps I'm not an expert in OpenCV if you have any tutorial or better steps to make OpenCV use GPU on google colab I will be appreciated
i think that's why they use 4.2 "Led by dlib’s Davis King, and implemented by Yashas Samaga, OpenCV 4.2 now supports NVIDIA GPUs for inference using OpenCV’s dnn module, improving inference speed by up to 1549%!"
yea, you need at least 4.2 for CUDA support
you probably should skip the whole virtualenv crap, colab notebooks are one-off/throwaway things anyway.
(thev's no /~ home directory, no .bashrc and you can't use nano on a webserver)