object_detection/export_inference_graph.py crashes when exporting fine tuned ssd model.
System information
-
What is the top-level directory of the model you are using:
research/object_detection -
Have I written custom code (as opposed to using a stock example script provided in TensorFlow): No
-
OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu 14.04 LTS
-
TensorFlow installed from (source or binary): binary
-
TensorFlow version (use command below): 1.2.1
-
Bazel version (if compiling from source): n/a
-
CUDA/cuDNN version: cuda-8.0
-
GPU model and memory:
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 381.22 Driver Version: 381.22 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GeForce GTX 1080 Off | 0000:01:00.0 On | N/A |
| 34% 53C P0 42W / 180W | 1903MiB / 8112MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
| 1 GeForce GTX 1080 Off | 0000:07:00.0 Off | N/A |
| 27% 38C P0 39W / 180W | 2MiB / 8114MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
- Exact command to reproduce: Extract the linked tar ball, which contains the first (iteration 0) checkpoint of my fine tune process. Then export the model by: `python object_detection/export_inference_graph.py --input_type image_tensor --pipeline_config_path /media/jpu/Data11/tf-od/cruise-small/models/run_2/local.config --trained_checkpoint_prefix ${EXTRACTED_DIR)/model.ckpt-0 --output_directory ${OUTPUT_DIR}
Describe the problem
The script crashes.
Source code / logs
stack trace:
#0 0x00007f40770e0b84 in tensorflow::TensorShape::end() const () from /usr/local/lib/python2.7/dist-packages/tensorflow/python/_pywrap_tensorflow_internal.so
(gdb) bt
#0 0x00007f40770e0b84 in tensorflow::TensorShape::end() const () from /usr/local/lib/python2.7/dist-packages/tensorflow/python/_pywrap_tensorflow_internal.so
#1 0x00007f40770e2f17 in tensorflow::TensorShape::AsProto(tensorflow::TensorShapeProto*) const ()
from /usr/local/lib/python2.7/dist-packages/tensorflow/python/_pywrap_tensorflow_internal.so
#2 0x00007f4076e3bab8 in tensorflow::grappler::ConstantFolding::CreateNodeDef(std::string const&, tensorflow::TensorValue const&) ()
from /usr/local/lib/python2.7/dist-packages/tensorflow/python/_pywrap_tensorflow_internal.so
#3 0x00007f4076e3c92a in tensorflow::grappler::ConstantFolding::EvaluateOneFoldable(tensorflow::NodeDef const&, std::vector<tensorflow::NodeDef, std::allocator<tensorflow::NodeDef> >*) () from /usr/local/lib/python2.7/dist-packages/tensorflow/python/_pywrap_tensorflow_internal.so
#4 0x00007f4076e3cd74 in tensorflow::grappler::ConstantFolding::FoldNode(tensorflow::NodeDef const&, tensorflow::GraphDef*) ()
from /usr/local/lib/python2.7/dist-packages/tensorflow/python/_pywrap_tensorflow_internal.so
#5 0x00007f4076e3d481 in tensorflow::grappler::ConstantFolding::FoldGraph(tensorflow::GraphDef*) ()
from /usr/local/lib/python2.7/dist-packages/tensorflow/python/_pywrap_tensorflow_internal.so
#6 0x00007f4076e3dbf6 in tensorflow::grappler::ConstantFolding::Optimize(tensorflow::grappler::Cluster*, tensorflow::grappler::GrapplerItem const&, tensorflow::GraphDef*) () from /usr/local/lib/python2.7/dist-packages/tensorflow/python/_pywrap_tensorflow_internal.so
#7 0x00007f4076e33213 in tensorflow::grappler::MetaOptimizer::Optimize(tensorflow::grappler::Cluster*, tensorflow::grappler::GrapplerItem const&, tensorflow::GraphDef*) () from /usr/local/lib/python2.7/dist-packages/tensorflow/python/_pywrap_tensorflow_internal.so
#8 0x00007f4076e349f8 in tensorflow::grappler::RunMetaOptimizer(tensorflow::grappler::GrapplerItem const&, tensorflow::RewriterConfig const&, tensorflow::grappler---Type <return> to continue, or q <return> to quit---
::Cluster*, tensorflow::GraphDef*) () from /usr/local/lib/python2.7/dist-packages/tensorflow/python/_pywrap_tensorflow_internal.so
#9 0x00007f4076e17bda in tensorflow::SimpleGraphExecutionState::InitBaseGraph(tensorflow::BuildGraphOptions const&) ()
from /usr/local/lib/python2.7/dist-packages/tensorflow/python/_pywrap_tensorflow_internal.so
#10 0x00007f4076e18a9c in tensorflow::SimpleGraphExecutionState::MakeForBaseGraph(tensorflow::GraphDef*, tensorflow::SimpleGraphExecutionStateOptions const&, std::unique_ptr<tensorflow::SimpleGraphExecutionState, std::default_delete<tensorflow::SimpleGraphExecutionState> >*) ()
from /usr/local/lib/python2.7/dist-packages/tensorflow/python/_pywrap_tensorflow_internal.so
#11 0x00007f4076c5cf91 in tensorflow::DirectSession::MaybeInitializeExecutionState(tensorflow::GraphDef const&, bool*) ()
from /usr/local/lib/python2.7/dist-packages/tensorflow/python/_pywrap_tensorflow_internal.so
#12 0x00007f4076c5d098 in tensorflow::DirectSession::ExtendLocked(tensorflow::GraphDef const&) ()
from /usr/local/lib/python2.7/dist-packages/tensorflow/python/_pywrap_tensorflow_internal.so
#13 0x00007f4076c5d496 in tensorflow::DirectSession::Extend(tensorflow::GraphDef const&) ()
from /usr/local/lib/python2.7/dist-packages/tensorflow/python/_pywrap_tensorflow_internal.so
#14 0x00007f4075077a80 in TF_ExtendGraph () from /usr/local/lib/python2.7/dist-packages/tensorflow/python/_pywrap_tensorflow_internal.so
#15 0x00007f4074e73937 in _wrap_TF_ExtendGraph () from /usr/local/lib/python2.7/dist-packages/tensorflow/python/_pywrap_tensorflow_internal.so
...
Given the stackbrace, it's not surprising that removing constfold optimization makes the crash go away.
Adding @benoitsteiner @rmlarsen for grappler expertise - do you have any thoughts on this?
It's crashing on TensorShape::end() in TensorShape::AsProto(), which would imply that the shape we're passing in is invalid. I took a quick look at grappler::ConstantFolding::CreateNodeDef, but didn't see anything obvious.
I can't reproduce the problem with the latest codebase. It looks like the best course of action is to avoid folding constant until 1.5 is released.