tensorflow / tensorflow

An Open Source Machine Learning Framework for Everyone
https://tensorflow.org
Apache License 2.0
185.51k stars 74.17k forks source link

android example with a new model which has a large .pb file(180mb) #5111

Closed grayscaler closed 7 years ago

grayscaler commented 7 years ago

hi guys i tried to run the android example with a new model which has a large .pb file(180mb), and i get the error.

10-21 15:32:02.172 19751-19816/org.tensorflow.demo A/native: jni_utils.cc:128 Check failed: message->ParseFromArray(memory, data_size) 10-21 15:32:02.172 19751-19816/org.tensorflow.demo A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 19816 (ImageListener)

i thought it's a limitation of reading file with native code. does anyone get the same problem or have a way to deal it? thank for your time.

asimshankar commented 7 years ago

I suspect this has to do with the 64MB limit in protobufs

@petewarden @andrewharp @keveman may have suggestions

grayscaler commented 7 years ago

@asimshankar thanks for your help. i found the solution. .pb file will be compressed when it is bigger than some size, this caused model parsing to fail. I disabled the compression for .pb files in gradle.

andrewharp commented 7 years ago

For Bazel builds, nocompress_extensions = [".pb",], can be added to the android_binary target to effect a similar workaround.

The code should be able to gracefully handle larger compressed PBs, though; reopening issue to track.

andrewharp commented 7 years ago

This issue was rendered obselete by 1a9769dc79fdd27c347633df210ff64f48de8d07, which replaces the native PB loading code with the TF Java API equivalent.