Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV Python face accuracy

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

OpenCV Python face accuracy

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

cv
face_cacade = 'trained_face.xml'

xml = cv2.CascadeClassifier(face_cascade)

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

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)


=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

OpenCV Python face accuracy

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 np import cv2
import cv2.cv as cv cv

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

for image in array_of_images: 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

click to hide/show revision 4
retagged

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

berak gravatar image

OpenCV Python face accuracy

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