1,torch设置随机数种子,种子相同,则输出相同的随机数,但是在输出随机数之前都要重新生成相同的种子。
2,easydict
3,tar j解压,压缩:
tar xvf ./VOCtrainval_06-Nov-2007.tar -C ./ (将VOC所在目录解压到当前路径)
可参考:
4, gb2312的xml读取
config_file为xml文件。
方法一:
# # transform gb2312 xml to utf-8
# f = codecs.open(config_file, 'rb', 'gb2312')
# text = f.read().encode('utf-8').decode('utf-8')
# text = text.replace('<?xml version="1.0" encoding="gb2312"?>', '<?xml version="1.0" encoding="utf-8"?>')
# f.close()
# tempfilename = config_file.split('.xml')[0] + 'temp.xml'
# f = open(tempfilename, 'wb')
# f.write(text.encode('utf-8'))
# f.close()
#
# tree = ET.parse(tempfilename)
# slide = tree.getroot()
方法二:
with open(config_file) as f:
line = f.read()
slide = ET.fromstring(line)
5, pycharm调用其他project中的函数
在当前项目的中找到
点击+add content root,,,,将需要import的其他工程添加进来,就可以在当前工程下看到
2个工程,就可以正常Import了。
6,虚拟环境相关命令
conda装好虚拟环境之后,可用该命令查看wyold环境下的安装目录:conda list --name wyold
7,python中继承父类时调用的super.__init__:
reference :"http://www.runoob.com/w3cnote/python-extends-init.html"
ing..