神经网络例程-梯度下降法更新权值

2023-05-16

以下代码来自Deep Learning for Computer Vision with Python第九章。

 

一、梯度下降法(Gradient Decent)

# import the necessary packages
from sklearn.model_selection import train_test_split
from sklearn.metrics import classification_report
from sklearn.datasets import make_blobs
import matplotlib.pyplot as plt
import numpy as np
import argparse

def sigmoid_activation(x):
	# compute the sigmoid activation value for a given input
	return 1.0 / (1 + np.exp(-x))

def predict(X, W):
	# take the dot product between our features and weight matrix
	preds = sigmoid_activation(X.dot(W))
	
	# apply a step function to threshold the outputs to binary
	# class labels
	preds[preds <= 0.5] = 0
	preds[preds > 0] = 1

	# return the predictions
	return preds
	
# construct the argument parse and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument("-e", "--epochs", type=float, default=100,
	help="# of epochs")
ap.add_argument("-a", "--alpha", type=float, default=0.01,
	help="learning rate")
args = vars(ap.parse_args())

# generate a 2-class classification problem with 1,000 data points,
# where each data point is a 2D feature vector
(X, y) = make_blobs(n_samples=1000, n_features=2, centers=2,
	cluster_std=1.5, random_state=1)
y = y.reshape((y.shape[0], 1))

# insert a column of 1's as the last entry in the feature
# matrix -- this little trick allows us to treat the bias
# as a trainable parameter within the weight matrix
X = np.c_[X, np.ones((X.shape[0]))]

# partition the data into training and testing splits using 50% of
# the data for training and the remaining 50% for testing
(trainX, testX, trainY, testY) = train_test_split(X, y,
	test_size=0.5, random_state=42)
	
# initialize our weight matrix and list of losses
print("[INFO] training...")
W = np.random.randn(X.shape[1], 1)
losses = []

# loop over the desired number of epochs
for epoch in np.arange(0, args["epochs"]):
	# take the dot product between our features 'X' and the weight
	# matrix 'W', then pass this value through our sigmoid activation
	# function, thereby giving us our predictions on the dataset
	preds = sigmoid_activation(trainX.dot(W))

	# now that we have our predictions, we need to determine the
	# 'error', which is the difference between our predictions and
	# the true values
	error = preds - trainY
	loss = np.sum(error ** 2)
	losses.append(loss)

	# the gradient descent update is the dot product between our
	# features and the error of the predictions
	gradient = trainX.T.dot(error)

	# in the update stage, all we need to do is "nudge" the weight
	# matrix in the negative direction of the gradient (hence the
	# term "gradient descent" by taking a small step towards a set
	# of "more optimal" parameters
	W += -args["alpha"] * gradient

	# check to see if an update should be displayed
	if epoch == 0 or (epoch + 1) % 5 == 0:
		print("[INFO] epoch={}, loss={:.7f}".format(int(epoch + 1),
			loss))
			
# evaluate our model
print("[INFO] evaluating...")
preds = predict(testX, W)
print(classification_report(testY, preds))

# plot the (testing) classification data
plt.style.use("ggplot")
plt.figure()
plt.title("Data")
plt.scatter(testX[:, 0], testX[:, 1], marker="o", c=testY, s=30)

# construct a figure that plots the loss over time
plt.style.use("ggplot")
plt.figure()
plt.plot(np.arange(0, args["epochs"]), losses)
plt.title("Training Loss")
plt.xlabel("Epoch #")
plt.ylabel("Loss")
plt.show()

本例子的神经网络是只有两层,输入3,输出1,(3-1)。且输入3个神经元中,最后一个是输入为1。是为了将偏移(bias)b值放到权重矩阵W中。

Python语言,使用了sklearn、matplotlib、numpy、imutils这几个库。

这个例程中,学习的内容如下:

1、细胞元激活函数

本例子采用sigmoid函数。

