TFLearn:为TensorFlow提供更高级别的API 的深度学习库
- 2019 年 10 月 4 日
- 筆記
【磐创AI 导读】:本文将会带大家了解TFLearn,欢迎大家转发、留言。
TFlearn是一个基于Tensorflow构建的模块化透明深度学习库。它旨在为TensorFlow提供更高级别的API,以促进和加速实验,同时保持完全透明并与之兼容。
TFLearn功能包括:
- 通过教程和示例,易于使用和理解用于实现深度神经网络的高级API。
- 通过高度模块化的内置神经网络层,正则化器,优化器,指标进行快速原型设计
- Tensorflow完全透明。所有功能都是通过张量构建的,可以独立于TFLearn使用。
- 强大的辅助功能,可以训练任何TensorFlow 图,支持多个输入,输出和优化器。
- 简单而美观的图形可视化,包含有关权重,梯度,激活等的详细信息。
- 轻松使用多个CPU / GPU的设备。
高级API目前支持大多数最近的深度学习模型,如Convolutions,LSTM,BiRNN,BatchNorm,PReLU,残留网络,生成网络……未来,TFLearn也将与最新版本保持同步最新的深度学习模型。
注意:最新的TFLearn(v0.3)仅与TensorFlow v1.0及更高版本兼容。
概览
#分类
# Classification tflearn.init_graph(num_cores=8, gpu_memory_fraction=0.5) net = tflearn.input_data(shape=[None, 784]) net = tflearn.fully_connected(net, 64) net = tflearn.dropout(net, 0.5) net = tflearn.fully_connected(net, 10, activation='softmax') net = tflearn.regression(net, optimizer='adam', loss='categorical_crossentropy') model = tflearn.DNN(net) model.fit(X, Y)
#序列生成
net = tflearn.input_data(shape=[None, 100, 5000]) net = tflearn.lstm(net, 64) net = tflearn.dropout(net, 0.5) net = tflearn.fully_connected(net, 5000, activation='softmax') net = tflearn.regression(net, optimizer='adam', loss='categorical_crossentropy') model = tflearn.SequenceGenerator(net, dictionary=idx, seq_maxlen=100) model.fit(X, Y) model.generate(50, temperature=1.0)
这里有更多的例子 http://tflearn.org/examples/。
TensorFlow安装
TFLearn需要安装Tensorflow(版本1.0+)。要安装TensorFlow,只需运行:
pip install tensorflow
或者,支持GPU:
pip install tensorflow-gpu
有关更多详细信息,请参阅TensorFlow安装说明。
TFLearn安装
要安装TFLearn,最简单的方法就是运行。对于前沿版本(推荐):
pip install git + https://github.com/tflearn/tflearn.git
对于最新的稳定版本:
pip install tflearn
否则,您也可以通过运行(从源文件夹)从源安装:
python setup.py install
有关详细信息,请参阅“安装指南”。
入门
请参阅TFLearn入门,了解TFLearn基本功能或开始浏览TFLearn教程。 http://tflearn.org/getting_started/
例子
有许多可用的神经网络实现,请参见示例。 http://tflearn.org/examples/
文档
http://tflearn.org/doc_index
模型可视化

损失可视化

图层可视化

【1】tflearn:https://github.com/tflearn/tflearn