BlinkID / blinkid-android

Everything you need to add AI-driven ID scanning into your native Android app.
https://microblink.com/identity/identity-document-scanning/
444 stars 153 forks source link

3.12.0 sdk MRTD and USDL performance issue #65

Closed techvedikasolutions closed 6 years ago

techvedikasolutions commented 6 years ago

Hi,I updated my blink sdk from 3.6.0 to 3.12.0.I tested my app in different devices(Moto e4-7.1.1V,HTC-6.0V,Asus-5.0.2V)Below are my observations(scanning performance issues) and code settings for corresponding recognizer settings.

1.mrtd documents scan with image listener(like common passport docs) scanning time is too long in 3.12.0 compared with 3.6.0 Code settings : MRTDRecognizerSettings mrtd = new MRTDRecognizerSettings(); mrtd.setShowFullDocument(true); mrtd.setAllowUnverifiedResults(true); scanIntent = buildIntent(new RecognizerSettings[]{mrtd}, ScanCard.class, null); 2.USDL barcode scan with image listener scanning time is too horrible in 3.12.0 Code settings: USDLRecognizerSettings usdl = new USDLRecognizerSettings(); usdl.setUncertainScanning(false); usdl.setNullQuietZoneAllowed(false); scanIntent = buildIntent(new RecognizerSettings[]{usdl}, ScanCard.class, null); 3.For German driving license(EUDL) : Scanned immediately but getting only first name(getting correct name) and last name(getting incorrect name) details from the results. Code settings: EUDLRecognizerSettings germanDl = new EUDLRecognizerSettings(EUDLCountry.EUDL_COUNTRY_GERMANY); germanDl.setShowFullDocument(true); scanIntent = buildIntent(new RecognizerSettings[]{germanDl}, ScanCard.class, null);

MainIntent Settings private Intent buildIntent(RecognizerSettings[] settArray, Class<?> target, Intent helpIntent) { final Intent intent = new Intent(this, target); intent.putExtra(ScanActivity.EXTRAS_BEEP_RESOURCE, R.raw.beep);
if (helpIntent != null) { intent.putExtra(ScanActivity.EXTRAS_HELP_INTENT, helpIntent); }
RecognitionSettings settings = new RecognitionSettings(); //IMAGE meta data settings MetadataSettings.ImageMetadataSettings ims = new MetadataSettings.ImageMetadataSettings();
ims.setDewarpedImageEnabled(true);
ims.setSuccessfulScanFrameEnabled(true); settings.setNumMsBeforeTimeout(2000); settings.setAllowMultipleScanResultsOnSingleImage(true); settings.setFrameQualityEstimationMode(RecognitionSettings.FrameQualityEstimationMode.ALWAYS_ON);
settings.setRecognizerSettingsArray(settArray); intent.putExtra(ScanActivity.EXTRAS_RECOGNITION_SETTINGS, settings); intent.putExtra(ScanActivity.EXTRAS_LICENSE_KEY, Config.LICENSE_KEY); intent.putExtra(ScanActivity.EXTRAS_SHOW_FOCUS_RECTANGLE, true); intent.putExtra(ScanActivity.EXTRAS_ALLOW_PINCH_TO_ZOOM, true); intent.putExtra(ScanCard.EXTRAS_SPLASH_SCREEN_LAYOUT_RESOURCE, R.layout.loding_screen); intent.putExtra(ScanCard.EXTRAS_IMAGE_LISTENER, new MyImageListener()); intent.putExtra(ScanCard.EXTRAS_IMAGE_METADATA_SETTINGS, ims); intent.putExtra(SegmentScanActivity.EXTRAS_SHOW_OCR_RESULT_MODE, (Parcelable) ShowOcrResultMode.ANIMATED_DOTS); return intent; }

In all devices the performance is same.Please check this and let me know if any code settings need to be change at my end.

Thanks in Advance.

i1E commented 6 years ago

Hi @techvedikasolutions,

unfortunately, we don't have those devices at the office, but we tested our SDK on few other devices with the code snippets that you have provided. We haven't noticed any performance issues. Maybe there is a problem in your implementation of the ImageListener, maybe you are performing some expensive operations there. Can you please share your implementation of the ImageListener with us? While we were testing the SDK, we used this ImageListener implementation from the documentation.

When you use setNumMsBeforeTimeout, you can get partial results. For example, if you set number of milliseconds before timeout to 2000ms, when first non empty result arrives (for example only first name is scanned), after 2000ms scanning will be finished and you will get the data which was scanned up to that time. Probably, that is happening when you are scanning the German driver's license.

