在这节课中,你将把你学到的神经网络的知识,借助TensorFlow ,一个 Google 开源的深度学习框架,应用在真实的数据集中。
你将用 TensorFlow 来辨别 notMNIST 数据集。他是一个英文字母 A 到 J 的数据集,下面是一些示例。
你的目标是根据图片,自动识别里面的字母。你在自己电脑上就可以完成这个项目。不过首先,你要安装 TensorFlow !
安装
跟往常一样,我们用 Conda 来安装 TensorFlow。你也许已经有过 TensorFlow 的环境,但确认一下你有所有必要的包。
OS X 或 Linux
运行下列命令来配置开发环境
conda create -n tensorflow python=3.5
source activate tensorflow
conda install pandas matplotlib jupyter notebook scipy scikit-learn
conda install -c conda-forge tensorflow
Windows
Windows系统,在你的console 或者 Anaconda shell 界面,运行
conda create -n tensorflow python=3.5
activate tensorflow
conda install pandas matplotlib jupyter notebook scipy scikit-learn
conda install -c conda-forge tensorflow
Hello, world!
在你 Python console 下运行下列代码检测 TensorFlow 是否正常安装。如果安装正确,Console 会打印出 "Hello, world!" 。现在还不需要理解它做了什么,你会在下一节学到。
import tensorflow as tf
# Create TensorFlow object called tensor
hello_constant = tf.constant('Hello World!')
with tf.Session() as sess:
# Run the tf.constant operation in the session
output = sess.run(hello_constant)
print(output)