tensorflow / tensorflow/models

Clone a loaded object detection model in memory fails

Open
#9,576 1 comment 0 reactions 3 assignees View on GitHub

@pkulzc is already working on this.

Since Dec 23, 2020.

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.

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

1. The entire URL of the file you are using

https://github.com/tensorflow/models.git

2. Describe the bug

Trained my model from ssd_mobilenet_v2_320x320_coco17_tpu-8 as base, saved it to disk with exporter_main_v2.py. After loading the model with detect_fn = tf.saved_model.load(model_dir) I want to clone the python object with tf.keras.models.clone_model(detect_fn). This fails with Expected model argument to be a Model instance, got ', <tensorflow.python.saved_model.load.Loader._recreate_base_user_object.._UserObject object at 0x7f7195138e80>

3. Steps to reproduce

See 2.

4. Expected behavior

Get a in-memory clone of the model

5. Additional context

Expected model argument to be a Model instance, got ', <tensorflow.python.saved_model.load.Loader._recreate_base_user_object.._UserObject object at 0x7f7195138e80>

6. System information

  • Ubuntu 18.04
  • TensorFlow installed from binary
  • TensorFlow version: v2.4.0-rc4-71-g582c8d236cb 2.4.0
  • Python version: 3.6.9
  • Bazel version (if compiling from source): na
  • GCC/Compiler version (if compiling from source): na
  • CUDA/cuDNN version: na
  • GPU model and memory: AMD

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.