sigmoid函数曲线如下:

理论上,神经网络中每个神经元只有两种状态:有反应、无反应,即1和0。但这里允许神经元具有0-1V之间的任意电压。且输入输出符合Sigmoid曲线。

2、predict预测函数

预测函数中,把输入的变量X(3行1列矩阵)经过转置变成1行3列,乘以权值W(3行1列),得到输出。

3、网络初始化

使用make_blobs函数生成了1000个样品,每个样品两个参数。即输入矩阵是1000行2列。输出只有一个参数,是1行1000列。

X = np.c_[X, np.ones((X.shape[0]))]这语句可以在输入矩阵最低加上一行1,同时把权值W(weights)矩阵初始化为3行1列,最后1列是偏置b(bias)。

线性分类基本公式是:y_i=f\left ( x_i,W,b \right )=Wx_i+b

可以把b放进权重W矩阵的最后一行,这样的好处是,可以在训练W矩阵时,也训练了b参数。

train_test_split函数可以将样品(X,y)按比例分配成一部分用于训练,一部分用于测试。

4、网络训练

这例子,更新权重矩阵W的频率是把全部训练样品处理一次,才更新一次的权重。因此学习速度十分缓慢。

error是全部训练样品的预测结果,和实际结果y想减。

损失函数是error中每个元素的平方和:loss = np.sum(error ** 2) 

更新权值的公式是

error = preds - trainY

gradient = trainX.T.dot(error)

W += -args["alpha"] * gradient

5、网络测试
测试使用了classification_report.第一个参数是实际值,第二个参数是预测值。报告可自动生成精度、测试样品数量。
print(classification_report(testY, predict(testX, W)))

6、文件执行结果

========= RESTART: E:\FENG\workspace_python\ch9_gradient_descent.py =========
[INFO] training...
[INFO] epoch=1, loss=155.6216601
[INFO] epoch=5, loss=0.1092728
[INFO] epoch=10, loss=0.1032095
[INFO] epoch=15, loss=0.0976591
[INFO] epoch=20, loss=0.0925605
[INFO] epoch=25, loss=0.0878624
[INFO] epoch=30, loss=0.0835212
[INFO] epoch=35, loss=0.0794996
[INFO] epoch=40, loss=0.0757656
[INFO] epoch=45, loss=0.0722911
[INFO] epoch=50, loss=0.0690518
[INFO] epoch=55, loss=0.0660262
[INFO] epoch=60, loss=0.0631954
[INFO] epoch=65, loss=0.0605427
[INFO] epoch=70, loss=0.0580530
[INFO] epoch=75, loss=0.0557131
[INFO] epoch=80, loss=0.0535110
[INFO] epoch=85, loss=0.0514360
[INFO] epoch=90, loss=0.0494784
[INFO] epoch=95, loss=0.0476294
[INFO] epoch=100, loss=0.0458811
[INFO] evaluating...
             precision    recall  f1-score   support

          0       1.00      1.00      1.00       250
          1       1.00      1.00      1.00       250

avg / total       1.00      1.00      1.00       500


Traceback (most recent call last):
  File "E:\FENG\workspace_python\ch9_gradient_descent.py", line 92, in <module>
    plt.scatter(testX[:, 0], testX[:, 1], marker="o", c=testY, s=30)
  File "D:\ProgramFiles\Python27\lib\site-packages\matplotlib\pyplot.py", line 3470, in scatter
    edgecolors=edgecolors, data=data, **kwargs)
  File "D:\ProgramFiles\Python27\lib\site-packages\matplotlib\__init__.py", line 1855, in inner
    return func(ax, *args, **kwargs)
  File "D:\ProgramFiles\Python27\lib\site-packages\matplotlib\axes\_axes.py", line 4279, in scatter
    .format(c.shape, x.size, y.size))
ValueError: c of shape (500, 1) not acceptable as a color sequence for x with size 500, y with size 500

 

