1

在此目录中的output_saved_model_dir下面我有一个名为final_model_gender_classification_gpu0_int8.trt的 trt 文件

output_saved_model_dir='/home/cocoslabs/Downloads/age_gender_trt'
saved_model_loaded = tf.saved_model.load(output_saved_model_dir, tags=[tag_constants.SERVING])

当我运行上面的脚本时,它显示错误如下:

File "test.py", line 7, in <module>
    saved_model_loaded = tf.saved_model.load(output_saved_model_dir, tags=[tag_constants.SERVING])
  File "/home/cocoslabs/deepstream_docker/venv/lib/python3.6/site-packages/tensorflow_core/python/saved_model/load.py", line 528, in load
    return load_internal(export_dir, tags)
  File "/home/cocoslabs/deepstream_docker/venv/lib/python3.6/site-packages/tensorflow_core/python/saved_model/load.py", line 537, in load_internal
    saved_model_proto = loader_impl.parse_saved_model(export_dir)
  File "/home/cocoslabs/deepstream_docker/venv/lib/python3.6/site-packages/tensorflow_core/python/saved_model/loader_impl.py", line 83, in parse_saved_model
    constants.SAVED_MODEL_FILENAME_PB))
OSError: SavedModel file does not exist at: /home/cocoslabs/Downloads/age_gender_trt/{saved_model.pbtxt|saved_model.pb}

从上面的错误我理解的是 tf.saved_model.load() 只接受 .pb 或 .pbtxt 文件。这样对吗 ?但是根据此链接加载并运行测试一个 .trt 模型,他们所说的 tf.saved_model.load() 函数将接受 .trt 文件。帮我纠正这个错误。谢谢你。

4

0 回答 0