pfeiKing
安安静静地先稳住
展开
-
TensorFlow2.0 模型部署
文章目录一、拉取TensorFlow Serving镜像二、模型打入TFServing镜像内部1.保存模型为pb格式2.将本地模型copy入镜像3.启动新的带有模型文件的镜像4.gRPC方式远程访问服务一、拉取TensorFlow Serving镜像docker pull tensorflow/serving如果需要gpu版本或者其他版本可以去Docker Hub自行选择。二、模型打入TFServing镜像内部1.保存模型为pb格式首先需要将tensorflow 模型保存为pb格式,通过如下代码原创 2020-12-11 10:13:36 · 1114 阅读 · 0 评论 -
TensorFlow2.0 迁移学习、抽取网络中的层输出
前言一些预训练好的模型,可以被用来当做特征提取器,如何使用成为关键。场景: 基于TF2.0提供的一些预训练好的2D图像分类网络,进行迁移学习。抽取网络basemodel = tf.keras.applications.ResNet50(weights='imagenet', input_shape=(224, 224, 3),原创 2020-10-26 19:40:04 · 1615 阅读 · 2 评论 -
TensorFlow2.0 去除琐碎的WARNING
尝试了网上很多种方法,无效,下面的针对TF2.X有效import tensorflow as tftf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR)原创 2020-10-23 09:32:31 · 1162 阅读 · 4 评论 -
TensorFlow2.0 大数据预处理Pipeline
目录一、为什么需要这样?二、如何解决?三、TF2.0提供的方法1、tf.data.Dataset中的map函数2、TFRecord一、为什么需要这样? 入门的时候,我们非常熟悉MNIST手写数字数据集,我们构建深度神经网络,比如CNN,MLP,LSTM等来训练数据集,我们一次性的加载了所有的数据集,然后不停地迭代训练。 当数据集非常大,大到50GB,100GB的时候,我们显然是不能将所有数据加载到内存空间的,不然的话硬件要求是非常苛刻的。...原创 2020-10-20 20:28:23 · 1219 阅读 · 0 评论 -
TensorFlow2.0 利用TFRecord存取数据集,分批次读取训练
目录头文件一、读取数据集(图片名)二、将数据集图片、标签写入TFRecord三、从TFRecord中读取数据集四、构建模型五、训练模型实验结果头文件import tensorflow as tfimport os一、读取数据集(图片名)data_dir = "D:/dataset/cats_and_dogs_filtered"train_cat_dir = data_dir + "/train/cats/"train_dog_dir = data_.原创 2020-06-23 18:24:31 · 3369 阅读 · 1 评论 -
TensorFlow2.0 分批读取数据集、训练
目录头文件一、处理数据集(dogs vs cats)二、自定义构建模型三、训练模型实验结果头文件import tensorflow as tfimport os一、处理数据集(dogs vs cats)data_dir = "D:/dataset/cats_and_dogs_filtered"train_cat_dir = data_dir + "/train/cats/"train_dog_dir = data_dir + "/train/dogs/".原创 2020-06-23 17:34:13 · 6244 阅读 · 12 评论 -
TensorFlow2.0 自定义层、自定义模块、自定义模型构建
头文件import numpy as npimport tensorflow as tfimport datetimeimport osfrom tensorflow.keras.layers import Dense, Flatten, Conv2D, MaxPool2D1、加载数据集def load_dataset(): mnist = np.load("mnist.npz") return mnist['x_train']/255.0, mnist['y_tr原创 2020-06-15 16:38:58 · 2127 阅读 · 2 评论 -
TensorFlow2.0 TensorBoard的使用
目录头文件1、加载数据集并处理2、构建模型3、训练模型4、查看TensorBoard头文件import numpy as npimport tensorflow as tfimport datetimeimport osfrom tensorflow.keras.layers import Dense, Flatten, Conv2D, MaxPool2Dfrom tensorflow.keras import Model1、加载数据集并处理def .原创 2020-06-12 15:55:31 · 2020 阅读 · 2 评论 -
TensorFlow2.0 自定义损失函数
目录头文件1、数据集加载与处理2、自定义深度神经网络模型3、自损失函数函数式类式实验结果头文件:import numpy as npimport tensorflow as tffrom tensorflow.keras.layers import Dense, Flatten, Conv2D, MaxPool2Dfrom tensorflow.keras import Model1、数据集加载与处理def load_dataset(): .原创 2020-06-12 10:25:37 · 5118 阅读 · 7 评论 -
TensorFlow2.0 自定义评估函数
目录头文件1、数据集获取和处理2、模型构建-采用类自定义模型构建编码方式3、自定义评估函数4、构建深度神经网络的训练模块5、将自定义评估函数应用到Keras的model.fit方式中头文件import numpy as npimport tensorflow as tffrom tensorflow.keras.layers import Dense, Flatten, Conv2D, MaxPool2Dfrom tensorflow.keras import Mo原创 2020-06-11 20:41:50 · 2566 阅读 · 0 评论 -
TensorFlow 构建3D-CNN
本文介绍3D卷积神经网路的原理,以及TensorFlow编码过程,并附有样例代码。原创 2019-12-23 09:58:19 · 3462 阅读 · 3 评论 -
TensorFlow 卷积神经网络CNN
本文介绍卷积神经网络的BP推导过程,以及使用TensorFlow构建简易CNN网络架构,对Fashion-MNIST数据集进行识别预测。原创 2019-12-02 19:15:58 · 712 阅读 · 0 评论 -
MNIST、Fashion-MNIST、SmallNORB数据集下载与读取
介绍MNIST、Fashion-MNIST、SmallNORB数据集以及其加载方式。原创 2019-12-02 10:26:49 · 4245 阅读 · 6 评论 -
TensorFlow 多层感知器
本文介绍如何使用TensorFlow对多层感知器进行编程。原创 2019-12-02 09:50:44 · 551 阅读 · 0 评论 -
TensorFlow 循环神经网络RNN
本章节着重介绍如何使用TensorFlow对各种循环神经网络进行编程。原创 2019-11-28 20:01:53 · 649 阅读 · 0 评论 -
TensorFlow 激活函数、损失函数、梯度下降
本章节主要讲有关神经网络的三个重要部分:激活函数、损失函数、梯度下降。原创 2019-11-26 20:34:41 · 960 阅读 · 0 评论 -
TensorFlow 手写数字识别
使用TensorFlow开发模式构建深度神经网络对MNIST手写数字进行识别预测(附完整代码以及MNIST数据集)。原创 2019-11-25 19:59:39 · 479 阅读 · 0 评论 -
TensorFlow 图的相关操作
本章节介绍TensorFlow中图的相关操作。原创 2019-11-22 19:34:07 · 417 阅读 · 0 评论 -
TensorFlow 共享变量
本章节介绍TensorFlow中共享变量的使用,主要涉及get_variable(), variable_scope(), name_scope()。原创 2019-11-22 16:25:37 · 457 阅读 · 0 评论 -
TensorFlow 多模型加载融合的诸多坑点
TensorFlow在同时加载模型时遇到的问题,以及一些处理办法。原创 2019-11-19 21:48:52 · 962 阅读 · 0 评论 -
TensorFlow 张量操作
本章节介绍TensorFlow基础类型的定义以及对于张量的操作。原创 2019-11-12 19:38:52 · 971 阅读 · 3 评论 -
TensorFlow 编程模型
本章节主要介绍Tensor的编程模式、模型的保存加载以及TensorBoard的可视化原创 2019-11-11 21:47:09 · 388 阅读 · 0 评论 -
TensorFlow 运行机制
本文主要讲解TensorFlow是什么,如何理解TensorFlow的开发模式。原创 2019-11-10 17:15:04 · 609 阅读 · 0 评论 -
TensorFlow 学习目录
了解TensorFlow的开发模式、理解编程模型、张量运算、MLP、CNN、RNN、AutoEncoder、GAN等TensorFlow的编写。...原创 2019-11-09 20:23:33 · 624 阅读 · 0 评论 -
卷积神经网络架构设计
import tensorflow as tfimport get_Datasetx_train, y_train, x_test, y_test = get_Dataset.get_Dataset('mnist')batch_size = 100def weight_init(shape): initial = tf.truncated_normal(shape, stdd...原创 2019-04-25 10:19:12 · 506 阅读 · 0 评论 -
MNIST本地加载,简单神经网络,run练习
import tensorflow as tfimport get_Datasetimport numpy as npx_train, y_train, x_test, y_test = get_Dataset.get_Dataset('mnist')batch_size = 100x = tf.placeholder(tf.float32, shape=[None, 784])...原创 2019-04-25 09:33:54 · 311 阅读 · 0 评论 -
非线性回归
import tensorflow as tfimport numpy as npimport matplotlib.pyplot as pltx_data = np.linspace(-0.5, 0.5, 200)[:, np.newaxis]noise = np.random.normal(0, 0.02, x_data.shape)y_data = x_data**2 + no...原创 2019-04-23 20:27:47 · 344 阅读 · 0 评论 -
tensorflow中的一些操作
乘法:a*b, tf.multiply(a, b)加法:a+b, tf.add(a, b)随机数生成函数:正态分布:tf.random_normal([size]/*张量*/, mean=0.0, stddev=1.0/*标准差*/, dtype=tf.float32, seed=1/*随机种子*/, name=None) tf.random_normal()如果...原创 2019-04-23 19:21:26 · 234 阅读 · 0 评论 -
feed
feed:给占位符赋值import tensorflow as tf#创建占位符号input1 = tf.placeholder(tf.float32)input2 = tf.placeholder(tf.float32)output = input1 * input2with tf.Session() as sess: #feed的数据以字典的形式传入 res =...原创 2019-04-23 19:18:29 · 245 阅读 · 0 评论 -
fetch
fetch中文意思:拿来,请来,tensorflow中对于多个操作进行run。import tensorflow as tfinput1 = tf.placeholder(tf.float32)input2 = tf.placeholder(tf.float32)add = tf.add(input2, input3)mul = tf.multiply(input1, add)wi...原创 2019-04-23 19:16:17 · 219 阅读 · 0 评论 -
tensorflow整体结构流程
import tensorflow as tfG1 = tf.Graph()with G1.as_default(): operator...G2 = tf.Graph()with G2.as_default(): operator...with tf.Session(graph=G1) as sess: res = sess.run()1.设计流程,设计一...原创 2019-04-23 16:30:38 · 527 阅读 · 0 评论