Can you please send us the images of the documents that you are trying to scan to support@microblink.com.

techvedikasolutions commented 6 years ago

Hi,Thanks for your response.I sent an email with attachment of documents.Please check and let me know.I just replaced the image listener code with your demo listener,after that it takes 52 seconds (some times more than 1-2 mins)to scan the common passport document.Can you please tell me what is the average latency time to scan the documents in high end phones?.

Please reply to me back.It will be helpful for solving the issue.

Thanks in advance.

culoi commented 6 years ago

Hello @techvedikasolutions

I just tested samples that you send using LG Spirit G4 with BlinkID 3.12 and everything scans correctly and fast, especially for the documents with MRTD line. Unfortunately, we don't have support for the Ireland DL, yet. It scans some field with the existing EUDLRecognizer however not all of them are populated. The problem that may occur if you scan samples from the screen monitor. In that case, a moire pattern may occur, an interference in frequency between screen and camera. If you are using a monitor, then I would suggest using MB's Retina or even better to print out samples and test it on them. Our SDK is optimised to perform best on the real documents. Also, are you able to compare our BlinkID demo app from the Play store against your app and check if there is any difference in time?

Regards

CattleOfRa commented 6 years ago

I have encountered similar issue for MRTD on a couple of devices mainly XiaoMi's. It seems like the MRTD scanner is using more memory than previously observed in other versions of MB. Currently I try to detect the face on the ID card using Google Vision API, and the app crashes quite often (on some very specific devices, not all I must say), with the following log:

I/DEBUG   (22103): Abort message: 'invalid address or address of corrupt block 0x5599dc5680 passed to dlfree'
I/DEBUG   (22103):     x0   29be36b9ff6d6607  x1   0000007fb0e4b8d0  x2   0000000000000000  x3   0000000000000000
I/DEBUG   (22103):     x4   0000007f9b1e6b78  x5   00000000deadbaad  x6   0000000000000000  x7   0000000000000010
I/DEBUG   (22103):     x8   7f7f7f7f7f7f7f7f  x9   6471656b631f6e73  x10  7f7f7f7f7f7f7f7f  x11  29be36b9ff6d6607
I/DEBUG   (22103):     x12  0000000000000001  x13  29be36b9ff6d6607  x14  00000000ffffffd8  x15  00000000000003c7
I/DEBUG   (22103):     x16  0000007f9553c0b0  x17  0000000000000001  x18  0000000000000000  x19  0000005599dc5680
I/DEBUG   (22103):     x20  0000007fb0e16000  x21  0000005599dc5690  x22  0000007fb0e16e90  x23  0000007f8f7318d8
E/mm-camera(  378): invalid stats mask. Return back
I/DEBUG   (22103):     x24  00000000000001af  x25  0000000000000500  x26  00000000fffffffe  x27  00000055994b0280
I/DEBUG   (22103):     x28  0000005599829780  x29  0000007f9553c0b0  x30  0000007fb0db5fb0
I/DEBUG   (22103):     sp   0000007f9553c0b0  pc   0000007fb0db5fb8  pstate 0000000060000000
I/DEBUG   (22103): 
I/DEBUG   (22103): backtrace:
I/DEBUG   (22103):     #00 pc 000000000003ffb8  /system/lib64/libc.so (dlfree+408)
I/DEBUG   (22103):     #01 pc 0000000000012f00  /system/lib64/libc.so (free+20)
I/DEBUG   (22103):     #02 pc 0000000000120220  /data/data/com.google.android.gms/app_vision/face/libs/arm64-v8a/libmobile_vision_face.so

At first I thought the issue might be something wrong with the libmobile_vision_face.so/Google Vision API, so I began searching what the issue might be. Anyway, after spending a couple of days trying and searching I noticed that with other ID types other than Passport, GV API doesn't ever crash or show any visible signs of "lag"

EDIT1: The above log is from running a log of system messages (adb logcat) since the emulator log not as extensive. Before the crash there seems to be some problem with the garbage collector.

I/art: Background sticky concurrent mark sweep GC freed 8984(524KB) AllocSpace objects, 3(48KB) LOS objects, **0% free**, **66MB/66MB**, paused 22.020ms total 35.506ms
A/libc: invalid address or address of corrupt block 0x559a0d8030 passed to dlfree
A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0xdeadbaad in tid 21746 (Recognition)
culoi commented 6 years ago

Hello, please try the new API version of the BlinkID. Closing the issue, please reopen if you have additional questions or contact us directly at support@microblink.com