二、随机梯度下降法(Stochastic Gradient Decent)

# import the necessary packages
from sklearn.model_selection import train_test_split
from sklearn.metrics import classification_report
from sklearn.datasets import make_blobs
import matplotlib.pyplot as plt
import numpy as np
import argparse

def sigmoid_activation(x):
	# compute the sigmoid activation value for a given input
	return 1.0 / (1 + np.exp(-x))
	
def predict(X, W):
	# take the dot product between our features and weight matrix
	preds = sigmoid_activation(X.dot(W))

	# apply a step function to threshold the outputs to binary
	# class labels
	preds[preds <= 0.5] = 0
	preds[preds > 0] = 1

	# return the predictions
	return preds
	
def next_batch(X, y, batchSize):
	# loop over our dataset ‘X‘ in mini-batches, yielding a tuple of
	# the current batched data and labels
	for i in np.arange(0, X.shape[0], batchSize):
		yield (X[i:i + batchSize], y[i:i + batchSize])

# construct the argument parse and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument("-e", "--epochs", type=float, default=100,
	help="# of epochs")
ap.add_argument("-a", "--alpha", type=float, default=0.01,
	help="learning rate")
ap.add_argument("-b", "--batch-size", type=int, default=32,
	help="size of SGD mini-batches")
args = vars(ap.parse_args())

# generate a 2-class classification problem with 1,000 data points,
# where each data point is a 2D feature vector
(X, y) = make_blobs(n_samples=1000, n_features=2, centers=2,
	cluster_std=1.5, random_state=1)
y = y.reshape((y.shape[0], 1))

# insert a column of 1’s as the last entry in the feature
# matrix -- this little trick allows us to treat the bias
# as a trainable parameter within the weight matrix
X = np.c_[X, np.ones((X.shape[0]))]

# partition the data into training and testing splits using 50% of
# the data for training and the remaining 50% for testing
(trainX, testX, trainY, testY) = train_test_split(X, y,
	test_size=0.5, random_state=42)
	
# initialize our weight matrix and list of losses
print("[INFO] training...")
W = np.random.randn(X.shape[1], 1)
losses = []

# loop over the desired number of epochs
for epoch in np.arange(0, args["epochs"]):
	# initialize the total loss for the epoch
	epochLoss = []

	# loop over our data in batches
	for (batchX, batchY) in next_batch(X, y, args["batch_size"]):
		# take the dot product between our current batch of features
		# and the weight matrix, then pass this value through our
		# activation function
		preds = sigmoid_activation(batchX.dot(W))

		# now that we have our predictions, we need to determine the
		# ‘error‘, which is the difference between our predictions
		# and the true values
		error = preds - batchY
		epochLoss.append(np.sum(error ** 2))
		
		# the gradient descent update is the dot product between our
		# current batch and the error on the batch
		gradient = batchX.T.dot(error)

		# in the update stage, all we need to do is "nudge" the
		# weight matrix in the negative direction of the gradient
		# (hence the term "gradient descent") by taking a small step
		# towards a set of "more optimal" parameters
		W += -args["alpha"] * gradient
		
	# update our loss history by taking the average loss across all
	# batches
	loss = np.average(epochLoss)
	losses.append(loss)

	# check to see if an update should be displayed
	if epoch == 0 or (epoch + 1) % 5 == 0:
		print("[INFO] epoch={}, loss={:.7f}".format(int(epoch + 1),
			loss))
			
# evaluate our model
print("[INFO] evaluating...")
preds = predict(testX, W)
print(classification_report(testY, preds))

# plot the (testing) classification data
plt.style.use("ggplot")
plt.figure()
plt.title("Data")
plt.scatter(testX[:, 0], testX[:, 1], marker="o", c=testY, s=30)

# construct a figure that plots the loss over time
plt.style.use("ggplot")
plt.figure()
plt.plot(np.arange(0, args["epochs"]), losses)
plt.title("Training Loss")
plt.xlabel("Epoch #")
plt.ylabel("Loss")
plt.show()

