Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android : If you have a 20 MB image, the app calling the processImage method will break directly #558

Open
ShareZore opened this issue Dec 8, 2023 · 4 comments
Labels
InputImage Issues related to InputImage

Comments

@ShareZore
Copy link

eg:
final anInputImg = InputImage.fromFile(file);
var detectorResult = await FaceDetector(options: FaceDetectorOptions(minFaceSize: 0.3)).processImage(anInputImg);

the app calling the processImage method will break directly

Scheduling upload for context TransportContext(cct, DEFAULT, MSRodHRwczovL2ZpcmViYXNlbG9nZ2luZy5nb29nbGVhcGlzLmNvbS92MGNjL2xvZy9iYXRjaD9mb3JtYXQ9anNvbl9wcm90bzNc) with jobId=-411227319 in 30000ms(Backend next call timestamp 1702018901928). Attempt 1
D/CompatibilityChangeReporter( 1344): Compat change id reported: 194532703; UID 10805; state: ENABLED
I/DynamiteModule( 1344): Considering local module com.google.mlkit.dynamite.face:10000 and remote module com.google.mlkit.dynamite.face:0
I/DynamiteModule( 1344): Selected local version of com.google.mlkit.dynamite.face
D/TransportRuntime.JobInfoScheduler( 1344): Scheduling upload for context TransportContext(cct, VERY_LOW, MSRodHRwczovL2ZpcmViYXNlbG9nZ2luZy5nb29nbGVhcGlzLmNvbS92MGNjL2xvZy9iYXRjaD9mb3JtYXQ9anNvbl9wcm90bzNc) with jobId=-406246582 in 86400000ms(Backend next call timestamp 0). Attempt 1
D/TransportRuntime.SQLiteEventStore( 1344): Storing event with priority=VERY_LOW, name=FIREBASE_ML_SDK for destination cct
D/TransportRuntime.JobInfoScheduler( 1344): Upload for context TransportContext(cct, VERY_LOW, MSRodHRwczovL2ZpcmViYXNlbG9nZ2luZy5nb29nbGVhcGlzLmNvbS92MGNjL2xvZy9iYXRjaD9mb3JtYXQ9anNvbl9wcm90bzNc) is already scheduled. Returning...
V/FaceDetectorV2Jni( 1344): initialize.start()
I/native ( 1344): I1208 15:01:32.844554 1572 face_detector_v2_jni.cc:33] Loading models_bundled/fssd_25_8bit_v2.tflite
I/native ( 1344): I1208 15:01:32.844825 1572 face_detector_v2_jni.cc:33] Loading models_bundled/fssd_25_8bit_gray_v2.tflite
I/native ( 1344): I1208 15:01:32.844953 1572 face_detector_v2_jni.cc:33] Loading models_bundled/fssd_anchors_v2.pb
I/native ( 1344): I1208 15:01:32.845033 1572 face_detector_v2_jni.cc:33] Loading models_bundled/LMprec_600.emd
D/TransportRuntime.SQLiteEventStore( 1344): Storing event with priority=DEFAULT, name=FIREBASE_ML_SDK for destination cct
I/native ( 1344): I1208 15:01:32.852441 1572 face_detector_v2_jni.cc:33] Loading models_bundled/BCLlefteyeclosed_200.emd
I/native ( 1344): I1208 15:01:32.852637 1572 face_detector_v2_jni.cc:33] Loading models_bundled/BCLrighteyeclosed_200.emd
I/native ( 1344): I1208 15:01:32.852728 1572 face_detector_v2_jni.cc:33] Loading models_bundled/BCLjoy_200.emd
I/native ( 1344): I1208 15:01:32.852878 1572 face_detector_v2_jni.cc:33] Loading models_bundled/MFT_fssd_fastgray.pb
I/native ( 1344): I1208 15:01:32.852928 1572 face_detector_v2_jni.cc:33] Loading models_bundled/contours.tfl
D/TransportRuntime.JobInfoScheduler( 1344): Upload for context TransportContext(cct, DEFAULT, MSRodHRwczovL2ZpcmViYXNlbG9nZ2luZy5nb29nbGVhcGlzLmNvbS92MGNjL2xvZy9iYXRjaD9mb3JtYXQ9anNvbl9wcm90bzNc) is already scheduled. Returning...
D/TransportRuntime.SQLiteEventStore( 1344): Storing event with priority=VERY_LOW, name=FIREBASE_ML_SDK for destination cct
D/TransportRuntime.JobInfoScheduler( 1344): Upload for context TransportContext(cct, VERY_LOW, MSRodHRwczovL2ZpcmViYXNlbG9nZ2luZy5nb29nbGVhcGlzLmNvbS92MGNjL2xvZy9iYXRjaD9mb3JtYXQ9anNvbl9wcm90bzNc) is already scheduled. Returning...
I/native ( 1344): I1208 15:01:32.950031 1572 face_detector_v2_jni.cc:33] Loading models_bundled/blazeface.tfl
I/tflite ( 1344): Initialized TensorFlow Lite runtime.
V/FaceDetectorV2Jni( 1344): initialize.end()
I/face_similarity( 1344): Starting a blocking GC Alloc
I/face_similarity( 1344): Starting a blocking GC Alloc
I/face_similarity( 1344): Alloc young concurrent copying GC freed 15923(988KB) AllocSpace objects, 3(60KB) LOS objects, 55% free, 4423KB/9857KB, paused 49us,30us total 11.794ms
I/face_similarity( 1344): Forcing collection of SoftReferences for 706MB allocation
I/face_similarity( 1344): Starting a blocking GC Alloc
I/face_similarity( 1344): Alloc concurrent copying GC freed 1607(63KB) AllocSpace objects, 0(0B) LOS objects, 58% free, 4375KB/10MB, paused 49us,24us total 14.056ms
W/face_similarity( 1344): Throwing OutOfMemoryError "Failed to allocate a 740616844 byte allocation with 6291456 free bytes and 251MB until OOM, target footprint 10771960, growth limit 268435456" (VmSize 22413220 kB)
I/face_similarity( 1344): Starting a blocking GC Alloc
I/face_similarity( 1344): Starting a blocking GC Alloc
I/face_similarity( 1344): Forcing collection of SoftReferences for 706MB allocation
I/face_similarity( 1344): Starting a blocking GC Alloc
I/face_similarity( 1344): Alloc concurrent copying GC freed 85(3680B) AllocSpace objects, 0(0B) LOS objects, 58% free, 4371KB/10MB, paused 19us,22us total 10.762ms
W/face_similarity( 1344): Throwing OutOfMemoryError "Failed to allocate a 740616848 byte allocation with 6291456 free bytes and 251MB until OOM, target footprint 10768352, growth limit 268435456" (VmSize 22413220 kB)
E/AndroidRuntime( 1344): FATAL EXCEPTION: pool-9-thread-1
E/AndroidRuntime( 1344): Process: com.facesimilar.www.face_similarity, PID: 1344
E/AndroidRuntime( 1344): java.lang.OutOfMemoryError: Failed to allocate a 740616848 byte allocation with 6291456 free bytes and 251MB until OOM, target footprint 10768352, growth limit 268435456
E/AndroidRuntime( 1344): at com.google.mlkit.vision.common.internal.ImageConvertUtils.convertToNv21Buffer(com.google.mlkit:vision-common@@17.3.0:12)
E/AndroidRuntime( 1344): at com.google.mlkit.vision.face.internal.zza.zzh(com.google.android.gms:play-services-mlkit-face-detection@@17.0.1:3)
E/AndroidRuntime( 1344): at com.google.mlkit.vision.face.internal.zza.zza(com.google.android.gms:play-services-mlkit-face-detection@@17.0.1:5)
E/AndroidRuntime( 1344): at com.google.mlkit.vision.face.internal.zzh.zzc(com.google.android.gms:play-services-mlkit-face-detection@@17.0.1:3)
E/AndroidRuntime( 1344): at com.google.mlkit.vision.face.internal.zzh.run(com.google.android.gms:play-services-mlkit-face-detection@@17.0.1:1)
E/AndroidRuntime( 1344): at com.google.mlkit.vision.common.internal.MobileVisionBase.zza(com.google.mlkit:vision-common@@17.3.0:2)
E/AndroidRuntime( 1344): at com.google.mlkit.vision.common.internal.zza.call(Unknown Source:4)
E/AndroidRuntime( 1344): at com.google.mlkit.common.sdkinternal.ModelResource.zza(com.google.mlkit:common@@18.6.0:8)
E/AndroidRuntime( 1344): at com.google.mlkit.common.sdkinternal.zzn.run(Unknown Source:10)
E/AndroidRuntime( 1344): at com.google.mlkit.common.sdkinternal.zzt.run(com.google.mlkit:common@@18.6.0:2)
E/AndroidRuntime( 1344): at com.google.mlkit.common.sdkinternal.MlKitThreadPool.zze(com.google.mlkit:common@@18.6.0:4)
E/AndroidRuntime( 1344): at com.google.mlkit.common.sdkinternal.MlKitThreadPool.zzc(com.google.mlkit:common@@18.6.0:1)
E/AndroidRuntime( 1344): at com.google.mlkit.common.sdkinternal.zzk.run(Unknown Source:2)
E/AndroidRuntime( 1344): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
E/AndroidRuntime( 1344): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
E/AndroidRuntime( 1344): at com.google.mlkit.common.sdkinternal.MlKitThreadPool.zzd(com.google.mlkit:common@@18.6.0:2)
E/AndroidRuntime( 1344): at com.google.mlkit.common.sdkinternal.zzi.run(Unknown Source:2)
E/AndroidRuntime( 1344): at java.lang.Thread.run(Thread.java:1012)
I/ViewRootImpl@2d78850MainActivity: MSG_WINDOW_FOCUS_CHANGED 0 0
I/ViewRootImpl@2d78850MainActivity: handleAppVisibility mAppVisible = true visible = false
I/SurfaceView@7801720( 1344): onWindowVisibilityChanged(8) false io.flutter.embedding.android.FlutterSurfaceView{7801720 V.E...... ........ 0,0-1080,2355} of ViewRootImpl@2d78850[MainActivity]
I/SurfaceView@7801720( 1344): Changes: creating=false format=false size=false visible=true alpha=false hint=false mUseAlpha=false visible=true left=false top=false
I/SurfaceView@7801720( 1344): 125835040 Cur surface: Surface(name=null)/@0xd12c5dc
I/SurfaceView@7801720( 1344): applyTransactionOnVriDraw: vri = ViewRootImpl@2d78850[MainActivity] fRS = false t = 0xb400006f8eec94f0 android.view.SurfaceView.performSurfaceTransaction:959 android.view.SurfaceView.updateSurface:1105 android.view.SurfaceView.onWindowVisibilityChanged:371
I/ViewRootImpl@2d78850MainActivity: applyTransactionOnDraw: mRemoved = false isHardwareEnabled = true t = 0xb400006f8eec94f0android.view.SurfaceView.applyTransactionOnVriDraw:2048 android.view.SurfaceView.performSurfaceTransaction:959 android.view.SurfaceView.updateSurface:1105 android.view.SurfaceView.onWindowVisibilityChanged:371 android.view.View.dispatchWindowVisibilityChanged:15943
I/SurfaceView@7801720( 1344): surfaceDestroyed
I/SurfaceView@7801720( 1344): surfaceDestroyed callback.size 1 #2 io.flutter.embedding.android.FlutterSurfaceView{7801720 V.E...... ........ 0,0-1080,2355}
I/SurfaceView@7801720( 1344): updateSurface: mVisible = false mSurface.isValid() = true
I/SurfaceView@7801720( 1344): releaseSurfaces: viewRoot = ViewRootImpl@2d78850[MainActivity]
I/SurfaceView@7801720( 1344): applyTransactionOnVriDraw: vri = ViewRootImpl@2d78850[MainActivity] fRS = true t = 0xb400006f8eebb510 android.view.SurfaceView.releaseSurfaces:858 android.view.SurfaceView.updateSurface:1172 android.view.SurfaceView.onWindowVisibilityChanged:371
I/SurfaceView@7801720( 1344): applyTransactionOnVriDraw: viewRoot.applyTransactionOnDrawFromReleaseSurfaces
I/ViewRootImpl@2d78850MainActivity: from releaseSurfaces t.apply t = 0xb400006f8eebb510
V/SurfaceView@7801720( 1344): Layout: x=0 y=0 w=1080 h=2355, frame=Rect(0, 0 - 1080, 2355)
D/SurfaceView@7801720( 1344): windowPositionLost, frameNr = 0
D/OpenGLRenderer( 1344): setSurface called with nullptr
D/OpenGLRenderer( 1344): setSurface() destroyed EGLSurface
D/OpenGLRenderer( 1344): destroyEglSurface
I/ViewRootImpl@2d78850MainActivity: performTraversals mFirst=false windowShouldResize=false viewVisibilityChanged=true mForceNextWindowRelayout=false params=null
I/ViewRootImpl@2d78850MainActivity: Relayout returned: old=(0,0,1080,2400) new=(0,0,1080,2400) req=(1080,2400)8 dur=16 res=0x2 s={false 0x0} ch=true seqId=0
I/SurfaceView@7801720( 1344): windowStopped(true) false io.flutter.embedding.android.FlutterSurfaceView{7801720 V.E...... ........ 0,0-1080,2355} of ViewRootImpl@2d78850[MainActivity]
D/SurfaceView@7801720( 1344): updateSurface: surface is not valid
I/SurfaceView@7801720( 1344): releaseSurfaces: viewRoot = ViewRootImpl@2d78850[MainActivity]
I/SurfaceView@7801720( 1344): applyTransactionOnVriDraw: vri = ViewRootImpl@2d78850[MainActivity] fRS = true t = 0xb400006f8eeb5b10 android.view.SurfaceView.releaseSurfaces:858 android.view.SurfaceView.updateSurface:998 android.view.SurfaceView.setWindowStopped:335
I/SurfaceView@7801720( 1344): applyTransactionOnVriDraw: viewRoot.applyTransactionOnDrawFromReleaseSurfaces
I/ViewRootImpl@2d78850MainActivity: from releaseSurfaces t.apply t = 0xb400006f8eeb5b10
D/SurfaceView@7801720( 1344): updateSurface: surface is not valid
I/SurfaceView@7801720( 1344): releaseSurfaces: viewRoot = ViewRootImpl@2d78850[MainActivity]
I/SurfaceView@7801720( 1344): applyTransactionOnVriDraw: vri = ViewRootImpl@2d78850[MainActivity] fRS = true t = 0xb400006f8eec1270 android.view.SurfaceView.releaseSurfaces:858 android.view.SurfaceView.updateSurface:998 android.view.SurfaceView.lambda$new$0$android-view-SurfaceView:200
I/SurfaceView@7801720( 1344): applyTransactionOnVriDraw: viewRoot.applyTransactionOnDrawFromReleaseSurfaces
I/ViewRootImpl@2d78850MainActivity: from releaseSurfaces t.apply t = 0xb400006f8eec1270
I/ViewRootImpl@2d78850MainActivity: stopped(true) old = false
I/ViewRootImpl@2d78850MainActivity: WindowStopped on com.facesimilar.www.face_similarity/com.facesimilar.www.face_similarity.MainActivity set to true
D/SurfaceView@7801720( 1344): updateSurface: surface is not valid
I/SurfaceView@7801720( 1344): releaseSurfaces: viewRoot = ViewRootImpl@2d78850[MainActivity]
I/SurfaceView@7801720( 1344): applyTransactionOnVriDraw: vri = ViewRootImpl@2d78850[MainActivity] fRS = true t = 0xb400006f8eeadf50 android.view.SurfaceView.releaseSurfaces:858 android.view.SurfaceView.updateSurface:998 android.view.SurfaceView.setVisibility:392
I/SurfaceView@7801720( 1344): applyTransactionOnVriDraw: viewRoot.applyTransactionOnDrawFromReleaseSurfaces
I/ViewRootImpl@2d78850MainActivity: from releaseSurfaces t.apply t = 0xb400006f8eeadf50
I/MSHandlerLifeCycle( 1344): removeMultiSplitHandler: no exist. decor=DecorView@776ba11[MainActivity]
D/SurfaceView@7801720( 1344): setAlpha: mUseAlpha = false alpha=0.0
D/SurfaceView@7801720( 1344): updateSurfaceAlpha: setUseAlpha() is not called, ignored.
D/SurfaceView@7801720( 1344): updateSurface: surface is not valid
I/SurfaceView@7801720( 1344): releaseSurfaces: viewRoot = ViewRootImpl@2d78850[MainActivity]
I/SurfaceView@7801720( 1344): applyTransactionOnVriDraw: vri = ViewRootImpl@2d78850[MainActivity] fRS = true t = 0xb400006f8eea1830 android.view.SurfaceView.releaseSurfaces:858 android.view.SurfaceView.updateSurface:998 android.view.SurfaceView.onDetachedFromWindow:496
I/SurfaceView@7801720( 1344): applyTransactionOnVriDraw: viewRoot.applyTransactionOnDrawFromReleaseSurfaces
I/ViewRootImpl@2d78850MainActivity: from releaseSurfaces t.apply t = 0xb400006f8eea1830
I/SurfaceView@7801720( 1344): onDetachedFromWindow: tryReleaseSurfaces()
I/SurfaceView@7801720( 1344): releaseSurfaces: viewRoot = ViewRootImpl@2d78850[MainActivity]
I/SurfaceView@7801720( 1344): applyTransactionOnVriDraw: vri = ViewRootImpl@2d78850[MainActivity] fRS = true t = 0xb400006f8eec0bb0 android.view.SurfaceView.releaseSurfaces:858 android.view.SurfaceView.onDetachedFromWindow:500 android.view.View.dispatchDetachedFromWindow:22538
I/SurfaceView@7801720( 1344): applyTransactionOnVriDraw: viewRoot.applyTransactionOnDrawFromReleaseSurfaces
I/ViewRootImpl@2d78850MainActivity: from releaseSurfaces t.apply t = 0xb400006f8eec0bb0
I/MSHandlerLifeCycle( 1344): removeMultiSplitHandler: no exist. decor=DecorView@776ba11[MainActivity]
D/OpenGLRenderer( 1344): setSurface called with nullptr
I/ViewRootImpl@2d78850MainActivity: dispatchDetachedFromWindow
D/InputTransport( 1344): Input channel destroyed: 'ffb6e87', fd=122
D/InputTransport( 1344): Input channel destroyed: 'ClientS', fd=145
I/Choreographer( 1344): Skipped 31 frames! The application may be doing too much work on its main thread.

@sivasankarp01
Copy link

I am also facing same issue
Did u find any solution for this

@dediks19
Copy link

I am having same issue, and haven't found a solution yet.

@ShareZore
Copy link
Author

我有同样的问题,但还没有找到解决方案。

I currently limit the size of the image before testing

@ShareZore
Copy link
Author

我也面临同样的问题 你找到解决方案了吗

I currently limit the size of the image before testing

@fbernaly fbernaly added the InputImage Issues related to InputImage label Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
InputImage Issues related to InputImage
Projects
None yet
Development

No branches or pull requests

4 participants