- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我训练了一个 Faster R-CNN来自 TF Object Detection API并使用 export_inference_graph.py
保存它.我有以下目录结构:
weights
|-checkpoint
|-frozen_inference_graph.pb
|-model.ckpt-data-00000-of-00001
|-model.ckpt.index
|-model.ckpt.meta
|-pipeline.config
|-saved_model
|--saved_model.pb
|--variables
我想分别加载模型的第一阶段和第二阶段。也就是说,我想要以下两个模型:
包含范围 FirstStageFeatureExtractor
中每个变量的模型,它接受图像(或序列化的 tf.data.Example
)作为输入,并输出特征图和 RPN 提案。
包含范围 SecondStageFeatureExtractor
和 SecondStageBoxPredictor
中的每个变量的模型,它接受特征图和 RPN 建议作为输入,并输出边界框预测和分数.
我基本上希望能够调用_predict_first_stage和 _predict_second_stage分别在我的输入数据上。
目前我只知道如何加载整个模型:
model = tf.saved_model.load("weights/saved_model")
model = model.signatures["serving_default"]
2020 年 6 月 7 日编辑:对于模型 1,我可以提取 detection_features
,如 this question ,但我仍然不确定模型 2。
最佳答案
这在对象检测仅与 TF1 兼容时更加困难,但现在在 TF2 中非常简单。 this colab. 中有一个很好的例子
from object_detection.builders import model_builder
from object_detection.utils import config_util
# Set path names
model_name = 'centernet_hg104_512x512_kpts_coco17_tpu-32'
pipeline_config = os.path.join('models/research/object_detection/configs/tf2/',
model_name + '.config')
model_dir = 'models/research/object_detection/test_data/checkpoint/'
# Load pipeline config and build a detection model
configs = config_util.get_configs_from_pipeline_file(pipeline_config)
model_config = configs['model']
detection_model = model_builder.build(model_config=model_config,
is_training=False)
# Restore checkpoint
ckpt = tf.compat.v2.train.Checkpoint(
model=detection_model)
ckpt.restore(os.path.join(model_dir, 'ckpt-0')).expect_partial()
从这里可以调用 detection_model.predict()
和相关方法,例如 _predict_first_stage
和 _predict_second_stage
。
关于tensorflow - 如何在 TF Object Detection 2.0 中分别加载已保存的 Faster R-CNN 的两个阶段?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62227717/
Strassen 的算法在多项式上比 n 次方正则矩阵乘法快。 “多项式更快”是什么意思? 最佳答案 您的问题与“复杂性”的理论概念有关。例如,据说正则矩阵乘法的复杂度为 O(n^3)。这意味着随着维
就目前情况而言,这个问题不太适合我们的问答形式。我们希望答案得到事实、引用资料或专业知识的支持,但这个问题可能会引发辩论、争论、民意调查或扩展讨论。如果您觉得这个问题可以改进并可能重新开放,visit
假设我有两个 PHP 语句: echo "foo"."bar" echo "foo", "bar" 注意连接字符串的不同方式 - 使用 . 或 ,. 我意识到这两种方法之间的实际区别,使用 , 为关键
我有一个 RGB 图像,并尝试将 RGB 上的每个像素设置为黑色,其中相应的 alpha 像素也为黑色。所以基本上我试图将 Alpha“烘焙”到我的 RGB 中。我已经尝试使用 PIL 像素访问对象、
可能这个问题以前已经以许多不同的方式回答过很多次了。然而,我一直在寻找更具体的东西。通用词典,我相信比哈希表更快,因为它们不需要经历装箱/拆箱的过程。 但是,哈希表不是经过排序的,这意味着搜索可以更快
以这种方式加入给定的选择会更快吗 select ... join table1 on condition1 join table2 on condition2 然后这个 select ... join
我观看了演讲并阅读了博客文章,但我仍然不确定...这是为什么 template struct conditional { template using f = T; }; template<> str
我想知道用离散数据集编码的二维图形。对我来说,似乎由于计算机以离散集合运行,所以对图形做同样的事情也许更有意义。 例如,与其让一条线由两个 vector 表示,让计算机整理出像素配置,然后必须用代数方
我正在开发一个将大量数据写入磁盘的 C++ 程序。以下函数对数据进行 gzip 压缩并将其写入文件。压缩数据约为100GB。压缩并写出数据的函数如下: void constructSNVFastqD
我最近遇到了这段SQL: SELECT members.id FROM members, members_to_groups WHERE members.id = members_to_groups.
所以我一直在研究 pthreads,特别是尝试计算两个矩阵的乘积。我的代码非常困惑,因为它本应是我自己的一个快速有趣的小项目,但我使用的线程理论非常类似于: #include #include #
我看到了被选中的answer对此post . 我很惊讶 (x & 255) == (x % 256) 如果 x 是无符号整数,我想知道总是替换 % 是否有意义& in x % n for n = 2^
Anaconda是什么? Anaconda 是一个开源的 Python 发行版本,主要面向数据科学、机器学习和数据分析等领域。它不仅包含了 Python 解释器本身,更重要的是集成了大量的用于科学计
我正在使用Ubuntu 14.04操作系统的g2.8xlarge EC-2实例上启用cuDNN的情况下运行py-faster-rcnn。一切都已编译,似乎工作正常。我通过以下方式登录到远程实例: ss
要求用户输入的简单程序可以使用 datainputstream 或扫描仪。哪个会更快? Datainputstream 是二进制的,所以它可能更快?有意见吗?我只是很好奇,因为我正在构建一个程序,我希
我正在 INRIA Person 数据集上训练 Faster-RCNN(VGG-16 架构)。我接受了 180,000 个训练步骤的训练。但是当我评估网络时,它会用相同的图像给出不同的结果。以下是图片
我是 python 新手,我为 Hackerrank 问题提交了此代码 Arrays and Simple Queries ,但对于大量测试用例,程序“由于超时而终止”。我怎样才能提高效率? 我已将主
如果将程序分成头文件和源文件,如果提供给智能编译管理器,可能会受益于更快的编译,这就是我正在研究的内容。 理论工作的意愿:为每个源文件创建一个线程并一次将每个源文件编译成目标文件。然后将这些目标文件链
方法一: SELECT * FROM `wordpressusers` WHERE user_login='user10000001' PhpMyadmin 的结果: 方法2: SELECT user
据我所知set.add使用FastFloat的equals方法 对我来说重要的只是点后的前两位数(!!!),所以在 equals 方法中我使用 Math.abs() >= 0.001 来使 equal
我是一名优秀的程序员,十分优秀!