自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 average_duration = (average_duration = (num_frames - self.skip_length + 1) + 1) // self.num_segments

ddd

2022-10-30 22:05:40 203 1

原创 list out of range

ddd

2022-09-26 11:46:01 543

原创 cv::ColorMap only supports source images of type CV_8UC1 or CV_8UC3 in function

CV_8uc1 单颜色通道 8位

2022-09-24 14:56:42 1515

原创 报错AssertionError: Invalid device id

报错

2022-09-23 21:16:25 973

原创 ImportError: DLL load failed while importing _multiarray_umath: 找不到指定的模块。

gg

2022-09-18 14:56:17 1854 1

原创 sh报错segmentation fault

linux

2022-09-15 09:47:15 509

原创 sh报错segmentation fault

linux

2022-07-23 18:12:37 718

原创 linux下的GPU压力测试

linux

2022-07-23 11:28:14 872

原创 linux下的GPU压力测试

linux

2022-07-21 18:10:29 776

原创 参数共享相关

参数共享

2022-06-22 18:05:01 63

原创 labelme相关 :修改mask颜色,转为二值

在\anaconda\envs\labelme\Lib\site-packages\imgviz 下打开label.py文件,修改为 for i in range(0, n_label): id = i r, g, b = 0, 0, 0 for j in range(0, 8): if i == 1: r = 255 g = 255

2022-05-31 14:35:04 450

原创 CNN+SVM

问题:到底能不能使用CNN和SVM一起来实现端对端训练呢?答:查到的好像是可以,参考文献如下:https://arxiv.org/abs/1306.0239文中说使用L2 SVM下面这个链接也有说明怎么使用,大概意思就是把最后一层的FC当作SVM和CNN一起训练,即设置个损失函数就ok了https://blog.csdn.net/ying86615791/article/details/71366184?spm=1001.2101.3001.6650.1&utm_medium=dist

2022-05-23 09:05:27 1363

原创 nn.gru

不管是否有batch_first=True,hidden的输出都是[bidrection*num_layers,batchsize,hidden]

2022-05-12 20:54:56 187

原创 GRU实战双向

import torchimport torch.nn as nnimport torch.optim as optimimport csvfrom torch.utils.data import Datasetfrom torch.utils.data import DataLoaderimport numpy as npimport matplotlib.pyplot as pltimport timefrom torch.nn.utils.rnn import pack_padded

2022-05-10 14:50:58 471

原创 AttributeError: ‘tuple‘ object has no attribute ‘size‘,AttributeError: ‘function‘ object has no attr

旧的summary加入LSTM之类的会报错,需要用新的summarrypip install torchinfo使用方法from torchinfo import summary model = Resnet(basic_block, [2, 2, 2, 2], 16).cuda()batch_size = 16summary(model, input_size=(batch_size, 1, 28, 28))...

2022-05-09 11:29:40 3313

原创 切片问题啊

a = np.array([[[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]], [[13, 14, 15, 16], [17, 18, 19, 20], [21, 22, 23, 24]], [[25, 26, 27, 28], [29, 30, 31, 32], [33, 34, 35, 36]], ])print(a.shape) # (3, 3, 4)b=a[:,-1,:

2022-05-08 16:34:36 104

原创 GRU输入和输出

https://www.cnblogs.com/ryukirin/p/14587520.html感觉不太对#num_layers#可以看到,x就还是`(batch_size,seq,input_size=)`的形式,要设置为batch_first=Trueimport torch.nn as nnimport torchx = torch.rand(10,24,100)#torch.nn.lstm(input_size=100,hidden_size=16,num_layers=2)#输

2022-05-08 15:34:41 802

原创 nn.squential中添加reshape和GRU

都需要自己定义一个GRUclass SelectItem(nn.Module): def __init__(self, item_index): super(SelectItem, self).__init__() self._name = 'selectitem' self.item_index = item_index def forward(self, inputs): return inputs[self.item

2022-05-08 11:14:46 286

原创 元组的拼接

import torchv1 = torch.range(1, 32).view(16,2) print(v1.size())print(v1.size()[1:])v2 = v1.view((-1, 2)+v1.size()[1:]) print(v2.size())print((-1,8)+torch.Size([2]))print(type((-1,1)))print(type((3,)))print((-1,8)+(3,))输出torch.Size([16, 2])tor

2022-04-13 15:11:27 431

原创 resnet的讲解

https://zhuanlan.zhihu.com/p/353235794?ivk_sa=1024320u

2022-04-06 15:40:13 130

原创 报错command not found

总是报错command not foundgit下sh xx.sh刚开始以为代码有问题,后来发现原来就是把它前面那行注释了,这莫名其妙的报错,,,

2022-03-20 22:00:35 349

原创 不平衡样本分类指标

MCC>F1from sklearn.metrics import confusion_matrixfrom sklearn.metrics import f1_score, recall_score, accuracy_score, precision_scoredef calc(TN, FP, FN, TP): SN = TP / (TP + FN) # recall SP = TN / (TN + FP) # Precision = TP / (TP + FP)

2022-03-19 21:48:39 244

原创 混淆矩阵 confusion_matrix

sklearn中的混淆矩阵源码 >>> tn, fp, fn, tp = confusion_matrix([0, 1, 0, 1], [1, 1, 1, 0]).ravel() >>> (tn, fp, fn, tp) (0, 2, 1, 1)所以混淆矩阵输出为TN FPFN TP这个和在网上查的不一样,要注意...

2022-03-19 17:47:32 1080

原创 net.layer.children

import pretrainedmodelsbase_model='resnet101'base_model=pretrainedmodels.__dict__[base_model](num_classes=1000,pretrained='imagenet')n_segment_list=[n_segment]*4isinstance(base_model,torchvision.models.ResNet) # Truestage=net.layer1blocks=list(stage.

2022-03-16 20:03:58 165

原创 click一直报错functional has ,,,‘name

发现原来是在run()之前加了个函数,这个bug找了一天

2022-03-15 18:37:46 158

原创 accuracy的计算

torch.max(torch.nn.functional.softmax(outputs), 1)上面的输出为两个,第一维是概率,第二维是索引,因此如果想用from sklearn.metrics import accuracy_score计算准确率的话,需要取出索引即[1]

2022-03-12 18:54:16 646

原创 环境配置问题

torch官网没有的cuda和torch版本,那就是真的没有,安装时候一定要指定cuda,否则会自己安装,但是和自己的cuda不匹配命令nvcc -V查看的cuda版本为10.1,torch1.1环境里print(torch.version.cuda)输出为10.0,但是代码可以跑...

2022-03-05 16:34:07 416

原创 22.3.4记录

1 conda安装pytorchvideo,装了半天装不上,换成pip就行了2 https://blog.csdn.net/yu876876/article/details/79656422用wget获取链接不安全,在链接前面加上 --no-check-certificate就行了3 jupyter添加核https://www.cnblogs.com/shanger/p/12006322.html这个是在jupyter内进行的在终端#安装ipykernelpip install ip

2022-03-04 21:57:43 699

原创 nn.CrossEntropyLoss

刚开始报错TypeError: forward() got an unexpected keyword argument 'reduction'查了半天后发现是写错地方了,原来是这么写的criterion = nn.CrossEntropyLoss(weight=weights)loss = criterion(x, y, reduction='sum')基本功不扎实真的被自己笑死,修改后criterion = nn.CrossEntropyLoss(weight=weights, redu

2022-03-04 18:07:13 1029 4

原创 ViViT讲解

https://jishuin.proginn.com/p/763bfbd7081a

2022-03-01 16:15:23 849

原创 在keras的Conv2D加入LSTM

https://www.pythonheidong.com/blog/article/146429/31d9cd672b75340c276b/https://github.com/wushilian/CRNN_Attention_OCR_Chinese/blob/master/model.py要在LSTM之前加入reshape,并且LSTM后不需要加入flatten层

2022-02-16 20:09:22 1276

原创 keras输出某一层维度

BATCH_SIZE = 2 (just try)TIME_STEPS=frame_num (=86)INPUT_SIZE=pixel_num (=28*28)model = Sequential()model.add(InputLayer(batch_input_shape=(BATCH_SIZE, TIME_STEPS, INPUT_SIZE)))print (model.output_shape)model.add(TimeDistributed(Conv2D(64,(1,3

2022-02-16 19:37:21 763

原创 将变量写入txt文件

实现目标:将所有不能处理的文件名称写入txt中 try: zzz = df.loc[pID,['子文件夹名称']].tolist()[0] except: IDs.append(pID) for i, (cat, idx) in enumerate(data.items()): assert i == int(idx) # make sure the rank is right categories.append(

2022-01-26 22:00:56 411

原创 tensorboard的使用

https://www.cnblogs.com/ipersevere/p/10843115.html这个链接里面有说明注意cmd要在log文件夹下打开,而不是在log.txt所在文件夹打开

2022-01-21 22:38:06 64

原创 TSM数据密集采样,稀疏采样和二次采样

https://www.freesion.com/article/22801370967/密集采样def _sample_indices(self, record): if self.dense_sample: # i3d dense sample # 密集随机采样 sample_pos = max(1, 1 + record.num_frames - 64) t_stride = 64 // self.num_segments start_id

2022-01-07 15:13:35 2521

原创 tqdm无法单行显示

tqdm显示Loss 1.2855 (1.1737) Prec@1 15.625 (56.497) Prec@5 100.000 (100.000): 90%|███████████▊ | 38/42 [01:32<00:02, 1.40it/Loss 2.4410 (1.2062) Prec@1 6.250 (55.208) Prec@5 100.000 (100.000): 90%|████████████▋ | 38/42 [01:33<00:02, 1.40

2022-01-06 19:51:24 266

原创 ModuleNotFoundError: No module named ‘non_local‘

报错如题目,相应文件夹下面也有init文件,但是就是不行,然后发现init里面import时候都是前面有个点,加上了后果然可以了

2022-01-06 09:52:52 261

原创 关于pydicom参数说明

[::4]#每4个取一个https://dicom.innolitics.com/ciods/us-multi-frame-image/cine/00180040ds=dicom.read_file("xxx.dcm")ds.CineRate 帧率ds.EffectiveDuration 时长(sec)ds.PhotometricInterpretation 颜色空间编码(是字符串)ds.NumberOfFrames 帧数 ds=dicom.read_file("xxx.dcm")

2021-12-10 18:23:05 291

原创 2021-11-08RuntimeError: Expected object of device type cuda but got device type cpu for argument #3

报错RuntimeError: Expected object of device type cuda but got device type cpu for argument #3 'weight' in call to _thnn_nll_loss_forward报错思路功能快捷键合理的创建标题,有助于目录的生成如何改变文本的样式插入链接与图片如何插入一段漂亮的代码片生成一个适合你的列表创建一个表格设定内容居中、居左、居右SmartyPants创建一个自定义列表如何创建一个注脚注释也是必不可少的KaTe

2021-11-08 16:23:06 748

原创 2021-11-02 关于环境配置一些列问题

首先,不要因为显卡新就买,有时候还是经典的好nvidia-smi和nvcc -V这两个命令出来的cuda版本不一致,要以nvcc -V为准以后再记录

2021-11-02 11:56:31 79

空空如也

空空如也

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

TA关注的人

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