Download the cifar10 dataset Get the file name queue Read files from the file queue Start the filling queue thread
Category: tensorflow
TensorFlow的安装
1.sudo apt-get install python-dev python-pip 2.export IF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.3.0-cp27-none-linux_x86_64.whl sudo pip install $IF_BINARY_URL 0
将mnist数据集转换为对应的数字图片
将Mnist数据集转换为对应的数字图片 代码: # coding:utf-8 from tensorflow.examples.tutorials.mnist import input_data import tensorflow as tf import os import scipy.misc import numpy as np
卷积层+池化层+全连接层 训练Mnist数据
# coding:utf-8 from tensorflow.examples.tutorials.mnist import input_data import tensorflow as tf ”’ step: 1 获取MNIST数据集 输入大小:None*28*28 2 第一层卷积层 输入:占位符 [None, 28*28]
使用slim训练模型的参数介绍
使用slim训练模型的参数介绍 # 对参数进行介绍 python train_image_classifier.py \ # 表示在该目录下保存日志和checkpoint –train_dir=satellite/train_dir \ # 制定训练的新的数据集 –dataset_name=satellite \ –dataset_split_name=train \ # 训练数据集保存的位置 –dataset_dir=satellite/data \
使用tensorflow训练cifar-10数据集(参考官方文件编写)
1 cifar-10数据集简介 该数据集是hinton的学生Alex Krizhevsky和Ilya Sutskever整理的,用于识别普通的物体。 内容有:飞机、汽车、鸟类、猫、鹿、狗、蛙类、马、船、卡车 图片尺寸:32323 2 代码 其实官方已经有代码文件了。 官方文件的地址:https://github.com/tensorflow/models/tree/master/tutorials/image/cifar10 这里参考官方代码进行了编写,一共两个文件,data_train.py(训练模型)和 data_test.py(验证模型)。 data_train.py 训练模型 # coding:utf-8 import time import
使用内存队列方式读取文件数据
Tensorflow创建文件名队列 tf.train.string_input_producer 1 传入一个文件名list, 系统将自动将其转换为一个文件名队列 2 num_epochs epoch数 3 shuffle 指一个epoch内文件的顺序是否被打乱, 如果为False,则会按照顺序进入文件名队列 内存队列不需要自己建立,只需要使用reader对象从文件名队列中读取书即可 其他参数:tf.train.start_queue_runners 启动填充队列的线程 # coding:utf-8 import os import
Mnist数据集训练 (使用softmax_regression)
# coding:utf-8 from tensorflow.examples.tutorials.mnist import input_data import tensorflow as tf # 下载Mnist数据集 mnist_data = input_data.read_data_sets(“MNIST_data”, one_hot=True) # 输入数据占位 x =
将cifar10数据转换为图片文件
1.下载cifar10数据集 2.获取文件名队列 3.从文件队列中读取文件 4.启动填充队列线程 5.将文件保存为图片 # copding:utf-8 import cifar10 import cifar10_input # cifar10.py、cifar10_input.py 为官方文件 # 下载地址:https://github.com/tensorflow/models/tree/master/tutorials/image/cifar10 import tensorflow as tf