keras tutorial
Keras i Keras ii About the Tutorial Keras is an open source deep learning framework for python. It has been developed by an artificial intelligence researcher Netflix, Huawei and Uber are currently using Keras. This tutorial walks through the installation of Keras, basics of deep learning, Keras models, Keras layers, Keras modules and finally conclude with some network framework. This tutorial is intended to make you comfortable in getting started with the Keras framework concepts. Prerequisites Before proceeding with the various types of concepts given0 码力 | 98 页 | 1.57 MB | 1 年前3Notes for install Keras on Anaconda3
for install Keras on Anaconda3: For some machines, you might find difficulties by following the official document of installing Keras for RStudio. There is the alternative to install Keras and Tensorflow r-tensorflow 4 conda install -c conda-forge r-keras C) Open the RStudio and run the following deep learning model to check the installation works: library(keras) mnist <- dataset_mnist() train_images test_labels <- to_categorical(test_labels, 10) # defining the model and layers model <- keras_model_sequential() PolyU IT Support for Research Apr 2020 Page-3 model %>% layer_dense(units0 码力 | 3 页 | 654.13 KB | 7 月前3Keras: 基于 Python 的深度学习库
Keras: 基于 Python 的深度学习库 Keras: The Python Deep Learning library* Author: Keras-Team Contributor: 万 震 (WAN Zhen) � wanzhenchn � wanzhen@cqu.edu.cn 2018 年 12 月 24 日 *Copyright © 2018 by Keras-Team Keras-Team 前 言 整理 Keras: 基于 Python 的深度学习库 PDF 版的主要原因在于学习 Keras 深度学习库时方 便本地查阅,下载最新 PDF 版本请访问: https://github.com/wanzhenchn/keras-docs-zh。 感谢 keras-team 所做的中文翻译工作,本文档制作基于此处。 严正声明:本文档可免费用于学习和科学研究,可自由传播,但切勿擅自用于商业用途,由 the Chinese Keras Markdown is that it is easy to read locally when learning the Keras Deep Learning Library. For the latest PDF version, please visit https://github.com/wanzhenchn/keras-docs-zh. Thanks0 码力 | 257 页 | 1.19 MB | 1 年前3【PyTorch深度学习-龙龙老师】-测试版202112
度学习框架。采用了 命令式编程和符号式编程混合方式,灵活性高,运行速度快,文档和案例也较为丰 富。 ❑ Keras 是一个基于 Theano 和 TensorFlow 等框架提供的底层运算而实现的高层框架, 提供了大量快速训练、测试网络的高层接口。对于常见应用来说,使用 Keras 开发效 率非常高。但是由于没有底层实现,需要对底层框架进行抽象,运行效率不高,灵活 性一般。 ❑ TensorFlow IMDB 数据集 (x_train, y_train), (x_test, y_test) = keras.datasets.imdb.load_data(num_words=total_words) # 将句子填充或截断到相同长度,设置为末尾填充和末尾截断方式 x_train = keras.preprocessing.sequence.pad_sequences(x_train, maxlen=max_review_len,truncating='post',padding='post') x_test = keras.preprocessing.sequence.pad_sequences(x_test, maxlen=max_review_len,truncating='post',padding='post') print(x_train.shape, x_test0 码力 | 439 页 | 29.91 MB | 1 年前3《Efficient Deep Learning Book》[EDL] Chapter 5 - Advanced Compression Techniques
clone_block.set_weights(block.get_weights()) if block.name in prunables: clone_block = tfmot.sparsity.keras.prune_low_magnitude(clone_block) return clone_block model_for_pruning = models.clone_model( m, pruning wrappers to update the wrappers after each optimization step. update_pruning = tfmot.sparsity.keras.UpdatePruningStep() callbacks = [update_pruning] tds = train_prep_ds.cache().shuffle(1000, res library as shown below. # Strip the pruning wrappers from the model. stripped_model = tfmot.sparsity.keras.strip_pruning(model_for_pruning) The stripped_model is a sparse model after cleaning up the pruning0 码力 | 34 页 | 3.18 MB | 1 年前3《Efficient Deep Learning Book》[EDL] Chapter 4 - Efficient Architectures
with tokenize, by truncating # the rest of the sequence. max_seq_len = 100 vectorization_layer = tf.keras.layers.TextVectorization( max_tokens=vocab_size, output_sequence_length=max_seq_len) Once we have _dim, embedding_tensor=word2vec_embeddings): return tf.keras.layers.Embedding( vocab_size, embedding_dim_size, embeddings_initializer=tf.keras.initializers.Constant( word2vec_embeddings), trainable=trainable embedding layers. def get_untrained_embedding_layer(trainable=True, embedding_dim_size=250): return tf.keras.layers.Embedding( vocab_size, embedding_dim_size, trainable=trainable, ) Step 4: Training the models0 码力 | 53 页 | 3.92 MB | 1 年前3《TensorFlow 2项目进阶实战》2-快速上手篇:动⼿训练模型和部署服务
《TensorFlow 2 项目进阶实战》视频课程 快速上手篇:动⼿训练模型和部署服务 • TensorFlow 2 开发环境搭建 • 使用 tf.keras.datasets 加载数据 • 使用 tf.data.Dataset 加载数据 • 使用 tf.keras.Model 管理模型 • Fashion MNIST 数据集介绍 • 使用 TensorFlow 2 训练分类网络 目录 TensorFlow Docker 中使用 TensorFlow 2 “Hello TensorFlow” Try it! 使用 tf.keras.datasets 加载数据 使用 tf.keras.datasets 预置数据集 使用 tf.keras.datasets.mnist 数据集 使用 tf.keras.datasets.mnist 数据集 “Hello TensorFlow” Try it! 使用 tf Try it! 使用 tf.keras.Model 管理模型 历史上的 tf.keras.Model • Class tf.compat.v1.keras.Model • Class tf.compat.v1.keras.models.Model • Class tf.compat.v2.keras.Model • Class tf.compat.v2.keras.models.Model0 码力 | 52 页 | 7.99 MB | 1 年前3《Efficient Deep Learning Book》[EDL] Chapter 7 - Automation
the five target classes. import random import tensorflow as tf import numpy as np from tensorflow.keras import layers, losses, optimizers X = tf.random.uniform((20, 5)) Y = tf.squeeze( tf.one_hot(tf.random whose size is determined by the input size parameter. def create_model(size): return tf.keras.Sequential([ tf.keras.Input(shape=(5,5)), layers.Dense(size, activation='relu'), layers.Dense(5, activation='softmax') HyperBand choose the best values for these hyperparameters and see if we can do better. We will use the keras_tuner package which has an implementation of HyperBand. The hyperband algorithm requires two additional0 码力 | 33 页 | 2.48 MB | 1 年前3《Efficient Deep Learning Book》[EDL] Chapter 3 - Learning Techniques
displaying the results. import numpy as np import cv2 from matplotlib import pyplot as plt from keras.preprocessing.image import ImageDataGenerator from urllib.request import urlopen IMG_SIZE = 224 function (discussed in chapter 2) and the adam optimizer. from tensorflow.keras import applications as apps from tensorflow.keras import layers, optimizers, metrics DROPOUT_RATE = 0.2 LEARNING_RATE = = False # Create the full model with input, preprocessing, core and softmax layers. model = tf.keras.Sequential([ layers.Input([IMG_SIZE, IMG_SIZE, 3], dtype = tf.uint8), layers.Lambda(lambda x: tf0 码力 | 56 页 | 18.93 MB | 1 年前3《Efficient Deep Learning Book》[EDL] Chapter 2 - Compression Techniques
some fun stuff with it. import numpy as np import tensorflow as tf import tensorflow.keras as keras from keras.utils import np_utils import tensorflow_datasets as tfds def process_x(x): """Process 0 # Add one dimension for the channels. x = np.expand_dims(x, 3) return x def load_data(ds=tf.keras.datasets.mnist): """Returns the processed dataset.""" (train_images, train_labels), (test_images format # as MNIST, and is slightly harder. # (train_x, train_y), (test_x, test_y) = load_data(ds=tf.keras.datasets.fashion_mnist) Creating and Compiling the Model The create_model() function, described0 码力 | 33 页 | 1.96 MB | 1 年前3
共 44 条
- 1
- 2
- 3
- 4
- 5