![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
TensorFlow
文章平均质量分 58
AI_王布斯
这个作者很懒,什么都没留下…
展开
-
图像识别-花的分类(tensorflow实现)
本实例使用的数据集是3700张,包含5个种类的花。flower_photo:daisy(雏菊)/dandelion(蒲公英)/roses(玫瑰)/sunflower(向日葵)/tulips(郁金香)import matplotlib.pyplot as pltimport numpy as npimport osimport PIL # Python Imaging Libraryimport tensorflow as tffrom tensorflow import kerasfro原创 2021-09-08 19:45:24 · 1952 阅读 · 2 评论 -
深度学习-卷积神经网络代码详解
构造卷积神经网络CNN将形状为(高度,宽度,色彩通道数)的张量作为输入,忽略批次的大小。在本实例中,我们将配置CNN处理(32,32,3)的输入,通过参数input_shape传递给第一层来实现这个目的。model = models.Sequential()Sequential()方法是一个容器,描述了神经网络的网络结构,在Sequential()的输入参数中描述从输入层到输出层的网络结构。第一层卷积层:32个3*3的卷积核,使用Relu作为激活函数model.add(layers.Conv2原创 2021-09-07 19:06:24 · 5536 阅读 · 0 评论 -
TensorFlow-张量3
操作形状Reshaping a tensor is of great utility.import tensorflow as tf# Shape returns a `TensorShape` object that shows the size on each dimensionvar_x = tf.Variable(tf.constant([[1], [2], [3]]))print(var_x.shape)# result:(3,1)将张量转换为python列表。# You ca原创 2021-08-27 11:29:30 · 205 阅读 · 0 评论 -
TensorFlow-张量2
形状简介张量有形状。下面是几个相关术语:形状:张量的每个轴的长度(元素数量)。秩:张量轴数。标量的秩为 0,向量的秩为 1,矩阵的秩为 2。轴或维度:张量的一个特殊维度。大小:张量的总项数,即乘积形状向量注:虽然您可能会看到“二维张量”之类的表述,但 2 秩张量通常并不是用来描述二维空间。import tensorflow as tfrank_4_tensor = tf.zeros([3, 2, 4, 5])print("Type of every element:", rank_4_原创 2021-08-26 22:52:26 · 68 阅读 · 0 评论 -
TensorFlow-张量简介
基础知识张量具有统一的类型的多维数组,张量和numpy.array具有一定的相似性。张量的内容是无法改变的,只能创建新的张量。导入需要的包。import tensorflow as tfimport numpy as np下面来创建一些基本的张量。创建一个标量,标量包含单个值。# This will be an int32 tensor by default;rank_0_tensor = tf.constant(4)print(rank_0_tensor)# result: tf原创 2021-08-25 20:48:42 · 89 阅读 · 0 评论 -
TensorFlow_01_CNN实现图像分类
导入相关的包。# 导入tensorflowimport tensorflow as tffrom tensorflow.keras import datasets, layers, modelsimport matplotlib.pyplot as plt防止cudnn报错。physical_devices = tf.config.experimental.list_physical_devices('GPU')assert len(physical_devices) > 0, "N原创 2021-08-23 19:16:45 · 1778 阅读 · 0 评论