- 博客(18)
- 收藏
- 关注
原创 十四.自定义层
import tensorflow as tffrom tensorflow import kerasclass Linear(keras.layers.Layer):#继承 def __init__(self,units=32,input_dim=32):#单元数,输入向量维数。初始化方法 super(Linear,self).__init__()# 权重# w_init = tf.random_normal_initializer()#标准
2021-10-28 21:13:57
313
原创 十三. FCN
1.语义分割图片import tensorflow as tfimport osimport numpy as npimport matplotlib.pyplot as plt# Press the green button in the gutter to run the script.if __name__ == '__main__': img = tf.io.read_file('trimaps/yorkshire_terrier_174.png') img = tf
2021-10-28 15:23:17
224
原创 十二. 图像定位
1.图像位置数据解析import tensorflow as tfimport matplotlib.pyplot as pltfrom matplotlib.patches import Rectanglefrom lxml import etree#lxml是python的一个解析库,支持HTML和XML的解析import numpyimport globif __name__ == '__main__': img = tf.io.read_file('./images/Abys
2021-10-26 18:13:37
394
原创 图像svd分解
import numpy as npimport matplotlib.pyplot as pltfrom PIL import Imagedef load_image(path): im = Image.open(path) print(im.size) height = im.size[1] width = im.size[0] im = np.array(im) r = im[:,:,0] g = im[:,:,1] b = im
2021-10-25 21:43:53
567
原创 十一. 迁移学习
import tensorflow as tfimport glob as globdef load_process_image(path,label): image = tf.io.read_file(path) image = tf.image.decode_jpeg(image,channels=3) image = tf.image.resize(image,[256,256]) image = image/255 return image,label
2021-10-22 19:54:29
109
原创 十. Tensorboard
import tensorflow as tfimport datetimeimport os# Press the green button in the gutter to run the script.if __name__ == '__main__': (train_image, train_labels), (test_image, test_labels) = tf.keras.datasets.mnist.load_data() train_image = tf.e
2021-10-20 18:10:04
90
原创 九.微分与自定义训练
import tensorflow as tfif __name__ == '__main__': v = tf.Variable(0.0)#变量<tf.Variable 'Variable:0' shape=() dtype=float32, numpy=0.0> v.assign(5)#<tf.Variable 'UnreadVariable' shape=() dtype=float32, numpy=5.0> v.assign_add(1)#<
2021-10-19 20:02:55
125
原创 一. pandas入门介绍(一)
文章目录一.数据集二.查看数据三. 验证数据四.建立索引五.数据选取1. 选择列2.选择行3.指定行和列4.一定条件显示数据一.数据集https://www.gairuo.com/file/data/dataset/team.xlsx读取数据#读取数据 df = pd.read_excel('https://www.gairuo.com/file/data/dataset/team.xlsx') #或df = pd.read_excel('team.xlsx') print
2021-10-19 09:23:23
455
原创 八. airplane,lake图像分类
import tensorflow as tfimport numpy as npimport glob#glob是python自带的一个操作文件的相关模块import randomdef load_image(path): image = tf.io.read_file(path) image = tf.image.decode_jpeg(image,channels=3)#jpg,png,gif....经过压缩编码,所以读取之后要解码还原成一个三维矩阵 image =
2021-10-17 07:46:48
174
原创 七.卷积神经网络
import tensorflow as tfimport matplotlib.pyplot as pltimport pandasimport numpy as npif __name__ == '__main__': (train_images,train_labels),(test_images,test_labels)=tf.keras.datasets.fashion_mnist.load_data() train_images = train_images/255
2021-10-15 14:34:43
130
原创 六. tf.dataset输入模块
文章目录一. from_tensor_slices二. shuffle,repeat,square三. 实例一. from_tensor_slicesimport tensorflow as tfif __name__ == '__main__': #把给定的元组、列表和张量等数据进行特征切片,张量 dataset = tf.data.Dataset.from_tensor_slices([1,2,3,4,5]) for ele in dataset: prin
2021-10-14 09:35:57
280
原创 五. Droupt抑制过拟合
过拟合Drouptmodel.add(tf.keras.layers.Flatten(input_shape=(28, 28))) model.add(tf.keras.layers.Dense(128, activation='relu')) model.add(tf.keras.layers.Dropout(0.5))#激活50%神经元 model.add(tf.keras.layers.Dense(128, activation='relu'))
2021-10-13 19:50:30
523
原创 四. softmax多分类
多个选项的分类问题,用softmax.softmax把神经网络输出值变为概率分布,要求每个样本必须属于某个类别,且所有类别均被覆盖。categorical_crossentropy和sparse_categorical_crossentropy都是计算多分类crossentropy的,只是对y的格式要求不同。1)如果是categorical_crossentropy,那y必须是one-hot处理过的2)如果是sparse_categorical_crossentropy,那y就是原始的整数形式,比
2021-10-13 15:52:11
659
1
原创 三. 逻辑回归与交叉熵
逻辑回归给出"是"或"否"分类问题使用交叉熵损失函数更有效binary_crossentropy计算二元交叉熵import tensorflow as tfimport pandas as pdimport matplotlib.pyplot as pltif __name__ == '__main__': data = pd.read_csv('dataset/credit-a.csv',header=None)#默认情况下,会把数据内容的第一行默认为字段名标题。header=Non
2021-10-13 15:06:00
173
原创 二. 多层感知器
import tensorflow as tfimport pandas as pdimport matplotlib.pyplot as pltif __name__ == '__main__': data = pd.read_csv('dataset/Advertising.csv') print(data.head())#显示前五行数据 """ TV radio newspaper sales TV,radio,newspaper预测sales
2021-10-12 20:03:44
88
原创 一. tf.keras线性回归
Model: "sequential"_________________________________________________________________Layer (type) Output Shape Param # =================================================================dense (Dense) (None, 1)
2021-10-12 19:12:24
177
原创 unity 简易udp通信
using UnityEngine;using System.Net;using System.Net.Sockets;using System.Threading;using System;using System.Text;using UnityEngine.UI;public class Udp : MonoBehaviour{ public InputField inputField; void Start() { inputField =.
2021-10-10 11:45:40
1538
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人