随笔分类 - pytorch学习
摘要:引言 直方图是一种对数据分布的描述,在图像处理中,直方图概念非常重要,应用广泛,如图像对比度增强(直方图均衡化),图像信息量度量(信息熵),图像配准(利用两张图像的互信息度量相似度)等。 1、numpy中histogram()函数用于统计一个数据的分布 numpy.histogram(a, bins
阅读全文
摘要:torch.narrow(input, dim, start, length) → Tensor Returns a new tensor that is a narrowed version of input tensor. The dimension dim is input from star
阅读全文
摘要:repeat(*sizes) → Tensor Repeats this tensor along the specified dimensions. Unlike expand(), this function copies the tensor’s data. WARNING torch.rep
阅读全文
摘要:torch.bmm(batch1, batch2, out=None) → Tensor Performs a batch matrix-matrix product of matrices stored in batch1 and batch2. batch1 and batch2 must be
阅读全文
摘要:torch.ger(vec1, vec2, out=None) → Tensor Outer product of vec1 and vec2. If vec1 is a vector of size nn and vec2 is a vector of size mm, then out must
阅读全文
摘要:numpy.expand_dims(a, axis) Expand the shape of an array. Insert a new axis that will appear at the axis position in the expanded array shape. Input ar
阅读全文
摘要:本文分为两部分,第一部分讲如何保存模型参数,优化器参数等等,第二部分则讲如何读取。 假设网络为model = Net(), optimizer = optim.Adam(model.parameters(), lr=args.lr), 假设在某个epoch,我们要保存模型参数,优化器参数以及epoc
阅读全文
摘要:假设我们只保存了模型的参数(model.state_dict())到文件名为modelparameters.pth, model = Net() 1. cpu -> cpu或者gpu -> gpu: checkpoint = torch.load('modelparameters.pth') mod
阅读全文
摘要:由此,我们找到sample.py,第51行如下图修改
阅读全文
摘要:sppnet不讲了,懒得写。。。直接上代码
阅读全文
摘要:问题一 ImportError: No module named torchvision torchvison:图片、视频数据和深度学习模型 解决方案 安装torchvision,参照官网 问题二 安装torchvision过程中遇到 Could not find a version that sa
阅读全文
摘要:转自:http://www.cnblogs.com/darkknightzh/p/6836568.html PyTorch默认使用从0开始的GPU,如果GPU0正在运行程序,需要指定其他GPU。 有如下两种方法来指定需要使用的GPU。 1. 类似tensorflow指定GPU的方式,使用CUDA_V
阅读全文