Win7 tensorflow 入门介绍

Win7 安装 tensorflow

首先需要在系统里安装python3, 这里以安装python3.6.6为例
1. 访问网站 https://www.python.org/downloads/release/python-366/, 选择Windows x86-64 executable installer 下载安装.
2. win7安装python需要注意的是:
+ 可以更改安装目录,其他选项默认即可。
+ 安装完后需要把python安装好的目录加到环境变量中去,比如安装的目录是C:\Python36*, 需要添加*C:\Python36\ScriptsC:\Python36 到环境变量$PATH
3. 安装python后,启动CMD命令窗口,在python 目录下运行pip3 install tensorflow, 该命令将安装tensorflow到python库里。

至此,python3.6+tensorflow已经在win7系统里安装好了,接下来就可以用tensorflow来尝试下深度学习了。

tensorflow简单用例:识别动物

可以用网上已经训练好的数据去识别动物。
1. 去github下载TensorFlow Models: https://github.com/tensorflow/models
2. 将TensorFlow Models解压到Python目录下 例如:C:\Python36\tensorflow_related\models
3. 在model目录下找到classify_image.py文件,一般在*…\models\tutorials\image\imagenet*,拷贝到python目录下。
4. 然后在*C:\Python36\tensorflow_related*创建一个image目录,网上下载一个猫的图片命名为:cat1.jpg
5. 在CMD命令窗口,cd 目录到 *C:\Python36*, 执行如下命令:
python classify_image.py --model_dir C:\Python36\tensorflow_related\models --image_file C:\Python36\tensorflow_related\cat1.jpg
output:
>> Downloading inception-2015-12-05.tgz 100.0%
Successfully downloaded inception-2015-12-05.tgz 88931400 bytes.
2018-08-02 17:08:56.997848: W T:\src\github\tensorflow\tensorflow\core\framework
\op_def_util.cc:346] Op BatchNormWithGlobalNormalization is deprecated. It will
cease to work in GraphDef version 9. Use tf.nn.batch_normalization().
2018-08-02 17:08:57.640885: I T:\src\github\tensorflow\tensorflow\core\platform\
cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow bi
nary was not compiled to use: AVX2
Persian cat (score = 0.53996)
Egyptian cat (score = 0.03700)
Angora, Angora rabbit (score = 0.02241)
lynx, catamount (score = 0.01312)
tabby, tabby cat (score = 0.01108)

恭喜,你已经会使用tensorflow去识别猫的图片了,这里测试的是一只波斯猫的图片,系统识别的概率是0.53996.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值