react-native-tensorflow icon indicating copy to clipboard operation
react-native-tensorflow copied to clipboard

Could not invoke RNImageRecognition.initImageRecognizer. Failed to allocate byte allocation.

Open Jonarod opened this issue 6 years ago • 4 comments

Just cloned the repo, and ran the example as-is on a Genymotion android device with 4Gb RAM. Everything seems to build fine, but got this error in the device:

Could not invoke RNImageRecognition.initImageRecognizer. 

null

Failed to allocate a 53884608 byte allocation with 25165824 free bytes and 31MB until OOM, max allowed footprint 93269104, growth limit 100663296.

I can imagine it is an "hardware" problem but I find it a bit strange it's not working on a 4096MB RAM device for an image classifier.

Maybe use TensorFlow Lite instead ? Any suggestion ?

Jonarod avatar Jan 13 '19 21:01 Jonarod

Same issue here.

I also have a very large frozen graph (400mb), even after running the inference optimizer on it.

twalk4821 avatar Jan 20 '19 20:01 twalk4821

you can try this:add below entities in your manifest file
android:<application hardwareAccelerated="false" android:largeHeap="true"> https://stackoverflow.com/questions/32244851/androidjava-lang-outofmemoryerror-failed-to-allocate-a-23970828-byte-allocatio

alwaysmyz avatar Jan 21 '19 08:01 alwaysmyz

That did not work in my case. Thanks for the suggestion though.

On Mon, Jan 21, 2019, 12:19 AM alwaysmyz <[email protected] wrote:

you can try this:add below entities in your manifest file android:hardwareAccelerated="false" , android:largeHeap="true" just like below

I solve this error by this way.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/reneweb/react-native-tensorflow/issues/39#issuecomment-455984389, or mute the thread https://github.com/notifications/unsubscribe-auth/AWnaIQCBRhwcnfa7uLOVo9xQjZ-oBgXoks5vFXf-gaJpZM4Z9YOi .

twalk4821 avatar Jan 21 '19 18:01 twalk4821

2019-01-23 10 10 55

alwaysmyz avatar Jan 23 '19 02:01 alwaysmyz