You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that there is a very minor difference in the number of detections if executing the wrapper and the original code.
The wrapper code seems to just call the opencv frontal detector xml files and call the respective code. One idea might be because of the opencv swapped channels, however I did not manage to make the number of detections match.
This is quite minor though, since it shows up in images with multiple people with quite adjusted hyperparams for the cascade, however I am not sure whether this entails any real change we need to do in the wrapper.
Example:
import cv2
from menpo.io import import_image
from menpodetect.opencv import load_opencv_frontal_face_detector
from menpodetect.opencv.conversion import opencv_frontal_face_path
from functools import partial
p1 = ''
img = cv2.imread(p1 + 'test.jpg')
im = import_image(p1 + 'test.jpg')
# settings for the cascade (opencv multiscale one)
sc_f = 1.45
min_sz = (15, 15)
min_n = 2
sc_f = 1.02
min_sz = (15, 15)
min_n = 2
detector = partial(load_opencv_frontal_face_detector(), min_size=min_sz,
min_neighbours=min_n , scale_factor=sc_f)
# ensure there are no prior landmarks.
for gr in im.landmarks.group_labels:
del im.landmarks[gr]
detector(im)
print(len(im.landmarks.group_labels))
# Opencv code
faceCascade = cv2.CascadeClassifier(str(opencv_frontal_face_path))
faces = faceCascade.detectMultiScale(
img,
scaleFactor=sc_f,
minNeighbors=min_n,
minSize=min_sz,
flags = cv2.CASCADE_SCALE_IMAGE
)
print("Found {0} faces!".format(len(faces)))
# grey version
grey = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
faces = faceCascade.detectMultiScale(
grey,
scaleFactor=sc_f,
minNeighbors=min_n,
minSize=min_sz,
flags = cv2.CASCADE_SCALE_IMAGE
)
print("Found {0} faces (grey)!".format(len(faces)))
In my pc and with either one of the settings above this results to a printing of 23 face detections from the wrapper and 21 from the original code.
The input image was:
The text was updated successfully, but these errors were encountered:
grigorisg9gr
changed the title
Difference of opencv wrapper from the original detector?
Minor difference of opencv wrapper from the original detector?
Dec 2, 2016
I noticed that there is a very minor difference in the number of detections if executing the wrapper and the original code.
The wrapper code seems to just call the opencv frontal detector xml files and call the respective code. One idea might be because of the opencv swapped channels, however I did not manage to make the number of detections match.
This is quite minor though, since it shows up in images with multiple people with quite adjusted hyperparams for the cascade, however I am not sure whether this entails any real change we need to do in the wrapper.
Example:
In my pc and with either one of the settings above this results to a printing of 23 face detections from the wrapper and 21 from the original code.
The input image was:
The text was updated successfully, but these errors were encountered: