零散知识点

PyTorch源码解读之torch.utils.data.DataLoader

https://blog.csdn.net/u014380165/article/details/79058479

https://www.cnblogs.com/hutao722/p/10008581.html

这样就不要依赖input size 

https://blog.csdn.net/stu_shanghui/article/details/91042187

Batch normalization(每个卷积之后进行批归一化)

批归一化可以提升模型的收敛速度,而且起到正则化的效果,降低模型的的过拟合

linux命令:cd ~/..ssh/

894508923 2016-05-18 20:32:41  1243  收藏 1

~ 表示当前用户的 home 目录,展开即为 /home/用户名

在shell中以 . 开头的表示隐藏文件或目录,用ls是默认看不到的。这里..ssh也就是个隐藏目录。

所以 cd ~/..sh/ 也就是切换当前工作目录为 /home/用户名/..sh 这个隐藏目录

https://stackoverflow.com/questions/53012856/what-is-an-object-detection-head

https://www.cnblogs.com/clemente/p/12444598.html

https://www.pianshen.com/article/208890368/

https://zhuanlan.zhihu.com/p/34142321

# 正常ks是从0开始,但是如果想从某个指定的数值开始,可以这样
#for k, v in enumerate(extras['300'], 3): 这里k就从3开始

[nn.Conv2d(in_channels, v, kernel_size=(1, 3)[flag])] 这里的flag = True or False,分别代表取(1, 3)元组中位置为0,或者1处的值,比较巧妙。

一般当一个容器中,找第几个值时,这个容器一般用元组(),然后取第k值用[k],这样取值,如果刚开始容器就用列表[],然后取第k个值也用[],会不雅观,所以一般这么用(coco, voc)[num_classes == 21],而且True就取1,不对就取0,很巧妙。

@torch.no_grad()
def init_weights(m):
	print(m)
	if type(m) == nn.Linear:
		m.weight.fill_(1.0)
		print(m.weight)
net = nn.Sequential(nn.Linear(2, 2), nn.Linear(2, 2))
net.apply(init_weights)
最近看到网络apply,其实可以这么理解,就是把net网络中的各个层作参数分别传给init_weights,
参与其内部计算,只不过,其会递归,从其源码(如下)就可以看出。
for module in self.children():
	module.apply(fn)
fn(self)

如上,如果我们想要初始话一个模型网络权重时,可以用如上的apply方法,这样就直接递归初始化好了。

list(zip('abcdefg', range(3), range(4)))[('a', 0, 0), ('b', 1, 1), ('c', 2, 2)]

# 这个方法是读取文本文件按照行来读取
def readTxtLine():
    txt_path = r''
    with open(txt_path, 'r') as f:
        for line in f:
            print(line)

参考: https://zhuanlan.zhihu.com/p/55999926

fine tune

其实fine tune说白了就是再别人训练好的模型上进行一些微调,以很小的learning rate,这样做的好处就是,别人这个模型一般是在大型训练集上进行训练的,泛化能力比较好,可以减少数据量少从头开始训练导致模型泛化能力,收敛性等问题。(不冻住pre-trained model all layer or part of pre-trained model layer)

参考:https://zhuanlan.zhihu.com/p/35890660

transfer learning

用一个例子讲:就是把别人训练好的模型用于A任务,然后现在把这个模型拿过来用在B任务上。一般会冻结backbone。

This leads us to how a typical transfer learning workflow can be implemented in Keras:

  1. Instantiate a base model and load pre-trained weights into it.
  2. Freeze all layers in the base model by setting trainable = False.
  3. Create a new model on top of the output of one (or several) layers from the base model.
  4. Train your new model on your new dataset

参考:https://machinelearningmastery.com/transfer-learning-for-deep-learning/

参考:https://keras.io/guides/transfer_learning/

其实,在pytorch tutorial 上,transfer learning 是包含 fine tune,如下两个网址

https://cs231n.github.io/transfer-learning/

https://pytorch.org/tutorials/beginner/transfer_learning_tutorial.html

avg iou 

就是一张图片上所有iou的平均

is the average of the IOU of every image in the current subdivision

参考:https://timebutt.github.io/static/understanding-yolov2-training-output/

Pytorch 分布式训练主要有两种方式:

torch.nn.DataParallel ==> 简称 DP
torch.nn.parallel.DistributedDataParallel ==> 简称DDP

reference: https://www.codenong.com/cs105605994/

python 函数参数的传递(参数带星号的说明)

一个星(*):在函数内部存储在以形参名为标识符的 tuple 中

两个星(**):在函数内部保存以形参名为标识符的 dictionary 中

reference: https://www.cnblogs.com/smiler/archive/2010/08/02/1790132.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值