In Google colaboratory, when trying to use opencv haar-cascade classifiers and loading the classifier data, the library uses a path to determine where the classifier data is.
How can this path be specified in a colaboratory notebook, since typically files are loaded from google drive or uploaded? How can this also be done if opencv loads images?
The Colab notebook looks like:
# install opencv
!apt-get -qq install -y libsm6 libxext6 && pip install -q -U opencv-python
import cv2
# load the cascades. I'd like to know how to properly set the below path if using google drive for uploading this data. Or if there is another recommended approach
cascades_path = '/usr/share/opencv/haarcascades/'
face_cascade = cv2.CascadeClassifier(cascades_path + 'haarcascade_frontalface_default.xml')
eye_cascade = cv2.CascadeClassifier(cascades_path + 'haarcascade_eye.xml')
# load an image. How should this path be specified with opencv in google colaboratory?
img = cv2.imread('images/image2.jpg')
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
face_detections = face_cascade.detectMultiScale(gray, 1.3, 5)