自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(52)
  • 收藏
  • 关注

原创 c++函数模板学习

c++模板学习

2023-03-06 16:08:49 457 1

原创 c++关于txt文件的相关操作

c++中txt文件的相关处理

2023-02-16 14:16:36 241

原创 C++ const学习

const修饰指针

2023-02-16 14:06:04 811 1

原创 SQL学习内容

SQL中的DDL,DML,DQL

2022-12-15 12:36:02 483

原创 数据库相关概念

【代码】数据库相关概念。

2022-12-09 12:00:46 457

原创 c++ 中string、char*、char a[]

c++ 中的 string、char *、char a[]

2022-11-28 14:36:37 381

原创 行人重识别评价指标

reid的评判指标和代码

2022-10-02 17:56:19 1076

原创 leecode22 生成有效的括号

生成有效的括号

2022-09-27 12:32:09 87

原创 nn.TripletMarginLoss 和 nn.MarginRankingLoss

triplet loss

2022-09-24 14:19:17 749 1

原创 cv2.polylines

opencv

2022-07-27 16:24:16 1311

转载 损失函数之Diou和Ciou loss

损失函数DIoU CIoU

2022-07-24 16:01:45 382

原创 python去除特定字符

python 去除特定字符

2022-07-16 16:10:12 1092

原创 torch.max()和numpy.max()使用辨析

torch.max()

2022-07-12 16:36:24 482

原创 np.where 和 torch.where 用法

numpy.where() 有两种用法:numy.where(condition)只有condiiton,输出满足condition的元素的下标, 这里的坐标以tuple的形式给出,通常原数组有多少维,输出的tuple中就包含几个数组,分别对应符合条件元素的各维坐标torch.wheretorch.where()函数的作用是按照一定的规则合并两个tensor类型...

2022-06-30 15:54:09 512

原创 opencv 读取图片详解

最近在做深度学习目标检测中,用opencv读图,做翻转等等操作,发现自己之前对于opencv读取图片的数据存储理解不够全面,现在特做总结如下:opencv读取图片是从左边第一个像素点开始读取,由于是彩色RGB图片,所以每个像素点处会有三个值,(opencv是按照 BRG 的顺序读取像素值),依次遍历每一行,每一行都分别是一个 (width, 3) 的numpy格式的二维数组,最后将每一行的这个二维数组都添加到一个大数组中,形成一个三个数组,也就会最后 img.shape 输出的 (height, widt

2022-06-26 15:10:10 4784

原创 python 类中 __call__ 和 __getitem__ 的用法

python 类中 __call__ 和 __getitem__ 用法

2022-06-26 12:26:15 504

原创 准确率(precision) 召回率(recall) mAP计算

precision 和 recall

2022-06-14 09:22:39 1208

原创 repeat()、tile() 在numpy和torch中的使用辨析

torch.repeat()

2022-05-29 23:24:05 1177

原创 expand() 函数在pytorch和numpy中的使用

Tensor.expand()tensor.expand()函数可以将维度值包含 1 的Tensor(如:torch.Size([1, n])或者torch.Size([n, 1]))的维度进行扩展。其具体的扩展规则如下:只能对维度值包含 1 的张量Tensor进行扩展,无需扩展的维度保持不变或置-1,即:Tensor的size必须满足:torch.Size([1, n]) 或者 torch.Size([n, 1]) 。扩展的Tensor不会分配新的内存,只是原来的基础上创建新的视图并返回;应用

2022-05-29 16:34:53 1659

原创 python 和 pytorch中的矩阵乘法

python和pytorch中的矩阵乘法

2022-05-28 23:08:54 569

原创 transpose() 函数在numpy和pytorch中的比较

transpose 在 numpy和pytorch中的比较

2022-05-28 17:26:40 279

原创 functools partial详解

直接举例说明from functools import partialdef add_func(a, b): return a + bif __name__ == "__main__": add_test1 = partial(add_func, 1) print(add_test1(2)) # 3 print(add_test1(4)) # 5我们首先定义一个函数 add_func ,它传入两个参数,返回这两个参数之和,接着使用 partial 定义 a

2022-05-26 00:00:00 326

原创 cv2.putText

python opencv 中 cv2.putText 的用法快速使用cv2.putText(img, str(point), np.int32(point), cv2.FONT_HERSHEY_SIMPLEX, 0.75, (255, 0, 0), 1)位置参数说明:图像需添加的文字内容位置字体字体大小字体颜色字体粗细使用示例src = [[10.0, 457.0], [395.0, 291.0], [624.0, 291.0], [1000.0, 457.0]]# 创建浅灰

2022-05-17 22:29:46 1697

原创 model.named_parameters()与model.parameters()

model.named_parameters()迭代打印model.named_parameters()将会打印每一次迭代元素的名字和param。并且可以更改参数的可训练属性from torchvision.models.shufflenetv2 import shufflenet_v2_x1_0model = shufflenet_v2_x1_0()for name, parameter in model.named_parameters(): print(name, parameter

2022-05-14 23:26:10 2497

原创 os.walk()

os.walk()主要用来扫描某个指定目录下所包含的子目录和文件。os.walk() 返回的三个参数分别表示:curdir:当前目录dirs:该目录下包含的子文件夹files:该目录下包含的子文件for curdir, dirs, files in os.walk(root): # 遍历root下每一个文件 for file in files: fn_path = os.path.join(curdir, file) print(fn_path) #

2022-05-05 23:40:24 588

原创 torch.isfinite()、torch.isinf()、torch.isnan()

torch.isfinite(tensor) 判断是否有界torch.isinf(tensor)判断是否无穷torch.isnan(tensor)判断是否为空以上三个函数都返回 bool 类型的mask举例说明:arr = torch.tensor((float('inf'), float('-inf'), float('nan')))mask1 = torch.isfinite(arr)tensor([False, False, False]) mask2 = torch.isi

2022-05-05 22:03:09 1211

原创 torch.chunk()

chunk可以对张量进行分块,返回一个张量列表torch.chunk(tensor, chunks, dim=0) → List of TensorsSplits a tensor into a specific number of chunks.Last chunk will be smaller if the tensor size along the given dimension dim is not divisible by chunks.(如果指定轴的元素个数被chunks除不尽,那么最后

2022-05-04 19:18:28 644

原创 torch.transpose()

首先transpose是为了转换矩阵维度的,在numpy和pytorch中的作用都是一样的,分别举例说明:arr = np.arange(24).reshape((2, 3, 4))[[[ 0 1 2 3] [ 4 5 6 7] [ 8 9 10 11]] [[12 13 14 15] [16 17 18 19] [20 21 22 23]]]目标:将矩阵 arr 的0维度和1维度进行交换需要注意,transpose每次只能转换两个维度np.transpose(

2022-05-04 16:07:14 5083

原创 torch.nn.CrossEntropyLoss()

做分类任务经常用到 torch.nn.CrossEntropyLoss() 这个损失函数,之前只是简单的使用,但是对于其内部原理并不了解,现在学习一下内部原理softmax先从softmax函数开始在softmax的机制中,为获得输出层的输出(即最终的输出),我们不是将sigmoid()作用其上,而是采用的所谓softmax()。其输入为向量,输出为0~1之间的向量,其和为1。在分类任务中作为概率出现在交叉熵损失函数中。softmax(x)=exi∑jexj softmax(x) = \frac{

2022-05-01 11:08:52 860

原创 python统计某一元素出现的次数

from collections import Counterarr = [1,2,5,1,1,5,6,3,3,2,2,4,8]# 方法一:利用python自带的包来解决res1 = Counter(arr)# 方法二:自定义函数def count_char(arr): res = dict() for i in arr: if i not in res.keys(): res[i] = 0 res[i] += 1 return resres2 = count_char

2022-04-29 17:27:37 1373

原创 torch.rand 和 torch.randn

torch.rand(*size)生成在区间 [0,1) 之间的呈均匀分布的随机数torch.rand(*size, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) → TensorReturns a tensor filled with random numbers from a uniform distribution on the interval [0, 1)[0,1)The

2022-04-29 10:01:48 769

转载 Python中函数eval和ast.literal_eval的区别详解

https://zhuanlan.zhihu.com/p/29881075众所周知在Python中,如果要将字符串型的list,tuple,dict转变成原有的类型呢? 这个时候你自然会想到eval. eval函数在python中做数据类型的转换还是很有用的。它的作用就是把数据还原成它本身或者是能够转化成的数据类型.下面来看看示例代码:# str => lista = '[1, 2, 3, 4]'res = eval(a)print(a, type(a)) # [1, 2, 3, 4] &

2022-04-17 14:08:27 604

原创 sublime主题配色

{“ignored_packages”:[“Vintage”,],“theme”: “Default Dark.sublime-theme”,“dark_theme”: “Default.sublime-theme”,“light_theme”: “Adaptive.sublime-theme”,“color_scheme”: “Monokai.sublime-color-scheme”,“font_size”: 15,}{“cmd”: [“C:\Users\weihu\anacon

2022-04-17 10:07:13 978

原创 linux 查看是centos还是ubuntu

linux查看系统

2022-04-12 23:59:18 356

原创 tmux使用

tmux使用

2022-04-12 23:43:07 67

原创 numpy 索引和相关的mask操作

numpy 索引和相关的mask操作

2022-04-12 10:48:04 3215

原创 nunpy.delete()

基本说明def delete(arr, obj, axis=None): """ Return a new array with sub-arrays along an axis deleted. For a one dimensional array, this returns those entries not returned by `arr[obj]`. Parameters ---------- arr : array_like

2022-04-12 09:25:53 83

原创 python log函数

python log函数语法:import math math.log(x[, base])注意:log()是不能直接访问的,需要导入 math 模块,通过静态对象调用该方法。参数:x : 数值表达式base :可选,底数,默认为e实例import math# 以10为底数print(math.log(100, 10)) # 2.0# 以e为底数print(math.log(math.e)) # 1.0# 以5为底数print(math.log(25, 5)) # 2.0

2022-04-07 08:32:35 4592

原创 opencv与PIL互转

opencv 与 PIL互转

2022-03-11 09:48:58 4810

原创 Docker学习

Docker中的一些名词镜像(Image)Docker中的镜像就好比是一个模板,通过这个模板来创建容器服务,最终的服务运行和项目运行就是在容器中的容器(container)仓库(repository)仓库就是来存放镜像的地方仓库分为公有仓库和私有仓库...

2022-02-06 15:34:42 521

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除