caffe 预训练 或者Fine-Tuning 操作
1.使用预训练模型,需要修改训练的prototxt,将layer name改为与要使用模型的layer name相同即可。
Borrowing Weights from a Pretrained Network
To borrow the weights of an already trained model, we need to do two things:
- Rename our layer to match the name of the original model's layer. The weights are assigned by layer name, thus using the original network's layer name, we get it's weights.
For example, let say the original model had a layer name ip1, then we should name our layer ip1:
layer {
name: "ip1"
type: "InnerProduct"
bottom: "pool2"
top: "ip1"
param {
lr_mult:
}
param {
lr_mult:
}
inner_product_param {
num_output:
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
}
}
}
- Train our new hybrid model declaring the location of the weights:
caffe train —solver ourSolver.prototxt —weights theirModel.caffemodel
What About the Other Layers of Our Network?
The other layers of our network will be initialized just like any other brand new layer (usually ~zero).
2.Fine-Tuning 将prototxt某层的lr 置为0,这层即不学习
Fine-Tuning is the process of training specific sections of a network to improve results.
Making Layers Not Learn
To stop a layer from learning further, you can set it's param attributes in your prototxt.
For example:
layer {
name: "example"
type: "example"
...
param {
lr_mult: #learning rate of weights
decay_mult:
}
param {
lr_mult: #learning rate of bias
decay_mult:
}
}
参考:
https://github.com/BVLC/caffe/wiki/Fine-Tuning-or-Training-Certain-Layers-Exclusively
https://github.com/BVLC/caffe/wiki/Borrowing-Weights-from-a-Pretrained-Network
caffe 预训练 或者Fine-Tuning 操作的更多相关文章
- caffe fine tune 复制预训练model的参数和freeze指定层参数
复制预训练model的参数,只需要重新copy一个train_val.prototxt.然后把不需要复制的层的名字改一下,如(fc7 -> fc7_new),然后fine tune即可. fre ...
- (原)caffe中fine tuning及使用snapshot时的sh命令
转载请注明出处: http://www.cnblogs.com/darkknightzh/p/5946041.html 参考网址: http://caffe.berkeleyvision.org/tu ...
- 学习AI之NLP后对预训练语言模型——心得体会总结
一.学习NLP背景介绍: 从2019年4月份开始跟着华为云ModelArts实战营同学们一起进行了6期关于图像深度学习的学习,初步了解了关于图像标注.图像分类.物体检测,图像都目标物体检测等 ...
- zz从Word Embedding到Bert模型—自然语言处理中的预训练技术发展史
从Word Embedding到Bert模型—自然语言处理中的预训练技术发展史 Bert最近很火,应该是最近最火爆的AI进展,网上的评价很高,那么Bert值得这么高的评价吗?我个人判断是值得.那为什么 ...
- L23模型微调fine tuning
resnet185352 链接:https://pan.baidu.com/s/1EZs9XVUjUf1MzaKYbJlcSA 提取码:axd1 9.2 微调 在前面的一些章节中,我们介绍了如何在只有 ...
- 从Word Embedding到Bert模型—自然语言处理中的预训练技术发展史(转载)
转载 https://zhuanlan.zhihu.com/p/49271699 首发于深度学习前沿笔记 写文章 从Word Embedding到Bert模型—自然语言处理中的预训练技术发展史 张 ...
- pytorch预训练
Pytorch预训练模型以及修改 pytorch中自带几种常用的深度学习网络预训练模型,torchvision.models包中包含alexnet.densenet.inception.resnet. ...
- 【中文版 | 论文原文】BERT:语言理解的深度双向变换器预训练
BERT:Pre-training of Deep Bidirectional Transformers for Language Understanding 谷歌AI语言组论文<BERT:语言 ...
- 第二十四节,TensorFlow下slim库函数的使用以及使用VGG网络进行预训练、迁移学习(附代码)
在介绍这一节之前,需要你对slim模型库有一些基本了解,具体可以参考第二十二节,TensorFlow中的图片分类模型库slim的使用.数据集处理,这一节我们会详细介绍slim模型库下面的一些函数的使用 ...
随机推荐
- 东芝线阵CCD芯片TCD1305DG驱动时序设计
最近在做微型光谱仪,用到了东芝的CCD芯片TCD1305DG,该芯片是单行3648像素,输出信号是时间上离散的模拟信号,典型输出速率为0.5M,即每2000ns输出一个像素值(模拟信号),芯片内部集成 ...
- P2904 [USACO08MAR]跨河River Crossing
题目描述 Farmer John is herding his N cows (1 <= N <= 2,500) across the expanses of his farm when ...
- Oracle cursors 游标 for循环遍历
oracle提供了for循环语句,让我们可以遍历select搜索的结果.用法也很简单,代码如下: DECLARE ; BEGIN FOR C IN C1 LOOP -- 对select出的每一行进行操 ...
- 初学node.js-MongoDB安装和环境服务配置(4)
一.mongoDB安装: (1)官网下载,我的是windows64位系统,目前最新版mongodb-win32-x86_64-2008plus-ssl-4.0.9-signed.msi 安装步骤不说了 ...
- [笔记] Delphi 10.2.1 Tokyo 安装使用笔记
Android 平台: ListView 滑动速度已有改善,但比起 Berlin 还是略慢一些(在较慢的机子可感觉的到)仅于 Android 平台,其它平台没差. TMemo, TEdit 输入文字的 ...
- Golang从文件服务器获取图片显示到客户端
一.需求 A(客户端)--------------->B(服务端)-------------->C(文件服务器) 在客户端需要显示图片列表,但是不想C(文件服务器)的地址被暴露出来,所以现 ...
- JAVAWEB dbutils执行sql命令并遍历结果集时不能查到内容的原因
遍历结果集时只遍历bean对象才会只输出第一行那种内容(第一行是输出了UserEntity类实例化的对象),所以这里需要 re.getRepoTableName() 才能通过对象调用相对应的内容 这样 ...
- 动态加载与插件系统的初步实现(一):反射与MEF解决方案
涉及内容: 反射与MEF解决方案 AppDomain卸载与代理 WinForm.WcfRestService示 PRRT1: 反射实现 插件系统的基本目的是实现宿主与组件的隔离,核心是作为接驳约定的接 ...
- Git 个人笔记
最近在看 Git ,顺便把这些常用命令记录下来,以备以后忘记能查看(未完): // 设置用户名和邮箱 使用global 表示这台主机上所有的Git仓库都会使用这个配置 也可以对某个仓库指定不 ...
- 【Unity Shader】(六) ------ 复杂的光照(上)
笔者使用的是 Unity 2018.2.0f2 + VS2017,建议读者使用与 Unity 2018 相近的版本,避免一些因为版本不一致而出现的问题. [Unity Sha ...