OpenCV Python face accuracy

asked 2014-05-19 16:39:55 -0600

Fox_21 gravatar image

updated 2014-05-19 16:55:26 -0600

berak gravatar image

Hi guys I have question about OpenCv. How can OpenCV predict face accuracy, on detecting face in images. I have trained my own xml classifier with 2500 positive images, 5000 negative images on 20 stages with mode ALL. I mean with opencv_haartrainer.

With my trained xml, how can I get accuracy on detected face from images. I know there will be some garbage it's normal, but is there any build in function that can show me with some percentage or value from trained XML.

My code look's like:

!/usr/bin/python

-- coding: utf-8 --

import os, sys
import numpy as np import cv2
import cv2.cv as cv

face_cacade = 'trained_face.xml'
xml= cv2.CascadeClassifier(face_cascade)
array_of_images=['img1.jpg','img2.jpg'] -- Someimages

for image in array_of_images:

img   = cv2.imread(image)

gray  = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

gray  = cv2.equalizeHist(gray)

faces = xml.detectMultiScale(image =img,scaleFactor=1.2,minNeighbors=4,flags

=cv.CV_HAAR_SCALE_IMAGE)

for (x,y,w,h) in faces: 

    cv2.rectangle(img,(x,y),(x+w,y+h),(0,255,0),1)

    roi_gray  = gray[y:y+h, x:x+w]

    roi_color = img[y:y+h, x:x+w]

Can you give me some solution or experience on Opencv face accuracy perctange. OpenCV version: 2.4.8 Python version: 2.7.6

edit retag flag offensive close merge delete

Comments

The question is how can i get accuracy on false or true image detected from my trained xml?

Fox_21 gravatar imageFox_21 ( 2014-05-19 16:45:52 -0600 )edit