Tensorflow 自定义对象检测在导出的模型上不起作用

Tensorflow 自定义对象检测在导出的模型上不起作用,tensorflow,object-detection-api,Tensorflow,Object Detection Api,我按照上面的说明训练我的定制物体探测器。自定义对象检测只是按照它应该的方式工作,但是在导出和重新加载模型之后,它突然什么也没有检测到 我使用exporter\u main\u v2.py函数导出模型。(就像在教程中一样) 然后我将模型加载到tensorflow中: detection_model = tf.saved_model.load(os.path.join(filepaths['exported_models_path'], 'saved_model')) 当我对测试图像进行预测时,模

我按照上面的说明训练我的定制物体探测器。自定义对象检测只是按照它应该的方式工作,但是在导出和重新加载模型之后,它突然什么也没有检测到

我使用exporter\u main\u v2.py函数导出模型。(就像在教程中一样)

然后我将模型加载到tensorflow中:

detection_model = tf.saved_model.load(os.path.join(filepaths['exported_models_path'], 'saved_model'))
当我对测试图像进行预测时,模型没有检测到任何东西:

prediction = detection_model(test_image)
我尝试了model_builder.build函数来基于pipeline.config文件构建模型,并加载了最新的培训检查点。这很好,检测也很有效。我导出的模型将tf.uint8作为输入签名,但是构建函数返回一个需要tf.float32输入的模型

# build model
configs = config_util.get_configs_from_pipeline_file(filepaths['pipeline_config_path'])
model_config = configs['model']
detection_model = model_builder.build(model_config=model_config, is_training=False)

# load checkpoint
ckpt = tf.train.Checkpoint(model=detection_model)
ckpt.restore(os.path.join(filepaths['trained_checkpoint_path'], 'ckpt-15')).expect_partial()
然后我尝试使用tf.saved_model.load手动恢复检查点:

detection_model = tf.saved_model.load(os.path.join(filepaths['exported_models_path'], 'saved_model'))

# load checkpoint
ckpt = tf.train.Checkpoint(model=detection_model)
ckpt.restore(os.path.join(filepaths['trained_checkpoint_path'], 'ckpt-15')).expect_partial()
这也不行

如前所述,当我使用bild函数构建模型并尝试加载exporter_main_v2.py函数导出的检查点时,检测也不起作用。所以我认为出口有问题

你知道怎么回事吗?为什么构建函数返回的模型需要float32,而保存的模型的默认签名是uint8

提前谢谢

detection_model = tf.saved_model.load(os.path.join(filepaths['exported_models_path'], 'saved_model'))

# load checkpoint
ckpt = tf.train.Checkpoint(model=detection_model)
ckpt.restore(os.path.join(filepaths['trained_checkpoint_path'], 'ckpt-15')).expect_partial()