自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(83)
  • 资源 (2)
  • 收藏
  • 关注

原创 MySQL双主及Keepalived高可用配置

1、双主配置 (1) 准备两台服务器master1 :172.16.1.111master2 :172.16.1.112 (2)

2020-09-18 17:20:48 356

原创 错误总结及解决错误方法

近期使用ubuntu自带python2运行别人的caffe模型出现问题总结:1、plt.savefig问题在对结果保存时,出现了第一次和第二次图片的重叠,把所有结果保存到了同一幅图像中去了。解决办法:加上plt.close()参考:https://blog.csdn.net/daixiangzi/article/details/825289272、AttributeError:...

2019-12-29 22:13:31 455

转载 python 中npz文件的读取

import numpy as np a = np.load(open('spice_sg_dict2.npz','rb'), encoding='bytes')print(a) #<numpy.lib.npyio.NpzFile object at 0x0000000002929B70>print(type(a)) #<class 'numpy.li...

2019-07-18 09:33:46 11937

转载 torch.mul torch.bmm

torch.bmm:https://blog.csdn.net/guotong1988/article/details/78707619参考https://blog.csdn.net/Real_Brilliant/article/details/85756477batch matrix multiply 相当于矩阵的乘法。>>> batch1 = torch....

2019-07-10 20:27:41 683

转载 神经网络基础-多层感知器(MLP)

DL教程http://study.163.com/courses-search?keyword=%E5%90%B4%E6%81%A9%E8%BE%BE#/?ot=5原文:https://blog.csdn.net/weixin_38206214/article/details/81137911一、前言多层感知器(Multi-Layer Perceptron,MLP)也叫人工神经网络(...

2019-06-28 21:51:47 2549

转载 pytorch方法测试——激活函数(ReLU)

import torchimport torch.nn as nn#inplace为True,将会改变输入的数据 ,否则不会改变原输入,只会产生新的输出m = nn.ReLU(inplace=True)input = torch.randn(7)print("输入处理前图片:")print(input)output = m(input)print("ReLU输出:")p...

2019-06-25 21:06:37 3780

转载 sigmoid、tanh和relu激活函数的直观解释

大神出处https://www.cnblogs.com/hutao722/p/9732223.htmlhttps://www.jianshu.com/p/857d5859d2cc常见的激活函数有sigmoid、tanh和relu三种非线性函数,其数学表达式分别为:sigmoid: y = 1/(1 + e-x) 当使用sigmoid作为激活函数时,随着神经网络隐含层(h...

2019-06-24 12:18:50 3994

转载 在NLP当中,不同的评价指标,BLEU, METEOR, ROUGE和CIDEr的逻辑意义?

链接:https://www.zhihu.com/question/304798594/answer/567383628这些指标都是用于在有监督的情况下评价文本生成质量的,大概做法都是比较某条候选文本(一般是机器生成的)和其他若干参考文本(一般是人类标注的)的相似性,不过适用场合略有区别:BLEU, METEOR, ROUGE 一般在翻译里用,CIDEr 一般在图像字幕生成里用。...

2019-06-13 20:09:47 7377 2

原创 torch中narrow的用法

