问题概述
之前从tensorflow的C/C++接口中成功调用了saved_model,回味过程的时候看到opencv中的dnn,可以直接调用训练好的模型,但是这个不是saved_model,而是h5模型转换得到的另一种pb模型。
转换代码
另外会打印输入输出层的名字,使用tensorflow调用转换好的pb模型时会用到,但cv2的dnn就用不到了。
import tensorflow as tf
from tensorflow.python.framework.convert_to_constants import convert_variables_to_constants_v2
def