FaceDetection icon indicating copy to clipboard operation
FaceDetection copied to clipboard

Very slow on older devices

Open aayushkapoor206 opened this issue 9 years ago • 9 comments

The frame rate is very low, around 0.5 fps on iPhone 4S and the app receives memory warning in about 8 seconds. Hope that helps! :+1:

aayushkapoor206 avatar Oct 15 '15 15:10 aayushkapoor206

is there any options that can make this app more faster?

D-Link13 avatar Mar 21 '16 12:03 D-Link13

@aayushkapoor206 @D-Link13 I'm looking into this to see if we can speed it up.

ryanmasondavies avatar Mar 25 '16 12:03 ryanmasondavies

I found out this one tutorial. It uses AVCaptureMetadataOutput() instead of CIDetector, and it works faster on the device. But of course it's without any drawing content, only detecting face.

D-Link13 avatar Mar 25 '16 13:03 D-Link13

Thanks for the pointer! If that's a faster API for detecting faces, that would definitely help with performance. I'll look into it for use here. If Apple can detect faces in real-time in the Camera app, we should be able to do it too!

There are also a few conversions that stand out to me (primarily, conversion of CIImage to UIImage for display in ViewController) where we might gain a few minor performance improvements.

@D-Link13 would you be able to help with testing / implementation?

ryanmasondavies avatar Mar 25 '16 21:03 ryanmasondavies

Well, I have already done an app based on that subject (avcapturemetadata). In wich way it will be the best to provide it for you? I am not sure about the clearest of the code, but it works! So it will be good if you help me with possible refactor.

D-Link13 avatar Mar 26 '16 05:03 D-Link13

You could either email it to me (see profile) or – preferably – clone this repo and add your code as a separate project (maybe name it AVCaptureMetadata). I'll happily accept a pull request. If you're interested in contributing further than that, I can also grant push access for you! And yeah, happy to help with refactoring. :+1:

ryanmasondavies avatar Mar 26 '16 20:03 ryanmasondavies

To be clear, if you've written a whole app and don't want to share the entire project – I'm only interested in the use of AVCaptureMetadata, so you could just put the relevant file in a folder and push that.

ryanmasondavies avatar Mar 26 '16 20:03 ryanmasondavies

Here you go. This is the sample that i used in my project to detect face… It only could detect face, and it stops the session when it detects one. It also needs the best mechanism for capturing the face image (for now it only takes a screenshot, but that is not a good thing). I am wondering at how to make a photo more neatly and save it in the data model correctly. If you have any ideas in refactoring or maybe enhancement, please response. Have a nice day =)

D-Link13 avatar Mar 31 '16 09:03 D-Link13

@D-Link13 I think maybe you attached a file to an email reply, but that didn't get included in your GitHub comment?

Could you possibly make a pull request, push the repo to your own GitHub profile, or copy and paste the code directly into a comment on the website? Or if you'd prefer, you can email it to me directly at [email protected] and I'll take a look.

I'll gladly help with improving the code once I can try it! Thanks! :smiley:

ryanmasondavies avatar Apr 06 '16 21:04 ryanmasondavies