与第一种方法不同之处在于,每处理一小量数据,即按照该段数据更新权值矩阵。

执行结果如下:

================ RESTART: E:\FENG\workspace_python\ch9_sgd.py ================
[INFO] training...
[INFO] epoch=1, loss=0.5633928
[INFO] epoch=5, loss=0.0116136
[INFO] epoch=10, loss=0.0063118
[INFO] epoch=15, loss=0.0058116
[INFO] epoch=20, loss=0.0054206
[INFO] epoch=25, loss=0.0050830
[INFO] epoch=30, loss=0.0047875
[INFO] epoch=35, loss=0.0045260
[INFO] epoch=40, loss=0.0042924
[INFO] epoch=45, loss=0.0040821
[INFO] epoch=50, loss=0.0038914
[INFO] epoch=55, loss=0.0037176
[INFO] epoch=60, loss=0.0035583
[INFO] epoch=65, loss=0.0034118
[INFO] epoch=70, loss=0.0032764
[INFO] epoch=75, loss=0.0031509
[INFO] epoch=80, loss=0.0030342
[INFO] epoch=85, loss=0.0029253
[INFO] epoch=90, loss=0.0028235
[INFO] epoch=95, loss=0.0027281
[INFO] epoch=100, loss=0.0026385
[INFO] evaluating...
             precision    recall  f1-score   support

          0       1.00      1.00      1.00       250
          1       1.00      1.00      1.00       250

avg / total       1.00      1.00      1.00       500


Traceback (most recent call last):
  File "E:\FENG\workspace_python\ch9_sgd.py", line 109, in <module>
    plt.scatter(testX[:, 0], testX[:, 1], marker="o", c=testY, s=30)
  File "D:\ProgramFiles\Python27\lib\site-packages\matplotlib\pyplot.py", line 3470, in scatter
    edgecolors=edgecolors, data=data, **kwargs)
  File "D:\ProgramFiles\Python27\lib\site-packages\matplotlib\__init__.py", line 1855, in inner
    return func(ax, *args, **kwargs)
  File "D:\ProgramFiles\Python27\lib\site-packages\matplotlib\axes\_axes.py", line 4279, in scatter
    .format(c.shape, x.size, y.size))
ValueError: c of shape (500, 1) not acceptable as a color sequence for x with size 500, y with size 500

对比可见,SGD的损失下降比较快。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

