SciTech-BigDataAIML-Tensorflow-Keras的API列表 + TensorFlow 模型建立与训练
Tensorflow链接:
https://www.tensorflow.org/install
https://www.tensorflow.org/guide
https://www.tensorflow.org/tutorials
https://www.tensorflow.org/learn
Tensorflow模型介绍:
https://tf.wiki/zh_hans/basic/models.html
Keras API查询列表:
https://keras.io/api/layers/core_layers/embedding/
https://keras.io/api/layers/reshaping_layers/flatten/
模型(Model)与层(Layer)
TensorFlow 推荐使用 Keras(tf.keras) 构建模型。
Keras 是一个广为流行的高级神经网络 API,简单、快速而不失灵活性,现已得到 TensorFlow 的官方内置和全面支持。
Keras 有两个重要的概念:Model(模型) 和 Layer(层) 。
- Layer层将各种计算流程和变量进行封装(例如全连接层,CNN 卷积层和池化层等);
- Model模型则将各种Layer层进行组织和连接,并封装成一个整体,描述了如何将输入数据通过各种层以及运算而得到输出。
调用模型,使用 y_pred = model(X) 的形式即可。
Keras 在 tf.keras.layers 处内置深度学习会大量常用的的预定义层,同时也允许我们自定义层。
Keras 的Model模型以class类的形式呈现,我们可以通过继承 tf.keras.Model 这个 Python 类来定义自己的模型。要继承类,需要重写 init() (构造函数,初始化)和 call(input) (模型调用)两个方法,同时也可以根据需要增加自定义的方法。
Tensorflow Models API
There are three ways to create Keras models:
- The Sequential model, which is very straightforward (a simple list of layers), but is limited to single-input, single-output stacks of layers (as the name gives away).
- The Functional API, which is an easy-to-use, fully-featured API that supports arbitrary model architectures. For most people and most use cases, this is what you should be using. This is the Keras "industry strength" model.
- Model subclassing, where you implement everything from scratch on your own. Use this if you have complex, out-of-the-box research use cases.
Models API overview
The Model class
Model class
summary method
get_layer method
The Sequential class
Sequential class
add method
pop method
Model training APIs
compile method
fit method
evaluate method
predict method
train_on_batch method
test_on_batch method
predict_on_batch method
Saving & serialization
Whole model saving & loading
Weights-only saving & loading
Model config serialization
Model export for inference
Serialization utilities
Source Code Example
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(128, activation='relu'),
tf.keras.layers.Dropout(0.2),
tf.keras.layers.Dense(10, activation='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)
SciTech-BigDataAIML-Tensorflow-Keras的API列表 + TensorFlow 模型建立与训练的更多相关文章
- 三分钟快速上手TensorFlow 2.0 (上)——前置基础、模型建立与可视化
本文学习笔记参照来源:https://tf.wiki/zh/basic/basic.html 学习笔记类似提纲,具体细节参照上文链接 一些前置的基础 随机数 tf.random uniform(sha ...
- 【小白学PyTorch】21 Keras的API详解(上)卷积、激活、初始化、正则
[新闻]:机器学习炼丹术的粉丝的人工智能交流群已经建立,目前有目标检测.医学图像.时间序列等多个目标为技术学习的分群和水群唠嗑答疑解惑的总群,欢迎大家加炼丹兄为好友,加入炼丹协会.微信:cyx6450 ...
- 小白如何学习PyTorch】25 Keras的API详解(下)缓存激活,内存输出,并发解决
[新闻]:机器学习炼丹术的粉丝的人工智能交流群已经建立,目前有目标检测.医学图像.时间序列等多个目标为技术学习的分群和水群唠嗑答疑解惑的总群,欢迎大家加炼丹兄为好友,加入炼丹协会.微信:cyx6450 ...
- TensorFlow Keras API用法
TensorFlow Keras API用法 Keras 是与 TensorFlow 一起使用的更高级别的作为后端的 API.添加层就像添加一行代码一样简单.在模型架构之后,使用一行代码,可以编译和拟 ...
- Keras:基于Theano和TensorFlow的深度学习库
catalogue . 引言 . 一些基本概念 . Sequential模型 . 泛型模型 . 常用层 . 卷积层 . 池化层 . 递归层Recurrent . 嵌入层 Embedding 1. 引言 ...
- 【学习总结】win7使用anaconda安装tensorflow+keras
tips: Keras是一个高层神经网络API(高层意味着会引用封装好的的底层) Keras由纯Python编写而成并基Tensorflow.Theano以及CNTK后端. 故先安装TensorFlo ...
- [转] 理解CheckPoint及其在Tensorflow & Keras & Pytorch中的使用
作者用游戏的暂停与继续聊明白了checkpoint的作用,在三种主流框架中演示实际使用场景,手动点赞. 转自:https://blog.floydhub.com/checkpointing-tutor ...
- TensorFlow+Keras 03 TensorFlow 与 Keras 介绍
1 TensorFlow 架构图 1.1 处理器 TensorFlow 可以在CPU.GPU.TPU中执行 1.2 平台 TensorFlow 具备跨平台能力,Windows .Linux.Andro ...
- [AI][tensorflow][keras] archlinux下 tersorflow and keras 安装
tensorflow TensorFlow is an open-source machine learning library for research and production. https: ...
- [Tensorflow] Object Detection API - retrain mobileNet
前言 一.专注话题 重点话题 Retrain mobileNet (transfer learning). Train your own Object Detector. 这部分讲理论,下一篇讲实践. ...
随机推荐
- Java 在循环里发生异常会跳出循环
不知道他验证了没... package com.zjw; /** * @author 朱俊伟 * @date 2020/11/12 22:09 */ public class TestError { ...
- 【记录】Python|Python3程序测试速度的整个流程、方法对比和选取方式
参考:Python3.7中time模块的time().perf_counter()和process_time()的区别 其他的博客太!长!了!我实在看不下去了,每次都不记得什么场景用什么函数. 让我来 ...
- API测试基础之http协议
http简介: http(超文本传输协议)是一个简单的请求-响应协议,它通常运行在TCP(传输控制协议)之上.它指定了客户端可能发送给服务器什么样的消息以及得到什么样的响应.请求和响应消息的头以ASC ...
- 【BLIP】解读BLIP
BLIP,全称是Bootstrapped Language-Image Pretraining,源自<BLIP: Bootstrapping Language-Image Pre-trainin ...
- Axure在线教育考试原型图在线网课教育交互模板rp源文件
Axure在线教育考试原型图在线网课教育交互模板rp源文件 Axure在线教育原型图在线网课教育交互模板rp源文件是一款原创的儿童教育类的APP模板,使用axure rp软件制作.app中包含大约40 ...
- Vue3 学习-初识体验-helloworld
在数据分析中有一个最重要的一环就是数据可视化, 数据报表的开发. 从我从业这几年的经历上看, 经历了从业务系统导表格数据, 到Excel+PPT, 再是开源报表工具, 再是主流商业BI产品(低/零代码 ...
- 【Java持久层技术演进全解析】从JDBC到MyBatis再到MyBatis-Plus
从JDBC到MyBatis再到MyBatis-Plus:Java持久层技术演进全解析 引言 在Java企业级应用开发中,数据持久化是核心需求之一.本文将系统性地介绍Java持久层技术的演进过程,从最基 ...
- C#线程池核心技术:从原理到高效调优的实用指南
1. 引言 在现代软件开发中,多线程编程是提升应用程序性能的关键手段.随着多核处理器的普及,合理利用并发能力已成为开发者的重要课题.然而,线程的创建和销毁是一个昂贵的过程,涉及系统资源的分配与回收,频 ...
- VSCode将本地项目代码上传到gitee中
1.创建远程仓库,这个就是该仓库的地址 2.查看git的版本 git --version 3.使用git init命令初始化git 4.使用git status命令来查看文件是否被修改 : gi ...
- IntelliJ IDEA 2023.1 破解教程mac,windows,linux均适用/JetBrains产品全版本激活
前言 该激活方式不限于IDEA,同样也适用于JetBrains 全家桶的所有工具, 包括 IntelliJ IDEA.Pycharm.WebStorm.PhpStorm.AppCode.Datagri ...