简体   繁体   English

从Tensorflow Object Detection API动物园模型导出错误的冻结图形

[英]Wrong frozen graph export from Tensorflow Object Detection API zoo model

I am working with Mask R CNN model using Tensorflow Object Detection API project ( https://github.com/tensorflow/models/tree/r1.12.0/research/object_detection ). 我正在使用Tensorflow Object Detection API项目( https://github.com/tensorflow/models/tree/r1.12.0/research/object_detection )使用Mask R CNN模型。 I stick to r1.12.0 release (but this is not a must but I do not think it influences my problem.) My plan is to modify some "static" parts of the model and export it again into the frozen graph format. 我坚持使用r1.12.0版本(但这不是必须的,但我不认为它会影响我的问题。)我的计划是修改模型的某些“静态”部分并将其再次导出为冻结图形格式。

As a first step, I meant to regenerate the frozen graph from the checkpoints file and the pipeline.config using export_inference_graph.py script ( https://github.com/tensorflow/models/blob/r1.12.0/research/object_detection/export_inference_graph.py ). 作为第一步,我打算使用export_inference_graph.py脚本从checkpoints文件和pipeline.config重新生成冻结图( https://github.com/tensorflow/models/blob/r1.12.0/research/object_detection/export_inference_graph .py )。 I downloaded the inception V2 model ( http://download.tensorflow.org/models/object_detection/mask_rcnn_inception_v2_coco_2018_01_28.tar.gz ) and executed the script using Tensorflow 1.12.0. 我下载了初始V2模型( http://download.tensorflow.org/models/object_detection/mask_rcnn_inception_v2_coco_2018_01_28.tar.gz )并使用Tensorflow 1.12.0执行了该脚本。 It does the job and creates a frozen graph. 它完成了工作并创建了冻结图。

The issue is that if I compare the original frozen graph with the generated one, they are different. 问题是如果我将原始的冻结图与生成的图进行比较,它们就不同了。 If I visualize them using Tensorboard there are obvious differences between them. 如果我使用Tensorboard对它们进行可视化,则它们之间存在明显的差异。 Some nodes are missing, some nodes are different etc. 一些节点丢失,某些节点不同等等。

I have tried other models as well (normal Fast R CNN), I had the same issue always. 我也尝试过其他模型(正常的Fast R CNN),但始终遇到相同的问题。

How can this be? 怎么会这样? How should I use the checkpoint files and the pipeline.config file to regenerate exactly the same frozen graph which is originally attached? 我应该如何使用检查点文件和pipeline.config文件重新生成最初附加的完全相同的冻结图?

As far as I understood it, your steps of generating frozen graph is fine. 据我了解,您生成冻结图的步骤很好。

One thing about frozen graph is that optimizations can be performed on it, for example fuse some layers together. 关于冻结图的一件事是可以对其执行优化,例如将一些层融合在一起。 Optimization may cause your frozen graph to look different as different optimizations could be performed or non at all. 优化可能会导致冻结的图看起来不同,因为可以执行或根本不执行不同的优化。 But different frozen graph does not necessarily mean the graph is wrongly generated. 但是不同的冻结图并不一定意味着图形被错误地生成。

Here is a tutorial on optimizations on frozen graph to make a faster serving model. 是有关冻结图优化的教程,以创建更快的投放模型。 Just listed here to show that there are several optimization options. 仅在此处列出以显示有几个优化选项。

Here What does freezing a graph in TensorFlow mean? 冻结TensorFlow中的图形意味着什么? is another problem that is also kind of related to this problem. 是另一个与此问题相关的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 tensorflow对象检测API训练和导出图 - tensorflow object detection API training and export graph 将TF2 Object检测API model转换为冻结图 - Converting TF2 Object detection API model to frozen graph 从冻结模型创建可训练的Tensorflow图 - Create Trainable Tensorflow graph from frozen model TensorFlow 对象检测 API:导出进程被终止 - TensorFlow Object Detection API: Export process killed 无法导出 TensorFlow Object 检测 API - Can't export TensorFlow Object Detection API 当 num_of_stages: 1(仅限 RPN)在 tensorflow 对象检测 api 中时,导出推理图会出错 - export inference graph gives error when num_of_stages: 1 (RPN only) in tensorflow object-detection api TensorFlow 2 Object 检测 API ZA559B87068921EEC05086CE5485E978 评估 - TensorFlow 2 Object Detection API Model Evaluation 如何将基于 tensorflow 构建的修改模型(用于迁移学习,in.ckpt 格式)导出到冻结图(.pb 文件) - How to export a modified model(used for transfer learning, in .ckpt format) built on tensorflow to a frozen graph(.pb file) TensorFlow:有没有办法将冻结图转换为检查点模型? - TensorFlow: Is there a way to convert a frozen graph into a checkpoint model? AttributeError:“模块”对象没有属性“ from_tensorflow_frozen_model” - AttributeError: 'module' object has no attribute 'from_tensorflow_frozen_model'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM