![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
函数参数
清纯世纪
知识的搬运工
展开
-
numpy中的log和ln函数介绍
np.log10()指代的便是数学中使用的lg函数。np.log()指代的便是数学中使用的ln函数。原创 2023-11-03 10:11:09 · 1075 阅读 · 0 评论 -
nn.LayerNorm解释
我们输入一个参数,这个参数就必须与最后一个维度对应。但是我们也可以输入多个维度,但是必须从后向前对应。原创 2023-11-02 19:27:59 · 913 阅读 · 0 评论 -
sklearn中主成分分析PCA参数解释
【代码】sklearn中主成分分析PCA参数解释。原创 2023-08-20 21:46:24 · 940 阅读 · 0 评论 -
np.repeat() 复制函数
【代码】np.repeat() 复制函数。原创 2023-08-09 23:18:54 · 394 阅读 · 0 评论 -
np.clip截取函数的使用方法
np.clip是一个截取函数,用于截取数组中小于或者大于某值的部分,并使得被截取部分等于固定值。该函数的作用是将数组a中的所有数限定到范围a_min和a_max中。原创 2023-05-05 14:03:53 · 475 阅读 · 0 评论 -
Pytorch中的仿射变换(F.affine_grid)
在pytorch框架中, F.affine_grid 与 F.grid_sample(torch.nn.functional as F)联合使用来对图像进行变形。F.affine_grid 根据形变参数产生sampling grid,F.grid_sample根据sampling grid对图像进行变形。需要注意,pytorch中的F.grid_sample是反向采样,这就导致了形变参数与直觉是相反的(后面有实验验证)(例如放射矩阵中的缩放因子是0.5,会使目标图像扩大两倍;原创 2023-04-21 11:32:01 · 2566 阅读 · 2 评论 -
Pytorch 的复制函数 torch.repeat_interleave() 和 torch.repeat()
1、torch.repeat_interleave()repeat_interleave(self, repeats, dim)self:张量数据repeats:需要复制的份数dim:需要复制的维度import torcha=torch.Tensor([[1,2,3,4], [2,3,4,5]])print("--------------------------")print(a.repeat_interleave(2, dim=0))原创 2022-03-11 12:05:29 · 5073 阅读 · 0 评论 -
argparse.ArgumentParser() 用法解析
目录1、创建 ArgumentParser() 对象2、调用 add_argument() 方法添加参数3、调用 parse_args()方法解析参数4、附录:1)ArgumentParser()参数说明2、add_argument()参数说明3)使用示范主要有三个步骤:创建 ArgumentParser() 对象 调用 add_argument() 方法添加参数 使用 parse_args() 解析添加的参...原创 2021-11-28 12:45:03 · 3061 阅读 · 0 评论 -
np.cumsum() 函数的解释
def cumsum(self, axis=None, dtype=None, out=None): """ a.cumsum(axis=None, dtype=None, out=None) Return the cumulative sum of the elements along the given axis. Refer to `numpy.cumsum` for ful...原创 2021-11-12 15:03:27 · 4948 阅读 · 3 评论 -
np.bincount(x)的简单解释与用法
np.bincount(x) import numpy as npx = np.array([5,6,5,4,2,3,8,2,1,5,6,9,8])y = np.bincount(x)print(y)# 输出D:\Anaconda3\python.exe "D:/0_me_python/Jupyter Notebook/code/01.py"[0 1 2 1 1 3 2 0 2 1]Process finished with exit code 0np.bi...原创 2021-11-12 13:12:59 · 385 阅读 · 0 评论 -
scatter_()函数——可对标签进行 one-hot 编码
scatter_(input, index, dim):将src中数据根据index中的索引按照dim的方向填进input。input: 填入的值index:填在那个元素位置的索引(二维)dim:沿着哪个维度进行索引填充代码:import torchclass_num = 10batch_size = 5label = torch.LongTensor([0,1,4,2,3])print(label)one_hot = torc...原创 2021-09-02 12:13:33 · 540 阅读 · 0 评论 -
一种快速求得两个二维数组中有多少数对应相等的方法
代码:import numpy as npa = np.array([[2,5,4,7,5,6], [2,5,4,7,5,6], [2,5,4,7,5,6], [2,5,4,7,5,6], [2,5,4,7,5,6], [2,5,4,7,5,6]])b = np.array([[2,5,4,7,5,6], [2,5,4,8,5,原创 2021-09-02 10:02:10 · 375 阅读 · 0 评论 -
cv2.resize() 各参数解释
1、cv2.resize(src, dsize, dst=None, fx=None, fy=None, interpolation=None) —— 将原始图像调整为指定大小。各参数释义:scr:原始图像 dsize:输出图像的尺寸(元组方式) dst:输出图像 fx:沿水平轴缩放的比例因子 fy:沿垂直轴缩放的比例因子 interpolation:插值方法,有以下5种:interpolat...原创 2021-09-02 09:04:56 · 21819 阅读 · 6 评论 -
opencv 的 cv2.imread() 与 PIL 的 Image.open() 参数解释
作用:cv2.imread(filepath,flags)用于读取图片文件参数:filepath:要读入图片的完整路径 flags:读入图片的标志 cv2.IMREAD_COLOR:默认参数,读入一副彩色图片,忽略alpha通道。可以直接写1。 cv2.IMREAD_GRAYSCALE:读入灰度图片。可以直接写0。 cv2.IMREAD_UNCHANGED:顾名思义,读入完整图片,包括alpha通道。可以直接写-1 cv2.IMREAD_COLOR:加载彩色图片,这个是默认参数,可.原创 2021-09-02 08:26:25 · 4067 阅读 · 0 评论