tensorflow / tensorflow/models

Warnings when exporting a fine tuned model from TensorFlow Object Detection API.

Open
#9,491 8 comments 2 reactions 3 assignees View on GitHub

Nobody has claimed this yet.

models:research:odapi type:bug
Dominant language
Python
Stars
77.7k
Forks
44.8k
PR merge metrics
No merged PRs in 30d

Description

Prerequisites

Please answer the following questions for yourself before submitting an issue.

  • [YES ] I am using the latest TensorFlow Model Garden release and TensorFlow 2.
  • [YES ] I am reporting the issue to the correct repository. (Model Garden official or research directory)
  • [YES ] I checked to make sure that this issue has not already been filed.

1. The entire URL of the file you are using

https://github.com/tensorflow/models/tree/master/research/object_detection/exporter_main_v2.py
label_map_github_issue.txt
pipeline_github_issue.txt

2. Describe the bug

When exporting fine-tuned model (EfficientDet and MobileNet), I got Warnings / Info telling me:
WARNING:tensorflow:Skipping full serialization of Keras layer <object_detection.meta_architectures.ssd_meta_arch.SSDMetaArch object at 0x7f28c027c9e8>, because it is not built. W1121 16:00:38.569402 139816344586048 save_impl.py:78] Skipping full serialization of Keras layer <object_detection.meta_architectures.ssd_meta_arch.SSDMetaArch object at 0x7f28c027c9e8>, because it is not built.

Or:
INFO:tensorflow:Unsupported signature for serialization: (([(<tensorflow.python.framework.func_graph.UnknownArgument object at 0x7f27f8886dd8>, TensorSpec(shape=(None, 64, 64, 40), dtype=tf.float32, name='feature_pyramid/0/1')), (<tensorflow.python.framework.func_graph.UnknownArgument object at 0x7f27f8886e48>, TensorSpec(shape=(None, 32, 32, 112), dtype=tf.float32, name='feature_pyramid/1/1')), (<tensorflow.python.framework.func_graph.UnknownArgument object at 0x7f27f8886e10>, TensorSpec(shape=(None, 16, 16, 320), dtype=tf.float32, name='feature_pyramid/2/1'))], False), {}).

I really do not know their meaning. I got these errors in tf2.5 from source and tf2.3 binary.

warning_report_github.txt

3. Steps to reproduce

With trained model: from TensorFlow/models/research/: python object_detection/exporter_main_v2.py --input_type="image_tensor" --pipeline_config_path=$MODEL_DIR/pipeline.config --trained_checkpoint_dir=$MODEL_DIR --output_directory=$OUT

5. Additional context

See attached files.

After using exporter_main_v2.py, I tried to use https://github.com/opencv/opencv/tree/master/samples/dnn/tf_text_graph_efficientdet.py (I had to make some changes in order to ensure the compability with tf2). python path/to/tf_text_graph-efficientdet.py --input=./folder/saved_model.pb --output=./opencv_friendly/ --num_classes=1 it outputs:

2020-11-21 17:06:27.032604: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.10.1
Traceback (most recent call last):
  File "/path_to/dnn_utils/tf_text_graph_common.py", line 312, in write_text_graph
    cv.dnn.writeTextGraph(model_path, output_path)
cv2.error: OpenCV(4.4.0) /tmp/pip-req-build-hw4jq8lf/opencv/modules/dnn/src/tensorflow/tf_io.cpp:42: error: (-2:Unspecified error) FAILED: ReadProtoFromBinaryFile(param_file, param). Failed to parse GraphDef file: ./abo/frozen/saved_model/saved_model.pb in function 'ReadTFNetParamsFromBinaryFileOrDie'


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "tf_text_graph_efficientdet.py", line 236, in <module>
    args.anchor_scale, args.num_classes, args.width, args.height)
  File "tf_text_graph_efficientdet.py", line 49, in createGraph
    write_text_graph(modelPath, outputPath, outNames)
  File "/home/neuro/PycharmProjects/Network/dnn_utils/tf_text_graph_common.py", line 319, in write_text_graph
    graph_def.ParseFromString(f.read())
google.protobuf.message.DecodeError: Error parsing message

6. System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu 18.04
  • Mobile device name if the issue happens on a mobile device: NA
  • TensorFlow installed from (source or binary): Both
  • TensorFlow version (use command below): 2.3 (binary) and 2.5 (source)
  • Python version: 3.6
  • Bazel version (if compiling from source): 3.7.0
  • GCC/Compiler version (if compiling from source):
  • CUDA/cuDNN version: CUDA 11.1 cuDNN
  • GPU model and memory: RTX 2700 8GB

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.