这个仓库是一个初级的TensorFlow使用示例,目的是方便初学者能够快速的熟悉TensorFlow,为了方便理解这些示例,这个仓库不经包含了代码,还有对应的jupyter notebook解释。
这个示例适合初学者,除了有原始TensorFlow的实现例子,还有最新的High Level API实现的例子,这些高级的API包含layers, Eager, estimator, dataset等
更新 (03/18/2018): TensorFlow开始支持Eager API (建议使用 TensorFlow v1.5+).
- 在TensorFlow中使用示例MNist数据集 (notebook)
- TensorFlow Hello World (notebook) (code). 使用TensorFlow的最简单操作.
- 基本操作 (notebook) (code). 使用TensorFlow的基本操作.
- TensorFlow Eager 基本操作 (notebook) (code).使用TensorFlow的 Eager API最基本操作.
- 线性回归 (notebook) (code). 使用TensorFlow实现线性回归模型.
- 线性回归 (eager api) (notebook) (code). 使用TensorFlow的 Eager API实现线性回归.
- 逻辑回归 (notebook) (code). 使用TensorFlow实现逻辑回归.
- 逻辑回归(eager api) (notebook) (code). 使用TensorFlow的 Eager API实现逻辑回归.
- 最近邻算法 (notebook) (code). 使用 TensorFlow实现最近邻算法.
- K-Means (notebook) (code). 使用 TensorFlow 实现K-Means分类器.
- 随机森林 (notebook) (code). 使用TensorFlow实现随机森林分类器.
- 简单的神经网络 (notebook) (code).使用TensorFlow原始的Low Level API实现简单的BP神经网络用于对MNist数据库进行分类.
- 简单的神经网络(tf.layers/estimator api) (notebook) (code).使用 TensorFlow 'layers' 和 'estimator' API 实现简单的神经网络实现对MNist数据库进行分类。
- 简单的神经网络(eager api) (notebook) (code). 使用 TensorFlow Eager API 构建一个多层感知机分类MNist数据库。
- 卷积神经网络(原始TensorFlow) (notebook) (code). Build a convolutional neural network to classify MNIST digits dataset. Raw TensorFlow implementation.
- Convolutional Neural Network (tf.layers/estimator api) (notebook) (code). Use TensorFlow 'layers' and 'estimator' API to build a convolutional neural network to classify MNIST digits dataset.
- Recurrent Neural Network (LSTM) (notebook) (code). Build a recurrent neural network (LSTM) to classify MNIST digits dataset.
- Bi-directional Recurrent Neural Network (LSTM) (notebook) (code). Build a bi-directional recurrent neural network (LSTM) to classify MNIST digits dataset.
- Dynamic Recurrent Neural Network (LSTM) (notebook) (code). Build a recurrent neural network (LSTM) that performs dynamic calculation to classify sequences of different length.
- 自动编码 (notebook) (code). Build an auto-encoder to encode an image to a lower dimension and re-construct it.
- Variational Auto-Encoder (notebook) (code). Build a variational auto-encoder (VAE), to encode and generate images from noise.
- GAN (Generative Adversarial Networks) (notebook) (code). Build a Generative Adversarial Network (GAN) to generate images from noise.
- DCGAN (Deep Convolutional Generative Adversarial Networks) (notebook) (code). Build a Deep Convolutional Generative Adversarial Network (DCGAN) to generate images from noise.
- Save and Restore a model (notebook) (code). Save and Restore a model with TensorFlow.
- Tensorboard - Graph and loss visualization (notebook) (code). Use Tensorboard to visualize the computation Graph and plot the loss.
- Tensorboard - Advanced visualization (notebook) (code). Going deeper into Tensorboard; visualize the variables, gradients, and more...
- Build an image dataset (notebook) (code). Build your own images dataset with TensorFlow data queues, from image folders or a dataset file.
- TensorFlow Dataset API (notebook) (code). Introducing TensorFlow Dataset API for optimizing the input data pipeline.
- Basic Operations on multi-GPU (notebook) (code). A simple example to introduce multi-GPU in TensorFlow.
- Train a Neural Network on multi-GPU (notebook) (code). A clear and simple TensorFlow implementation to train a convolutional neural network on multiple GPUs.
Some examples require MNIST dataset for training and testing. Don't worry, this dataset will automatically be downloaded when running examples. MNIST is a database of handwritten digits, for a quick description of that dataset, you can check this notebook.
Official Website: http://yann.lecun.com/exdb/mnist/
To download all the examples, simply clone this repository:
git clone https://github.com/debugCVML/TensorFlow-Examples
To run them, you also need the latest version of TensorFlow. To install it:
pip install tensorflow
or (if you want GPU support):
pip install tensorflow_gpu
For more details about TensorFlow installation, you can check TensorFlow Installation Guide
The following examples are coming from TFLearn, a library that provides a simplified interface for TensorFlow. You can have a look, there are many examples and pre-built operations and layers.
- TFLearn Quickstart. Learn the basics of TFLearn through a concrete machine learning task. Build and train a deep neural network classifier.
- TFLearn Examples. A large collection of examples using TFLearn.