基于Tensorflow的人工智能Mnist图像识别训练实战

基于Tensorflow的人工智能Mnist图像识别训练实战记录备忘

工作目录: ~/worker/ai/MNIST

操作系统:Ubuntu16.04,也可以移植到windows上的Anaconda python环境中去

user@ubuntu1:~/worker/ai$ tree
.
├── MNIST
│   ├── input_data.py
│   ├── input_data.pyc
│   ├── MNIST_data
│   │   ├── t10k-images-idx3-ubyte.gz
│   │   ├── t10k-labels-idx1-ubyte.gz
│   │   ├── train-images-idx3-ubyte.gz
│   │   └── train-labels-idx1-ubyte.gz
│   └── study.py
└── MNIST_data.zip

确认已经安装了python,查看python的版本如下:

user@ubuntu1: ~$ python -V
Python 2.7.12

安装tensorflow:pip install tensorflow

命令pip list 查看确认已经安装了tensorflow

......
tensorboard                   1.13.1
tensorflow                    1.13.1
tensorflow-estimator          1.13.0
termcolor                     1.1.0
tushare                       1.2.21
You are using pip version 19.0.3, however version 19.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

最后执行python study.py,程序先完成9900次神经网络训练,然后进行一次图像识别测试 ,识别准确率达到0.9907

......
Instructions for updating:
Use tf.cast instead.
step 0,train_accuracy= 0.1
step 100,train_accuracy= 0.78
step 200,train_accuracy= 0.94
step 300,train_accuracy= 0.88
step 400,train_accuracy= 0.94
step 500,train_accuracy= 0.88
step 600,train_accuracy= 0.98
step 700,train_accuracy= 0.94
step 800,train_accuracy= 0.86
step 900,train_accuracy= 0.98
step 1000,train_accuracy= 1
......

step 9200,train_accuracy= 1
step 9300,train_accuracy= 1
step 9400,train_accuracy= 1
step 9500,train_accuracy= 1
step 9600,train_accuracy= 1
step 9700,train_accuracy= 0.96
step 9800,train_accuracy= 0.98
step 9900,train_accuracy= 1
2019-07-23 22:27:46.372737: W tensorflow/core/framework/allocator.cc:124] Allocation of 1003520000 exceeds 10% of system memory.
test_accuracy= 0.9907

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值