Get Started with TensorFlow

2024-04-12 10:38
文章标签 started get tensorflow

本文主要是介绍Get Started with TensorFlow,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

TensorFlow是一个用于研究和生产的开源机器学习库。 TensorFlow为初学者和专家提供API,以便为桌面,移动,Web和云开发。请参阅以下部分以开始使用。

学习和使用ML

高级Keras API提供构建块来创建和训练深度学习模型。从这些适合初学者的笔记本示例开始,然后阅读TensorFlow Keras指南。

  1. Basic classification   https://tensorflow.google.cn/tutorials/keras/save_and_restore_models
  2. Text classification   https://tensorflow.google.cn/tutorials/keras/basic_text_classification
  3. Regression https://tensorflow.google.cn/tutorials/keras/basic_regression
  4. Overfitting and underfitting https://tensorflow.google.cn/tutorials/keras/overfit_and_underfit
  5. Save and load  https://tensorflow.google.cn/tutorials/keras/save_and_restore_models
import tensorflow as tf
mnist = tf.keras.datasets.mnist(x_train, y_train),(x_test, y_test) = mnist.load_data()  #下载数据集
x_train, x_test = x_train / 255.0, x_test / 255.0   #归一化像素值model = tf.keras.models.Sequential([                  #构建模型tf.keras.layers.Flatten(input_shape=(28, 28)),tf.keras.layers.Dense(512, activation=tf.nn.relu),tf.keras.layers.Dropout(0.2),tf.keras.layers.Dense(10, activation=tf.nn.softmax)
])
model.compile(optimizer='adam',                    #优化器(更新模型参数),损失函数(数据拟合好坏的模型),以及数据拟合损失值情况(根据这个损失值来调整)loss='sparse_categorical_crossentropy',metrics=['accuracy'])model.fit(x_train, y_train, epochs=5) #模型的拟合,开始训练(这个函数会调用前面我们定义的损失函数和优化器以及损失值以便更新模型的参数更好的拟合数据)
model.evaluate(x_test, y_test) #评估模型在测试集上的情况

研究和实验
热切的执行为高级操作提供了一个必要的,按运行定义的界面。使用自动区分编写自定义图层,前进传递和训练循环。从这些笔记本开始,然后阅读热切的执行指南(https://tensorflow.google.cn/guide/eager)

1.热切的执行基础 https://tensorflow.google.cn/tutorials/eager/eager_basics
2.自动分色和渐变胶带 https://tensorflow.google.cn/tutorials/eager/automatic_differentiation
3.定制培训:基础知识 https://tensorflow.google.cn/tutorials/eager/custom_training
4.自定义图层 https://tensorflow.google.cn/tutorials/eager/custom_layers
5.定制培训:演练  https://tensorflow.google.cn/tutorials/eager/custom_training_walkthrough

https://tensorflow.google.cn/guide/keras

ML在生产规模
估算人员可以在生产环境中的多台机器上训练大型模型。 TensorFlow提供了一组预制的估算器来实现常见的ML算法。请参阅Estimators指南。

1.使用Estimators构建线性模型 https://tensorflow.google.cn/tutorials/estimators/linear
2.使用Estimators进行广泛而深入的学习 https://github.com/tensorflow/models/tree/master/official/wide_deep
3.提升树  https://github.com/tensorflow/models/tree/master/official/boosted_trees
4.如何使用TF-Hub构建简单的文本分类器 https://tensorflow.google.cn/hub/tutorials/text_classification_with_tf_hub
5.使用估算器构建卷积神经网络 https://tensorflow.google.cn/tutorials/estimators/cnn

https://tensorflow.google.cn/guide/eager

Google Colab:学习和使用TensorFlow的简便方法 
Colaboratory是一个谷歌研究项目,旨在帮助传播机器学习教育和研究。这是一个Jupyter笔记本环境,无需使用任何设置,完全在云端运行。阅读博客文章。

https://tensorflow.google.cn/guide/estimators

Build your first ML app

Create and deploy TensorFlow models on web and mobile.

Web developers

TensorFlow.js is a WebGL accelerated, JavaScript library to train and deploy ML models in the browser and for Node.js.

Mobile developers

TensorFlow Lite is lightweight solution for mobile and embedded devices.

 

Videos and updates

订阅TensorFlow YouTube频道(https://www.youtube.com/tensorflow)和博客(https://blog.tensorflow.org/),了解最新视频和更新。

开始使用TensorFlow的高级API(https://www.youtube.com/watch?v=tjsHSIG8I08)

Eager execution https://www.youtube.com/watch?v=T8AW0fKP0Hs

tf.data: Fast, flexible, and easy-to-use input pipelines https://www.youtube.com/watch?v=uIcqeP7MFH0

 

这篇关于Get Started with TensorFlow的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/896901

相关文章

10 Source-Get-Post-JsonP 网络请求

划重点 使用vue-resource.js库 进行网络请求操作POST : this.$http.post ( … )GET : this.$http.get ( … ) 小鸡炖蘑菇 <!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-w

API28_OKgo_get注意事项

1: implementation 'com.lzy.net:okgo:2.1.4' 2:在BaseApplication中onCreate()中初始化initOKgo() private void initOKgo() {//---------这里给出的是示例代码,告诉你可以这么传,实际使用的时候,根据需要传,不需要就不传-------------//HttpHeaders headers

win10不用anaconda安装tensorflow-cpu并导入pycharm

记录一下防止忘了 一、前提:已经安装了python3.6.4,想用tensorflow的包 二、在pycharm中File-Settings-Project Interpreter点“+”号导入很慢,所以直接在cmd中使用 pip install -i https://mirrors.aliyun.com/pypi/simple tensorflow-cpu下载好,默认下载的tensorflow

项目一(一) HttpClient中的POST请求和GET请求

HttpClient中的POST请求和GET请求 一、HttpClient简述 HttpClient是Apache Jakarta Common下的子项目,用来提供高效的、最新的、功能丰富的支持HTTP协议的客户端编程工具包,并且它支持HTTP协议最新的版本和建议。HttpClient已经应用在很多的项目中,比如Apache Jakarta上很著名的另外两个开源项目Cactus和HTMLU

稀疏自编码器tensorflow

自编码器是一种无监督机器学习算法,通过计算自编码的输出与原输入的误差,不断调节自编码器的参数,最终训练出模型。自编码器可以用于压缩输入信息,提取有用的输入特征。如,[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]四比特信息可以压缩成两位,[0,0],[1,0],[1,1],[0,1]。此时,自编码器的中间层的神经元个数为2。但是,有时中间隐藏层的神经元

Tensorflow实现与门感知机

感知机是最简单的神经网络,通过输入,进行加权处理,经过刺激函数,得到输出。通过输出计算误差,调整权重,最终,得到合适的加权函数。 今天,我通过tensorflow实现简单的感知机。 首先,初始化变量:     num_nodes = 2     output_units = 1     w = tf.Variable(tf.truncated_normal([num_nodes,output

Tensorflow lstm实现的小说撰写预测

最近,在研究深度学习方面的知识,结合Tensorflow,完成了基于lstm的小说预测程序demo。 lstm是改进的RNN,具有长期记忆功能,相对于RNN,增加了多个门来控制输入与输出。原理方面的知识网上很多,在此,我只是将我短暂学习的tensorflow写一个预测小说的demo,如果有错误,还望大家指出。 1、将小说进行分词,去除空格,建立词汇表与id的字典,生成初始输入模型的x与y d

Deepin Linux安装TensorFlow

Deepin Linux安装TensorFlow 1.首先检查是否有Python,一般deepin系统都自带python的。   2.安装pip Sudo appt-get install pip来安装pip,如果失败就先更新一下sudo apt-get updata,然后再sudo apt-get install pip,如果定位失败,就sudo apt-get install pyth

终止distributed tensorflow的ps进程

1.直接终止: $ ps -ef | grep python | grep 文件名 | awk {'print $2'} | xargs kill文件名为当前运行的程序,名称如:distribute.py 2.查找pid,后kill: $ ps -ef | grep python | grep 文件名 | awk {'print $2'}$ kill -9 <pid>

apt-get update更新源时,出现“Hash Sum mismatch”问题

转载自:apt-get update更新源时,出现“Hash Sum mismatch”问题 当使用apt-get update更新源时,出现下面“Hash Sum mismatch”的报错,具体如下: root@localhost:~# apt-get update ...... ...... W: Failed to fetch http://us.archive.ubuntu.com/ub