Giter VIP home page Giter VIP logo

tensorflow-learning's Introduction

TensorFlow学习记录

(1) 前言

主要来源和参考的资料为:炼数成金视频《深度学习框架TensorFlow学习与应用》以及补充了一些网上的博文内容。

视频目录:

第 1周 Tensorflow简介,Anaconda安装,Tensorflow的CPU版本安装
第 2周 Tensorflow的基础使用,包括对图(graphs),会话(session),张量(tensor),变量(Variable)的一些解释和操作
第 3周 Tensorflow线性回归以及分类的简单使用
第 4周 softmax,交叉熵(cross-entropy),dropout以及Tensorflow中各种优化器的介绍
第 5周 卷积神经网络CNN的讲解,以及用CNN解决MNIST分类问题
第 6周 使用Tensorboard进行结构可视化,以及网络运算过程可视化
第 7周 递归神经网络LSTM的讲解,以及LSTM网络的使用
第 8周 保存和载入模型,使用Google的图像识别网络inception-v3进行图像识别
第 9周 Tensorflow的GPU版本安装。设计自己的网络模型,并训练自己的网络模型进行图像识别
第10周 使用Tensorflow进行验证码识别
第11周 Tensorflow在NLP中的使用(一)
第12周 Tensorflow在NLP中的使用(二)

说明:实际第 5 周讲的是 Tensorborad 结构可视化,第 6 周讲的是 CNN,下载链接里的文件夹顺序,我已修正。

(1) 在线观看:

(2) 下载:

  • 《深度学习框架Tensorflow学习与应用》(含视频+代码+课件,视频总时长:13小时31分钟) 【百度网盘下载 密码: 1a8j】
  • 《深度学习框架Tensorflow学习与应用[只有videos-720p]》(该份资料只有视频文件) 【 百度网盘下载 密码: i3e2】

其他学习视频(觉得有必要可以看看~):

(3) 相关资料:

(2) 笔记

学习 TensorFlow 之前,先学习掌握以下内容,包括 Python 基础、Anconada 安装等等:

《深度学习框架Tensorflow学习与应用》笔记索引(其中也有补充一些其他地方学习到的内容):

补充笔记:

📛 网上博文:

(3) 说明

(1)

在【03-Tensorflow线性回归以及分类的简单使用】中(二)节开始以手写数字识别 MNIST 例子来讲解,关于 MNIST 的内容还可以看看该 README 下面的。

(2)

发现了问题:在【04-softmax,交叉熵(cross-entropy),dropout以及Tensorflow中各种优化器的介绍】中(三)节开始的代码4-1交叉熵.py,可以注意到如下代码:

# 创建一个简单的神经网络
W = tf.Variable(tf.zeros([784, 10]))
b = tf.Variable(tf.zeros([10]))
prediction = tf.nn.softmax(tf.matmul(x, W) + b)

# 二次代价函数
# loss = tf.reduce_mean(tf.square(y-prediction))
# 这里使用对数释然代价函数tf.nn.softmax_cross_entropy_with_logits()来表示跟softmax搭配使用的交叉熵
loss = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(labels=y, logits=prediction))

我觉得这里是有问题的,问题在哪呢?先看【TensorFlow】tf.nn.softmax_cross_entropy_with_logits的用法该文,可以了解到 tf.nn.softmax_cross_entropy_with_logits 函数的 logits 参数传入的是未经过 softmax 的 label 值。

import tensorflow as tf  

#our NN's output  
logits=tf.constant([[1.0,2.0,3.0],[1.0,2.0,3.0],[1.0,2.0,3.0]])  
#step1:do softmax  
y=tf.nn.softmax(logits)  
#true label  
y_=tf.constant([[0.0,0.0,1.0],[0.0,0.0,1.0],[0.0,0.0,1.0]])  
#step2:do cross_entropy  
cross_entropy = -tf.reduce_sum(y_*tf.log(y))  

两步可以用这一步代替:

#do cross_entropy just one step  
cross_entropy2=tf.reduce_sum(tf.nn.softmax_cross_entropy_with_logits(logits, y_))#dont forget tf.reduce_sum()!! 

prediction = tf.nn.softmax(tf.matmul(x, W) + b)这里的 prediction 已经经历了一次 softmax,然后又经过了 tf.nn.softmax_cross_entropy_with_logits 函数,这相当于经过两个 softmax 了(虽然大的值的概率值还是越大,这点上倒是没影响。)

关于 softmax_cross_entropy_with_logits,这篇文章也有提到【TensorFlow入门】:

这个函数内部自动计算 softmax 函数,然后在计算代价损失,所以logits必须是未经 softmax 处理过的函数,否则会造成错误。

注1:好像后面的笔记中程序代码都是这样的,我觉得可能视频讲解老师没注意到这点问题。另外,在该文 06-卷积神经网络CNN的讲解,以及用CNN解决MNIST分类问题 的笔记中,我也记录了该问题。

注2:对 softmax、softmax loss、cross entropy 不了解,推荐看改完:卷积神经网络系列之softmax,softmax loss和cross entropy的讲解,可以说讲解的非常好。【荐】

另外,关于在 TensorFlow 中有哪些损失函数的实现呢?看看该文:tensorflow API:tf.nn.softmax_cross_entropy_with_logits()等各种损失函数

(3)

在【 05-使用Tensorboard进行结构可视化,以及网络运算过程可视化】该文可以学习到:

  • 用例子演示如何使结构的可视化
  • 参数细节的可视化,绘制各个参数变化情况
  • 补充内容:可视化工具 TensorBoard 更多使用和细节★(这部分会不断补充和更新的…)

(4)

在【06-卷积神经网络CNN的讲解,以及用CNN解决MNIST分类问题】该文可以学习到:

  • 卷积神经网络 CNN(包括局部感受野、权值共享、卷积、池化)
  • 补充内容:参数数量的计算(以 LeNet-5 为例子)
  • 补充内容:TensorFlow 中的 Padding 到底是怎样的?★ (这个认真看下~)
  • 补充内容:TensorFlow 中的 Summary 的用法

(4) MNIST

(5) TF快速入门总结

参考「机器之心」编译文章:

tensorflow-learning's People

Contributors

jayboxyz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.