
Tensorflow
fwu11
这个作者很懒,什么都没留下…
展开
-
TFhub、Keras预训练模型进行推理简单示例
导入预训练模型进行推理。以mobilenetv2 Imagenet预训练模型为例:import tensorflow as tfimport tensorflow_hub as hubimport numpy as np# 加载图片image = tf.image.decode_image(tf.io.read_file('/path/to/your/image'),channels=3)image = tf.image.resize(image,(224,224))image = tf原创 2020-11-30 10:36:34 · 1285 阅读 · 1 评论 -
TF hub模型保存成savedmodel格式
以mobilenet v2为例import tensorflow as tfimport tensorflow_hub as hubIMAGE_SHAPE = (224, 224)m = tf.keras.Sequential([ hub.KerasLayer("https://hub.tensorflow.google.cn/google/tf2-preview/mobilenet_v2/classification/4", input_shape=IMAGE_SHAPE+(3,),原创 2020-11-24 23:29:09 · 441 阅读 · 0 评论 -
Tensorflow saved_model.pb 文件转成 saved_model.pbtxt文件
想把saved_model.pb里的metagraph转成可读。代码如下:#将.pb文件load到session中,导出到.pbtxt可视化import tensorflow as tffrom tensorflow.python.platform import gfiletf.compat.v1.disable_eager_execution()model = './savedmodel/VGG16/1/'export_dir = './test/'with tf.compat.v1.原创 2020-11-24 23:23:24 · 2853 阅读 · 2 评论