![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Pytorch
酱紫,
这个作者很懒,什么都没留下…
展开
-
pytorch
pytorch上采样torch.nn.Upsample(size=None, scale_factor=None, mode='nearest', align_corners=None)注意:size和scale_factor二选一(不能两者兼而有之,因为它是模棱两可的)>>> input = torch.arange(1, 5).view(1, 1, 2, 2).float()>>> inputtensor([[[[ 1., 2.], [ 3., 4.原创 2020-12-03 17:26:00 · 170 阅读 · 0 评论 -
程序记录
目标检测-pytorch1、strides = [stride] + [1]*(num_blocks-1)>>b=[1]+[1]*2>>print(b)[1, 1, 1]def _make_layer(self, block, planes, num_blocks, stride): strides = [stride] + [1]*(num_blocks-1) layers = [] for stride in strides: l原创 2020-12-03 16:26:30 · 351 阅读 · 0 评论 -
迁移学习--冻结模型
1、pytorch载入预训练模型后,只想训练个别层怎么办?https://blog.csdn.net/qq_34351621/article/details/79967463如果载入的这些参数中,有些参数不要求被更新,即固定不变,不参与训练,需要手动设置这些参数的梯度属性为Fasle,并且在optimizer传参时筛选掉这些参数。...原创 2020-11-14 11:36:35 · 1370 阅读 · 0 评论 -
Pytorch--模型加载
Pytorch–模型加载1、load_state_dict()函数使用model = VGG()# 实例化自己的模型;checkpoint = torch.load('checkpoint.pt', map_location='cpu') # 加载模型文件,pt, pth 文件都可以;if torch.cuda.device_count() > 1: # 如果有多个GPU,将模型并行化,用DataParallel来操作。这个过程会将key值加一个"module. ***"。原创 2020-10-29 21:07:33 · 962 阅读 · 0 评论