I am trying to do some feature engineering on facial images using Python and OpenCV. The idea is to use those features for unsupervised learning to group images of the same person together. The pipeline is as follows:
- Choose one of several OpenCV face detectors (a couple of LBP and a couple of HAAR face cascades)
- Use OpenCV to
2.1 Convolve images with a 5-by-5 Gaussian function for low-band filtering to reduce noise
2.2 Convert images to grayscale
2.3 Extract facial images from pictures
2.4 Resize faces to a common shape (300 by 300, for example) - Use scikit-image.feature.local_binary_pattern to get local binary patterns of faces
- Use numpy to produce histograms of those LBPs
- Use histograms as features for scikit-learn's NearestNeighbors unsupervised learning algorithm to look for clusters of images that may indicate them belonging to the same person
The problem is that clustering doesn't really work well. When I look at my data reduced to two dimensions for visualization, it doesn't even look like there are any discernable clusters, despite me knowing that my test images contain pictures of several different persons.
I suspect that it is related to scikit-image's LBP parameters: sampling points number and sampling radius. I tried playing around with several values for those hoping to see a good separation between images of different persons, but so far haven't had much luck, see results here. (Different colors indicate different people for visualization purposes.) So here is my question of the post:
Is there a good rubric or a rule for selecting the number of sampling points and the sampling radius of LBP based perhaps on images' nature or some property of theirs? If you have other ideas on how to get good features, please, also let me know.