我正在尝试量化我的模型(特别是从模型动物园下载的可可上的prestrained fast_rcnn_inception_v2),以期加快推理时间。
我使用here中的以下代码:
public function getPositionAttribute()
{
return static::query()->where($this->getKeyName(), '<=', $this->getKey())->count() + 1;
}
Models目录没有import tensorflow as tf
converter = tf.lite.TocoConverter.from_saved_model(saved_model_dir)
converter.post_training_quantize = True
tflite_quantized_model = converter.convert()
open("quantized_model.tflite", "wb").write(tflite_quantized_model)
文件。所以我将saved_model.pb
重命名为frozen_inference_graph.pb
。
运行上面的代码会产生以下运行时错误:
saved_model.pb
这是什么意思,我该怎么办?
答案 0 :(得分:0)
请参阅this issue。他们似乎和您有同样的问题。
此问题可能已在Tensorflow的最新版本中得到解决(与此同时,标签可能已从“服务”更改为“服务”)。
答案 1 :(得分:0)
您应该使用tf.saved_model.simple_save保存pb模型。