ICode9

精准搜索请尝试: 精确搜索
  • tensorflow2 keras 调用官方提供的模型训练分类与测试2020-03-30 20:52:36

    本任务为分类分类属性的8个类别。 dict_gender = {'f':0, 'm':1 } dict_age = {'children':0, 'young':1, 'adult':2, 'older':3 } 用的keras的datagen_train.flow_from_directory。 train_generator=datagen_train.flow_from_direc

  • 使用tensorflow2 对股票的信息进行预测2020-03-14 14:45:54

    业余时间学习下深度学习,个人理解就是对已有的数据进行非线性映射,然后再映射的空间内找出数据的特征(个人理解可能不准,请指正)。 源码地址:https://github.com/yu-bo/stock 然后想着找一些数据练习下,网上的教程例子很多,个人想着预测下股票信息,大概的过程如下: 1、使用tushare获取sto

  • tensorflow2使用全连接神经探讨电影评论分类及模型优化2020-03-10 13:38:33

    我们使用的数据集为tesnflow2自带的的电影评论数据集imdb 加载数据集,第一次加载的时候可能要到外网下载数据,比较慢,我放在网盘里,下载链接:https://pan.baidu.com/s/1tq_kO3tlDmwn-CMTCBrpLw 提取码:4r7f 下载后将其拷贝到 data = keras.datasets.imdb #限定读取的单词个数 max_w

  • TensorFlow2学习——图像分类2020-03-03 16:40:07

    文章目录TensorFlow2学习——图像分类导包原始数据数据作图数据划分与标准化构建模型并训练模型评估与预测其他:回调Callback的使用 TensorFlow2学习——图像分类 导包 import matplotlib.pyplot as plt import numpy as np import pandas as pd import tensorflow as tf fro

  • DenseNet学习与tensorflow2实现2020-02-28 18:44:20

    《Densely Connected Convolutional Networks》提出了DenseNet,它用前馈的方式连接每一层与所有其他层,网络的核心结构为如下所示的Dense块,在每一个Dense块中,存在多个Dense层,即下图所示的H1~H4。各Dense层之间彼此均相互连接。 不一定需要在Dense块中对每一个Dense层均直接进

  • Tensorflow2.0学习(1): Tensorflow1与Tensorflow2的简单区别2020-02-24 11:38:35

    实例:1 + 1/2 + 1/2^2 + 1/2^3 + … + 1/2^50 tensorflow1 导包,看版本 import tensorflow as tf print(tf.__version__) 定义变量 x = tf.Variable(0.) y = tf.Variable(1.) 定义计算图 # x = x + y add_op = x.assign(x + y) # y = y / 2 div_op = y.assign(y / 2)

  • tensorflow2.AutoGraph2020-02-06 22:01:00

    1、度娘了“@autograph.convert()” 的相关内容,这应该是 20180719 Google除的新功能,大概的功能是:   “谷歌发布AutoGraph,自动将Python转化为TF图”   “AutoGraph:图的简易控制流程”   等   ZC:搜索到的文章 都只是说出了 新的功能,但是没说 是 版本1 还是 版本2 里面的功

  • tensorflow2.x(一)2020-01-30 21:42:03

    以下代码利用tensorflow2.1中的keras API做了一个简单的模型(简单到输入层和输出层都只有一个神经元),利用这个模型学习出y=2x+2的规律。 from tensorflow import keras model=keras.Sequential([keras.layers.Dense(units=1,input_shape=[1])]) model.compile(optimizer='sg

  • 吴裕雄--天生自然TensorFlow2教程:函数优化实战2020-01-22 11:51:59

    import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D def himmeblau(x): return (x[0]**2 + x[1] - 11)**2 + (x[0] + x[1]**2 - 7)**2 x = np.arange(-6, 6, 0.1) y = np.arange(-6, 6, 0.1) print(f'x_shape: {x.shap

  • 吴裕雄--天生自然TensorFlow2教程:激活函数及其梯度2020-01-22 11:00:40

                    import tensorflow as tf a = tf.linspace(-10., 10., 10) a with tf.GradientTape() as tape: tape.watch(a) y = tf.sigmoid(a) grads = tape.gradient(y, [a]) grads             a = tf.linspace(-5.,5.,10) a tf.tanh(a)

  • 吴裕雄--天生自然TensorFlow2教程:梯度下降简介2020-01-22 10:55:40

        import tensorflow as tf w = tf.constant(1.) x = tf.constant(2.) y = x * w with tf.GradientTape() as tape: tape.watch([w]) y2 = x * w grad1 = tape.gradient(y, [w]) grad1 with tf.GradientTape() as tape: tape.watch([w]) y2 = x * w

  • 吴裕雄--天生自然TensorFlow2教程:误差计算2020-01-21 14:01:42

    import tensorflow as tf y = tf.constant([1, 2, 3, 0, 2]) y = tf.one_hot(y, depth=4) # max_label=3种 y = tf.cast(y, dtype=tf.float32) out = tf.random.normal([5, 4]) out loss1 = tf.reduce_mean(tf.square(y - out)) loss1 loss2 = tf.square(tf.norm(y - ou

  • 吴裕雄--天生自然TensorFlow2教程:输出方式2020-01-21 13:51:39

    sigmoid     out' = sigmoid(out) # 把输出值压缩在0-1 import tensorflow as tf a = tf.linspace(-6., 6, 10) a tf.sigmoid(a) x = tf.random.normal([1, 28, 28]) * 5 tf.reduce_min(x), tf.reduce_max(x) x = tf.sigmoid(x) tf.reduce_min(x), tf.reduce_max(x) a

  • 吴裕雄--天生自然TensorFlow2教程:数据加载2020-01-02 21:04:15

    import tensorflow as tffrom tensorflow import keras# train: 60k | test: 10k(x, y), (x_test, y_test) = keras.datasets.mnist.load_data()x.shapey.shape # 0纯黑、255纯白x.min(), x.max(), x.mean() x_test.shape, y_test.shape # 0-9有10种分类结果y_onehot = tf.

  • 吴裕雄--天生自然TensorFlow2教程:张量排序2020-01-02 15:53:56

    import tensorflow as tfa = tf.random.shuffle(tf.range(5))a tf.sort(a, direction='DESCENDING') # 返回索引tf.argsort(a, direction='DESCENDING') idx = tf.argsort(a, direction='DESCENDING')tf.gather(a, idx) idx = tf.argsort(a

  • 吴裕雄--天生自然TensorFlow2教程:前向传播(张量)- 实战2019-12-31 15:02:50

    手写数字识别流程MNIST手写数字集7000*10张图片60k张图片训练,10k张图片测试每张图片是28*28,如果是彩色图片是28*28*30-255表示图片的灰度值,0表示纯白,255表示纯黑打平28*28的矩阵,得到28*28=784的向量对于b张图片得到[b,784];然后对于b张图片可以给定编码把上述的普通编码给定成独

  • 《TensorFlow2深度学习》学习笔记(二)手动搭建并测试简单神经网络2019-11-23 15:54:02

    本实验使用了mnist.npz数据集,可以使用在线方式导入,但是我在下载过程中老是因为网络原因被打断,因此使用离线方式导入,离线包已传至github方便大家下载: https://github.com/guangfuhao/Deeplearning/blob/master/mnist.npz (mnist.npz下载)  

  • tensorflow2 层模板2019-10-27 14:03:38

    线性回归 #建立模型结构model = tf.keras.Sequential()#添加层,第一个参数是输出神经元个数,第二个参数表示(输入特征,输入训练数量)model.add(tf.keras.layers.Dense(1,input_shape=(1,)))#查看网络层结构model.summary() #编译,参数分别是优化方法,损失函数model.compile(optimizer=

  • TensorFlow2教程19:LSTM和GRU2019-09-06 16:53:42

      1.导入数据   num_words = 30000   maxlen = 200   (x_train, y_train), (x_test, y_test) = keras.datasets.imdb.load_data(num_words=num_words)   print(x_train.shape, ' ', y_train.shape)   print(x_test.shape, ' ', y_test.shape)   x_train = ker

  • TensorFlow2 Win2019-08-11 17:04:51

    直接运行: pip install tensorflow==2.0.0b1 -i https://pypi.tuna.tsinghua.edu.cn/simple 报错1: tb-nightly 1.14.0a20190603 has requirement setuptools>=41.0.0, but you'll have setuptools 39.0.1 which is incompatible. setuptools版本过低,需要先更新, pip install -

  • TensorFlow2-创建 Tensor2019-05-09 18:39:59

    目录 TensorFlow2-创建 Tensor numpy, list numpy list zeros, ones, fill zeros ones fill random 打乱idx后,a和b的索引不变 constant loss计算 无bias的loss TensorFlow2-创建 Tensor * from numpy, list * zeros, ones, fill * random # if big dimension, random in

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有