神经网络例程-梯度下降法更新权值 的相关文章

  • Windows 下安装 Ubuntu 双系统

    转载自 xff1a Windows 下安装 Ubuntu 双系统 一 准备 xff1a xff08 一 xff09 准备工具 xff1a U盘一个 xff08 请提前备份U盘里面的资料 xff0c 因为后面操作要格式化U盘 xff09 Ub
  • FreeRTOS 互斥信号量和二值信号量对比

    互斥信号量 1 有优先级继承 2 尽量不要在中断中调用 3 xSemaphoreCreateMutex创建后 xff0c 可以直接take使用 二值信号量 1 无优先级继承 2 允许在中断中调用 3 可以当做标志位来使用 4 xSemaph
  • 工作站常见问题处理

    常见问题1 xff1a 系统重启网桥消失 1 现象 公司的工作站自从搬到新地方以来 xff0c 每次关机再启动 xff0c 或重启后 xff0c 都会出现网桥消失的情况 2 分析 查找了网桥和网卡的配置 xff0c 也觉得没有什么问题 xf
  • Ubuntu17 安装ProxyChains4

    span class hljs preprocessor 切换目录 span cd Downloads span class hljs preprocessor 下载 span git clone https span class hljs
  • c++实现ip是否在同一个网段的判断

    废话不说直接贴代码 xff1a ip的数据结构 typedef struct IP Struct ip地址划分后各个域的值 struct IpAdress Struct int first int second int third int
  • 计算ip地址是否在同一网段

    一 要判断两个IP地址是不是在同一个网段 xff0c 就将它们的IP地址分别与子网掩码做与运算 xff0c 得到的结果 gt 网络号 xff0c 如果网络号相同 xff0c 就在同一子网 xff0c 否则 xff0c 不在同一子网 例 xf
  • 面试官再问你 HashMap 底层原理,就把这篇文章甩给他看

    前言 HashMap 源码和底层原理在现在面试中是必问的 因此 xff0c 我们非常有必要搞清楚它的底层实现和思想 xff0c 才能在面试中对答如流 xff0c 跟面试官大战三百回合 文章较长 xff0c 介绍了很多原理性的问题 xff0c
  • Java核心技术读书笔记——集合

    本笔记为读 Java核心技术 卷1 第9版 而记录 目录 1 集合接口与实现相互分离1 1Java类库中集合接口和迭代器接口1 2泛型实用方法 2 具体的集合2 1链表2 2数组列表2 3散列表2 4树集2 5对象的比较2 6队列与双端队列
  • #每天一篇论文#(213/365) Joint 2D-3D-Semantic Data for Indoor Scene Understanding 结合2D-3D室内语义数据场景理解

    Joint 2D 3D Semantic Data for Indoor Scene Understanding http 3Dsemantics stanford edu A 摘要 本文提供了一个大型室内空间的数据集 xff0c 它提供了
  • 我心中的AI

    首先说一下我的身份 xff0c 一个刚刚踏入IT行业的年轻小伙 xff0c 相信在坐的大家心中都会有一个小小的梦想 拥有一个 大黄蜂 xff0c 这是我从事这个职业的原因所在 人工智能从诞生以来 xff0c 理论和技术日益成熟 xff0c
  • 2021-09-04 **mininet+flowvisor+floodlight实现网络切片功能**

    mininet 43 flowvisor 43 floodlight实现网络切片功能 这个项目所使用的软件flowvisor 和floodlight 都已经过时了网上能找到的资料太少了 xff0c 整个项目搭建过程中遇到的坑太多了 花了大量
  • CentOS 6.5 时间同步

    1 检查是否安装ntpdate rpm qa grep ntp 有返回说明已经安装 xff0c 若无返回 xff0c 执行安装命令进行安装 2 安装ntpdate yum install y ntp ntpdate 3 修改时区 vi et
  • 在linux安装elasticsearch-7.6.2 所遇到的坑

    64 TOC在linux安装elasticsearch 7 6 2 所遇到的坑 问题描述 刚接触学习elasticsearch xff0c 在linux环境安装就遇到了一些问题 运行角色问题 elasticsearch不建议使用root账号
  • freeRTOS多任务启动流程和源码分析

    最近学习白问网韦东山老师在B站开源的freeRTOS课程 xff0c 网址 xff1a 韦东山直播公开课 xff1a RTOS实战项目之实现多任务系统 第1节 xff1a 裸机程序框架和缺陷 哔哩哔哩 bilibili和7天物联网训练营 第
  • mkdir 创建目录命令

    mkdir命令 mkdir 命令简介 mkdir命令用来创建指定的名称的目录 xff0c 要求创建用户在当前目录权限 xff0c 并且制定的目录名不能是当前目录中已有的目录 命令格式 mkdir 选项 目录 命令参数 m mode 61 模
  • UCOS-II任务间通信(信号量、邮箱、消息队列)

    保护任务之间的共享数据和提供任务之间的通讯方法 xff1a 利用宏OS ENTER CRITICAL 和OS EXIT CRITICAL 来关闭和打开中断 xff0c 这可以用于多任务或者任务和ISR共享某些数据时可以采用这种方法 利用OS
  • 高考到程序员,从娇惯到耐艹

    现在的我刚好是走出校门没两天 xff0c 踏入it行业的程序员 此刻的心情 xff0c 有与挚友分别的不舍 xff0c 有悔恨当初的颓废 xff0c 还有一种提到望月的闯劲儿 总之心理活动错综复杂 xff0c 和高考那会儿玩世不恭的我大不相
  • AI浪潮下需要思考的事

    一 AI的意义 AI xff0c 即ArtificialIntelligence的缩写 xff0c 它是研究如何以人类的智能行为以及思考方式来解决问题的计算机科学的一个分支 目前主要研究的领域包括语音识别 图像识别 自然语言处理以及在某一特
  • Hive(二) -- ddl

    Hive支持标准SQL xff0c 同时又有自己的特点 xff0c 属于方言版SQL Hive的ddl主要包含对于数据库和表的查询 创建和删除 dml包含数据查询和插入 xff0c 其中插入有load和insert两种方式 xff0c 针对
  • autolisp的各种框(DCL)

    一 DCL是什么 前面的事情 xff0c 是通过在命令行输入参数来实现某个指令的 xff0c 而DCL是通过用户界面来实现交互的 下图就是一个典型的DCL 二 DCL怎么用 xff1f 首先说明 xff0c DCL不像lisp xff0c

