Vision face detection poor results on iPad

Hi,

i followed the SWIFT "photo capture programming guide" from the developer site. Face detection in videopreview runs smoothly, fast and perfect on my IMAC with the built in cam. Running the same app on an IPAD, with adjustments to fullfill IOS requirements, I got really poor results. Face detection producres only sometimes results. I have to switch off room light and only when the background is plain, it works sometimes. I tweeked the ISO values, but that doesn´t help. It doesn´t matter, if I use the front or back camera. I also tried different "kCVPixelFormatTypes". I tried both, face rectangle detection and region detection.



Are there any other suggestions what I can do, to improve the performances?


Replies

Update,

I gave today CIDetector a try instead of Vision and I see much better results. Here are the two versions:

Very poor results:

Vision

let request = VNDetectFaceRectanglesRequest()

let pixelBuffer: CVPixelBuffer = CMSampleBufferGetImageBuffer(sampleBuffer)!

let handle = VNImageRequestHandler(cvPixelBuffer: pixelBuffer)

try! handle.perform([request])

guard

let result = request.results, result.count > 0

else { return }

print(result.count)

let face = request.results!.first as! VNFaceObservation


Much better results, but not as good as Vision on Imac

CIDetector

let accuracy = [CIDetectorAccuracy: CIDetectorAccuracyHigh

self.faceDetector = CIDetector(ofType: CIDetectorTypeFace, context: nil, options: accuracy)!

guard let imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer) else { return }

let ciImage = CIImage(cvPixelBuffer: imageBuffer)

guard let faces = self.faceDetector.features(in: ciImage) as? [CIFaceFeature] else { return }



I´m not happy with this, but at the moment I must admit that Vision is not the best choice. Maybe there are some tricks to accelerate Vision, which I don´t know..

Any Ideas are welcome---

Thanks, Hartwig

I am also a bit disappointed by the vision face (rectangle) recognition results on iOS. One thing I noticed was that converting the image to grey scale and improving the contrast brought out a lot of additional faces.

I applied the CIFilters "CISharpenLuminance" and "CIPhotoEffectNoir" and played with them for a while. I can´t see any differences....