Google 开发者大会 (Google Developer Days,简称 GDD) 是展现 Google 最新开发者产品和平台的全球盛会,旨在帮助你快速开发优质应用,发展和留住活跃用户群,充分利用各类工具得到更多收益。2018 Google 开发者大会于 9 月 20 日和 21 日于上海举办。👉Google 开发者大会 2018 掘金专题程序员
2018 年 9 月 20 日 Laurence Moroney(Google 开发者技术推广工程师)与付弋真(Google Brain 的软件工程师)带来一场《TensorFlow 简介:机器学习技术使用入门》的演讲,本文将对演讲作一个回顾。编程
TensorFlow 是一个采用数据流图(data flow graphs),用于数值计算的开源软件库。节点(Nodes)在图中表示数学操做,图中的线(edges)则表示在节点间相互联系的多维数据数组,即张量(tensor)。它灵活的架构让你能够在多种平台上展开计算,例如台式计算机中的一个或多个CPU(或GPU),服务器,移动设备等等。TensorFlow 最初由Google大脑小组(隶属于Google机器智能研究机构)的研究员和工程师们开发出来,用于机器学习和深度神经网络方面的研究,但这个系统的通用性使其也可普遍用于其余计算领域。数组
Laurence Moroney讲述了他所经历的变革:bash
在借助手机速度传感器的帮助下,咱们能够获取当前用户的速度,而后再使用代码进行判断。服务器
一些简单的运动场景能够经过上述类型的方式进行检测,假若像用户在打高尔夫这种复杂的运动场景是没法被检测出来,而机器学习能够帮咱们解决在这个问题。网络
机器学习须要程序员提供答案和数据,给答案打上标签,在数据的配合之下,机器会本身研究出规则。架构
机器学习就是在模仿人类,经过大量的数据和标签,获得规则,从而解决问题。让机器像人同样学习,这是机器学习所要走的第一步。机器学习
from tensorflow import keras
import numpy as np
model = keras.Sequential([keras.layers.Dense(units = 1, input_shape = [1])])
model.compile(optimizer = 'sgd', loss = 'mean_squared_error')
xs = np.array([-1.0, 0.0, 1.0, 2.0, 3.0, 4.0], dtype = float)
ys = np.array([-3.0, -1.0, 1.0, 3.0, 5.0, 7.0], dtype = float)
model.fit(xs, ys, epochs = 500)
print(model.predict([10.0]))
复制代码
结果以下: 工具
Fashion-MNIST是一个替代MNIST手写数字集的图像数据集。 它是由Zalando(一家德国的时尚科技公司)旗下的研究部门提供。其涵盖了来自10种类别的共7万个不一样商品的正面图片。Fashion-MNIST的大小、格式和训练集/测试集划分与原始的MNIST彻底一致。60000/10000的训练测试数据划分,28x28的灰度图片。学习
经过 Fashion-MNIST 数据集,能够对咱们的模型进行训练,不断地优化,从而提升识别准确率。
import tensorflow as tf
from tensorflow import keras
import numpy as np
# Import the Data
fashion_mnist = keras.datasets.fashion_mnist
(train_images, train_labels), (test_images, teat_labels) = fashion_mnist.load_data()
# Normalize the data
train_images = train_images / 255.0
test_images = test_images / 255.0
#Define the model
model = keras.Sequential([
keras.layers.Flatten(inport_shape = (28,28)),
keras.layers.Dense(128, activation = tf.nn.relu),
keras.layers.Dense(10, activation = tf.nn.softmax),
])
model.compile(oprimizer = tf.train.AdadeltaOptimizer(),loss = 'sparse_categorical_crossentropy',metrics=['accuracy'])
#Train the model
model.fit(train_images, train_labels, epochs = 5, verbose = 2)
predictions = model.predict(test_images)
print(test_images[4560])
print(np.argmax(predictions[4560]))
复制代码
运行结果以下:
在设置5次迭代的前提下,本模型的成功率为 71% 。神经网络能够经过更多的训练,从而提升准确率。
以上就是本次演讲的所有内容,但愿对你们有所帮助。 阅读更多 Google 开发者大会 2018 技术干货