随机推荐

  • 在hbase shell中过滤器的简单使用

    在hbase shell中查询数据 xff0c 可以在hbase shell中直接使用过滤器 xff1a span class hljs comment hbase shell span gt scan span class hljs st
  • kswapd0占用CPU过高问题处理

    项目场景 xff1a kswapd0占用CPU过高 xff0c 严重影响服务器及虚拟机的使用 问题描述 最近同事反应工作站上的虚拟机太慢了 到虚拟机上看了一下 xff0c 资料占得很满 xff0c 一点很长时间没反应 xff0c 卡得不行
  • QQ新版表情序号及对应

    在学习QQ机器人发送消息接口时遇到了新版表情发送问题 xff0c 以及QQ新版表情序号跟面板中不是完全对应的 xff0c 于是遍历了0 500号表情 xff0c 作一一输出 xff0c 得到了大部分表情的序号及对照如下 xff1a 表情使用
  • Java判断String字符串是否相等时容易出现的问题

    在程序设计中 xff0c 我们经常需要判断字符串是否相等 xff0c 如if a 61 61 b xff0c 但在java中 xff0c a和b两个字符串值相等 xff0c 但有时会判断出不相等的情况 例如 xff1a span class
  • ALDS1_2_C:Stable Sort

    题目链接 xff1a ALDS1 2 C Stable Sort 题目概要 xff1a 扑克牌中存在数字相同而花色不同的情况 xff0c 该题需要利用扑克牌这一特性来比较两种排序 xff1a 冒泡排序 选择排序 xff08 题中给出伪代码
  • jupyter notebook 安装nbextension不显示问题

    2023年4月18日 更新 评论区一位老哥的方法 xff0c 不用下载mark js xff0c 复制一份源目录里的文件改名即可 xff0c 经测试 xff0c 有效 xff0c 评论已置顶 首先放一下安装nbextensions的步骤 如
  • Python对象序列化性能比较:pickle、json、msgpack

    目录 前言三种工具介绍PickleJsonMsgpack性能参考 xff08 由ChatGPT给出 xff09 实际测试测试条件测试结果 前言 最近在做毕设 xff0c 需要读取处理大量的数据 xff0c txt中文文本 xff0c 大概有
  • IRQL_NOT_LESS_OR_EUQAL,间歇性蓝屏,4800h笔记本,暗影精灵6,解决办法,蓝屏问题排查

    目录 前言机器配置蓝屏情况已测试方法及思路前期准备使用WinDbg分析蓝屏文件软件 系统排查 xff1a 驱动排查 xff1a 系统排查 硬件排查硬件检测硬件替换 送修 已知解决办法总结 前言 本文章所列出解决方法适用于AMD Ryzen
  • 单片机PWM输出原理与实践

    一 什么是PWM xff1f PWM xff08 Pulse Width Modulation xff09 脉冲宽度调制 xff0c 它是通过对一系列脉冲的宽度进行调制 xff0c 等效出所需要的波形 xff08 包含形状以及幅值 xff0
  • 数字IC/FPGA面试笔试准备(自用填坑中)

    文章目录 前言常见的IC问题数字电路基础问题Verilog amp SV 跨时钟域信号处理类CRG 同步与异步复位综合与时序分析类低功耗方法STA 静态时序分析 DC综合RTL设计 包含手撕代码 总线问题AXIAPBAHB 体系结构的问题R
  • 时序图工具哪家强?

    设计时序是基本功 xff0c 怎样才能高效的设计时序图呢 xff1f 下面是我搜集到的工具以及我目前在用的工具 xff0c 希望大家能找到最适合自己的工具 Visio 使用步骤 Visio时序图工具 xff0c 其中有一些做好的模具 xff
  • FIFO设计笔记(双口RAM、同步FIFO、异步FIFO)Verilog及仿真

    文章目录 0 前言0 1 FIFO0 2 FIFO与RAM 1 异步双口RAM1 1 原理1 2 Verilog代码1 3 tb仿真 2 FIFO设计前瞻知识2 1 格雷码2 1 1 二进制转格雷码Verilog代码tb仿真 2 1 2 格
  • el-table在行单击时获取行的index

    一 涉及参数及事件 参数说明类型类型说明row class name行的 className 的回调方法 xff0c 也可以使用字符串为所有行设置一个固定的 className Function row rowIndex String ro
  • 时序分析与时序约束知识总结

    文章目录 时序分析如何查看时序报告时序分析的分类和任务HOLD违例修复 xff1a SETUP违例修复 xff1a 时序违例的修复 时序约束约束的分类时序约束的作用SDF文件OCVPVT共同路径悲观效应 CPP setup time与hol
  • Ubuntu 遭遇 无法打开锁文件 /var/lib/dpkg/lock - open (13: 权限不够)解决方案:

    作者本人最近在自学linux xff0c 一是作为遇到的问题的笔记 xff0c 二是希望给遇到一样问题的同学一个解决方案 有三个解决方案 xff1a 一 xff0c 在终端输入 sudo passwd root 然后输入两次密码 再输入 s
  • VS error c4996: 'fopen': This function or variable may be unsafe 解决方案

    一 摘要 在调用图像处理函数 xff0c 或者文字处理函数的时候 xff0c 会出现类似下面这种报错 错误 C4996 39 fopen 39 This function or variable may be unsafe Consider
  • 解决word中无法粘贴问题(Ctrl+V失灵问题)

    1 问题描述 最近打开word xff0c 发现ctrl 43 v不管用了 xff0c 怎么回事呢 xff1f 昨天还好好的 xff0c 怎么突然不灵了呢 后来发现每次打开都会提示MathType的问题 xff0c 我想肯定是这个插件惹的祸
  • 解决“双系统删除其中一个,BIOS仍然有其启动项”问题

    1 打开win10下的磁盘管理工具 xff0c 按Windows键 43 X键就可以在弹出来的菜单中找到磁盘管理 xff0c 打开后找到你当时安装ubuntu的分区 xff0c 在哪个分区右击删除卷即可 2 刚才已经删除了Ubuntu的系统
  • Ubuntu | 你的内存不够啦:c++: internal compiler error: Killed (program cc1plus)

    1 问题描述 在开发板上编译opencv的时候报了一个错 c 43 43 internal compiler error Killed program cc1plus Please submit a full bug report 主要是在
  • 神经网络例程-梯度下降法更新权值

    以下代码来自Deep Learning for Computer Vision with Python第九章 一 梯度下降法 xff08 Gradient Decent xff09 import the necessary packages