MCPcopy Create free account
hub / github.com/Kaggle/docker-python / test_classifier

Method test_classifier

tests/test_opencv.py:12–21  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

10 self.assertEqual(1, img.shape[0])
11
12 def test_classifier(self):
13 face_classifier = cv2.CascadeClassifier()
14 # Pretrained classifier downloaded from here: https://github.com/opencv/opencv/tree/4.x/data/haarcascades
15 face_classifier.load('/input/tests/data/haarcascade_frontalface_alt.xml')
16
17 img = cv2.imread('/input/tests/data/face.jpg')
18 frame_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
19 frame_gray = cv2.equalizeHist(frame_gray)
20 faces = face_classifier.detectMultiScale(frame_gray)
21 self.assertEqual(1, len(faces))

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected