Cascading classifiers
필터를 사용하여 객체를 인식.
Cascading is a particular case of ensemble learning based on the concatenation of several classifiers, using all information collected from the output from a given classifier as additional information for the next classifier in the cascade. Unlike voting or stacking ensembles, which are multiexpert systems, cascading is a multistage one.
Cascading classifiers are trained with several hundred "positive" sample views of a particular object and arbitrary "negative" images of the same size. After the classifier is trained it can be applied to a region of an image and detect the object in question. To search for the object in the entire frame, the search window can be moved across the image and check every location with the classifier. This process is most commonly used in image processing for object detection and tracking, primarily facial detection and recognition.
The first cascading classifier was the face detector of Viola and Jones (2001). The requirement for this classifier was to be fast in order to be implemented on low-power CPUs, such as cameras and phones.
Haar Cascades
- Python과 OpenCV – 55 : Haar Cascades를 이용한 얼굴 검출 – GIS Developer
- OpenCV 강좌 - Haar Cascades에 대해 알아보자. - 멈춤보단 천천히라도
- [추천] 컴퓨터 비전 - 1. 하르 캐스케이드 얼굴 검출 (Haar Cascade Face Detection)
XML 파일은 haarcascade_frontalface_default.xml 에서 다운로드. 이미지는 아무 사람 얼굴 다운로드.
import cv2
from datetime import datetime
image = cv2.imread("test.png")
cascade_face_detector = cv2.CascadeClassifier("haarcascade_frontalface_default.xml")
while True:
begin = datetime.now()
face_detections = cascade_face_detector.detectMultiScale(image)
for (x, y, w, h) in face_detections:
cv2.rectangle(image, (x, y), (x + w, y + h), (0, 255, 0), 2)
duration = (datetime.now() - begin).total_seconds()
print(duration)
cv2.imshow('demo', image)
if cv2.waitKey(1) == ord('q'):
exit(1)
OpenCV 훈련 방법
OpenCV:CascadeClassifier 항목 참조.
See also
Favorite site
Offical Tutorials
- OpenCV 2.4.13.0 documentation » OpenCV API Reference » objdetect. Object Detection » Cascade Classification
- OpenCV: Cascade Classifier
OpenCV Guide
- 튜토리얼 정독 - (Cascade Classifier) :: 개발자리
- 다크 프로그래머 - OpenCV Haar/cascade training 튜토리얼
- [https://deep-learning-study.tistory.com/244 (파이썬 OpenCV) 캐스케이드 분류기를 이용해서 정면 얼굴 검출하기 - cv2.CascadeClassifier, detectMultiScale, Haar-like features)
- (OpenCV Programming) 캐스케이드 분류기(Cascade Classifier) - 데이터 사이언스 사용 설명서