data = tensor:narrow(dim, index, size)–表示取出tensor中第dim维上索引从index开始到index+size-1的所有元素存放在data中>>> import torch>>> a = torch.rand(5,6)>>> atensor([[0.9737, 0.5571, 0.3...

2019-06-13 11:27:10 699

转载 DataParallel使用

DataParallel' object has no attributehttps://github.com/yysijie/st-gcn/issues/83self.model.extract_feature -> self.model.module.extract_featurepytorch 多GPU训练总结(DataParallel的使用)https://blog...

2019-06-08 15:46:00 3448

转载 vnc viewer和windows不能互相复制黏贴

如果Vnc Viewer不能复制黏贴,输入一下命令:vncconfig -nowin&参考https://blog.csdn.net/dongfangxiaozi_/article/details/72621974

2019-06-04 13:59:08 4213

转载 from theano.tensor.signal import downsample

ImportError: cannot import name downsample参考:https://blog.csdn.net/u013972559/article/details/86020388测试安装过程中遇见了错误,是因为theano里面的文件变化了,没有downsample文件了,所有有些函数变到其他文件了,所以专门再次记录一下:在较早的版本中,可能会使用from t...

2019-05-31 17:19:13 2936 1

原创 TypeError: unsupported operand type(s) for +: 'odict_keys' and 'dict_keys'

此问题只有在python3中才会出现,python2中输出的都是list'odict_keys'import collectionsdic = collections.OrderedDict()dic['k1'] = 'v1'dic['k2'] = 'v2'print(type(dic.keys()))##输出 <class 'odict_keys'>...

2019-05-10 15:19:33 3660

转载 'dict_values' object does not support indexing

原文https://www.cnblogs.com/timxgb/p/8905290.htmlIn Python 3,dict.values()(along withdict.keys()anddict.items()) returns aview, rather than a list. See the documentationhere. You therefore nee...

2019-05-08 21:23:02 2602 1

转载 Python编程:NameError: name 'reduce' is not defined

问题来了使用 reduce() 测试的时候报错:reduce 未定义!print(reduce(lambda x, y: x + y, [ 1, 2, 3]))"""Output:NameError: name 'reduce' is not defined"""解决引用stackoverflow的回答: - 你使用的是python3 - 参考的是python2的指...

2019-05-07 22:02:38 481

转载 invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number

invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number解决办法https://github.com/NVIDIA/flownet2-pytorch/issues/113

2019-05-02 09:43:51 1967

翻译 ValueError: sampler should be an instance of torch.utils.data.Sampler, but got sampler=[......] Term

问题https://github.com/ruotianluo/DiscCaptioning/issues/10Traceback (most recent call last): File "calculate_image_similarities.py", line 153, in <module> calculate_similarities(opt) Fi...

2019-04-27 17:14:29 1491 9

转载 Linux显存占用无进程清理方法(附批量清理命令)

参考https://www.cnblogs.com/ocean1100/p/9126032.html在跑TensorFlow、pytorch之类的需要CUDA的程序时,强行Kill掉进程后发现显存仍然占用,这时候可以使用如下命令查看到top或者ps中看不到的进程,之后再kill掉:fuser -v /dev/nvidia*批量清理显卡中残留进程:sudo fuser -v /...

2019-04-23 19:55:38 991

转载 torch.nn.Linear()函数的理解

import torchx = torch.randn(128, 20) # 输入的维度是(128,20)m = torch.nn.Linear(20, 30) # 20,30是指维度output = m(x)print('m.weight.shape:\n ', m.weight.shape)print('m.bias.shape:\n', m.bias.shape)prin...

2019-04-22 09:26:39 4764

翻译 class LSTMCell 和Embedding

class LSTMCell(RNNCellBase): r"""A long short-term memory (LSTM) cell. .. math:: \begin{array}{ll} i = \sigma(W_{ii} x + b_{ii} + W_{hi} h + b_{hi}) \\ f = \sigma(W_...

2019-04-21 21:36:11 670

原创 new_zeros() pytorch版本的转换

logprobs.new_zeros(logprobs.size())pytorch 0.4版本中用到的新建一个与logprobs类型相同的Variable转换为pytorch0.2等版本logprobs.new(logprobs.size()).zero_()

2019-04-21 15:08:37 8931

转载 PyTorch之前向传播函数forward

参考:1.pytorch学习笔记(九):PyTorch结构介绍2.pytorch学习笔记(七):pytorch hook 和 关于pytorch backward过程的理解3.Pytorch入门学习(三):Neural Networks4.forward神经网络的典型处理如下所示:1. 定义可学习参数的网络结构(堆叠各层和层的设计);2. 数据集输入;3. 对输入进行处理...

2019-04-21 10:46:52 1963

转载 torch代码解析 为什么要使用optimizer.zero_grad()

原文:https://blog.csdn.net/scut_salmon/article/details/82414730optimizer.zero_grad()意思是把梯度置零,也就是把loss关于weight的导数变成0.在学习pytorch的时候注意到,对于每个batch大都执行了这样的操作: # zero the parameter gradients ...

2019-04-21 10:02:54 424

转载 Pytorch中多GPU训练

参考https://www.jianshu.com/p/0bdf846dc1a2https://oldpan.me/archives/pytorch-to-use-multiple-gpus前言在数据越来越多的时代,随着模型规模参数的增多,以及数据量的不断提升,使用多GPU去训练是不可避免的事情。Pytorch在0.4.0及以后的版本中已经提供了多GPU训练的方式,本文简单讲解下使...

2019-04-19 11:21:43 2920

转载 torch.max

原文:https://blog.csdn.net/Z_lbj/article/details/79766690torch.max(input)→ Tensor返回输入tensor中所有元素的最大值a = torch.randn(1, 3)>>0.4729 -0.2266 -0.2085 torch.max(a)>>0.4729torch.ma...

2019-04-18 20:48:36 172

转载 Torch 的几个损失函数

1. L1LossInput: X、Y可以是任意形状的输入,X与Y的 shape相同。Output: 标量用途:计算X与Y的差的绝对值, 1/n * (|Xi -Yi|)2. MSELossInput: x, y 任意具有相同shape的tensor。Output: 计算均方差3. CrossEntropyLossInput: X--> (N, C)...

2019-04-17 16:09:39 1044

转载 优化方法总结:SGD,Momentum,AdaGrad,RMSProp,Adam

原文https://blog.csdn.net/u010089444/article/details/767258431. SGDBatch Gradient Descent在每一轮的训练过程中,Batch Gradient Descent算法用整个训练集的数据计算cost fuction的梯度,并用该梯度对模型参数进行更新: ...

2019-04-14 16:41:01 166

转载 cv::rectangle putText函数简要介绍

void rectangle(Mat& img, Point pt1,Point pt2,const Scalar& color, int thickness=1, int lineType=8, int shift=0)参数介绍:要进行绘制的目标图像矩形的一个顶点矩阵对角线上的另一个顶点线条的颜色(RGB)或亮度(灰度图)组成矩形线条的粗细程度。取负值时,...

2019-03-30 09:13:34 691

原创 anaconda手动删除第三方库

1、找到anaconda目录下pkgs文件夹查看是否有要删除的包,如果有则直接删除2、找到/lib/python3.6/site_packages (因为我的anaconda是python3.6版本),查看此文件夹里是否包含要删除的包,如果有直接删除3、在anaconda目录下找到conda-meta文件夹,查看此文件夹是否包含要删除的包的名称,如果有则直接删除4、执行 conda c...

2019-03-29 20:47:50 13605 3

转载 jupyter notebook:使用argparse包存在的问题及解决

参考https://blog.csdn.net/u012869752/article/details/72513141argparse模块argparse是python用于解析命令行参数和选项的标准模块导入argparse包import argparse遇到的问题parser = argparse.ArgumentParser()parser.parse_args()...

2019-03-28 21:04:13 1481

转载 Python中两种UnboundLocalError: local variable 'xxx' referenced before assignment情况的解决方法

参考https://blog.csdn.net/tbzj_2000/article/details/812953951)在子程序中对全局变量的操作,比如val=9def test(flag): if flag: val = 1 else: print 'Error' return valtest(0)错...

2019-03-28 20:16:16 5433

转载 Python 去除列表中重复的元素

不保持原有的顺序:来自比较容易记忆的是用内置的setl1 = ['b','c','d','b','c','a','a'] l2 = list(set(l1)) print l2还有一种据说速度更快的,没测试过两者的速度差别l1 = ['b','c','d','b','c','a','a'] l2 = {}.fromkeys(l1).keys() print l2输出:...

2019-03-19 22:08:57 300

原创 如何在Jupyter Notebook中使用Python虚拟环境?

参考简书简书jupyter notebook的配置1.浏览器打开jupyter,新建一个python文件,第一行输入: from notebook.auth import passwd 2.shift+enter执行命令并进入下一行。下一行输入:passwd() ,回车后提示输入密码,输入两次。 3.哈希密码sha1:158c74966eda:953321769...

2019-03-11 16:25:35 2971 3

原创 python中Python2和python3的xrange cPickle与range pickle问题

最近老是在python2和python3中转换使用,但是python2和python3中xrange cPickle和range pickle是不一样的。为了能够使python3能够直接使用python2中的xrange可以导入下面包 from six.moves import xrange cPickle使得python3也可以使用xrange...

2019-03-09 10:34:16 520

转载 python 调用super()初始化报错“TypeError: super() takes at least 1 argument”

在python中有如下代码:class father(): def __init__(self,age): self.age = age; def get_age(self): print(self.age); class son(father): def __init__(self,age): super().__init__(age); self.toy_nu...

2019-02-20 16:31:01 1038

原创 class Field(RawField): File "/storage/st2/anaconda33/envs/python2/lib/python2.7/site-packages/t

class Field(RawField): File "/storage/st2/anaconda33/envs/python2/lib/python2.7/site-packages/torchtext/data/field.py", line 118, in Field torch.float32: float,AttributeError: 'module' obje...

2019-02-19 16:31:35 1568

转载 五个例子掌握theano.scan函数

原文链接https://blog.csdn.net/wangjian1204/article/details/50518591一、theano的工作原理  在theano编程中,Graph是指导theano如何对变量进行操作的唯一途径,theano变量和theano Ops(操作)是Graph的两个基本构成元素。Graph只能由theano变量(包括shared变量)或常数组成。如图所示:...

2019-01-23 17:40:55 314

原创 Warning: no model found for 'en' Only loading the 'en' tokenizer.

因为/site-packages/spacy/data 下除了 init.py文件外没有别的数据import spacynlp = spacy.load('en') Warning: no model found for 'en' Only loading the 'en' tokenizer.解决办法python -m spacy.en.download ...

2019-01-21 15:19:01 757 1

原创 使用conda安装指定的包,不安装依赖

到https://anaconda.org/或者https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/linux-64/下载所需的包,放到./anaconda3/pkgs/下面,进入该目录,用:conda install --use-local 可以安装成功。...

2019-01-11 21:34:05 5346

原创 学习笔记

此博客为自己的一些学习过程,记录下来为了自己以后看pytorch 0.3版本>>> import torch>>> from torch.autograd import Variable>>> a = Variable(torch.zeros(2,2),requires_grad=True)>>> type(a)...

2019-01-11 09:56:39 486

coco python3 仅评价.zip

python3版本,包含spice评价指标。各种环境已经编好,直接修改路径就可以使用。 参考网上各种资料,直接修改路径就可以使用。但是要装JDK.

2020-05-22

coco python2.7 完整项目包含评价.zip

python2版本,包含spice评价指标。各种环境已经编好,直接修改路径就可以使用。 参考网上修改的。直接使用修改路径即可。

2020-05-22

空空如也

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

TA关注的人

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