Fine-tunning适用情况

https://www.quora.com/How-do-I-fine-tune-a-Caffe-pre-trained-model-to-do-image-classification-on-my-own-dataset

基本概念及举例:

Deep Net or CNN like alexnet, Vggnet or googlenet are trained to classify images into different categories. Before the recent trend of Deep net or CNN, the typical method for classification is to extract the features from the images and use them to classify images by training with a svm. In this procedure the features were already computed using a method like hog or bag of words. But in deep net the features and the weights for classifying into different classes are all learned from end to end. You don't need to extract features from different method.

So when you train an alexnet, it learns the features representation as well as the weights for classifying the image. You just need to input the image and you will get the class which is assigned.

The notion is the features which are learned for classifying the 1000 object categories would be sufficient enough to classify your another different set of object categories.

This may not be the case every time. It depends on the dataset and type of images and classification task.

If all of them look similar then you can use that feature representation part of deepnet     instead of again learning it. This is the idea of Finetuning.

So what you do is copy the layers of feature representation as it is from the network you already learned and you just learn the new  weights  required to classify that features into new categories your dataset has.

Implementation Level details in Caffe:

I assume here that you know how to create lmdb files for the new dataset you had.

if you want to finetune alexnet you need to copy the first 7 layers out of 8 as it is and need to change the last layer i.e fc_8. fully connected layer.

the changes you need to do is in train_val.prototxt .

Take the train_val.prototxt file in alexnet and just change the last layer fc8 to fc8_tune.

You should change the name of this layer. or else it copies the same weights before. Be careful about it.

And you need to change the train.sh file to load the weight of alexnet.

$TOOLS/caffe train --solver=quick_solver.prototxt --weights=bvlc_googlenet.caffemodel  2> train.log.

Here the finetuning is done on googlenet. You can change accordingly.

And need to update the number of classes in the fc8 layer. ( number of outputs).

If you have any more questions please ask.


步骤:

1) prepare the input data
2) change data of input layer and fc8 layer in imagenet_train.prototxt and imagenet_val.prototxt
3) type finetune_net imagenet_solver.prototxt caffe_reference_imagenet_model in terminal 


Question: 

Check failed: error == cudaSuccess (2 vs. 0) out of memory----

The message is clear you are out of memory in your GPU card. So you willneed to reduce the batch_size


本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/313280.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

你跟最伟大领导的距离,或许只差这一点

译者:宗天琪原文链接:https://www.linkedin.com/pulse/great-leaders-listeners-brigette-hyacinth/?fromgroupmessage&isappinstalled0倾听是领导者需要掌握的最重要的技能,它是很多其它领导才能的基石。然而,要做到精通这项…

Batch_size问题

有关solver.prototxt中的各项解释:http://www.cnblogs.com/denny402/p/5074049.html solver算是caffe的核心的核心,它协调着整个模型的运作。caffe程序运行必带的一个参数就是solver配置文件。运行代码一般为 # caffe train --solver*_slover.prototxt 在…

程序员家的精品大闸蟹:青壳、白底、肉多、爆黄,现在是吃大闸蟹的最佳时期...

其实,我跟大家一样,也是dotNET跨平台和张队长的忠实粉丝,也是一名程序员。上上周,我在dotNET跨平台的优选商城买了队长推荐人生果,也是第一次吃这个人生果,味道鲜甜、汁水也特别多,但由于快递的…

C#刷遍Leetcode面试题系列连载(4): No.633 - 平方数之和

点击蓝字“dotNET匠人”关注我哟加个“星标★”,每日 7:15,好文必达!前文传送门:上篇文章中一道数学问题 - 自除数,今天我们接着分析 LeetCode 中的另一道数学题吧~今天要给大家分析的面试题是 LeetCode 上第 633 号问题&#xff…

Caffe训练时出现了无数个Train net output #.....

尝试一种基于concatenation的网络结构,结果错把concatenation没接到下一步,训练时出现了无数个"Train net output #.....". 改了网络结构,同时又将原数据集合扩大到了六倍,结果发现迭代速度从4s降到了36s,尝…

程序员过关斩将--数据库的乐观锁和悲观锁并非真实的锁

菜菜哥,告诉你一个消息你有男票啦?非也非也,我昨天出去偷偷面试,结果又挂了哦,看来公司是真的不想让你走呀面试官让我说一下乐观锁和悲观锁,我没回答上来,回来之后我查了,数据库没有…

solverstate的使用

http://blog.csdn.net/wang4959520/article/details/51831637 我们在使用caffe训练过程中会生成.caffemodel和.solverstate文件,一个是模型文件,一个是中间状态文件(生成多少个取决于你自己设定的snapshot)。当训练过程中断&#…

IT从业者的迷思与求解之道——座谈会实录摘选

本次座谈会于上周六开始,由于网络原因,很多国内的小伙伴们没有能够连进去,挺遗憾的。所以我整理了本次座谈会的部分内容,希望能对大家有所帮助。洞察力主持人:大家好我们来自开源社群,今天举行在线it社区的…

准确率、召回率、F1、mAP、ROC、AUC

https://yongyuan-workbench.rhcloud.com/%E4%BF%A1%E6%81%AF%E6%A3%80%E7%B4%A2ir%E7%9A%84%E8%AF%84%E4%BB%B7%E6%8C%87%E6%A0%87%E4%BB%8B%E7%BB%8D-%E5%87%86%E7%A1%AE%E7%8E%87%E3%80%81%E5%8F%AC%E5%9B%9E%E7%8E%87%E3%80%81f1%E3%80%81map%E3%80%81r/准确率、召回率、F1…

从零开始实现ASP.NET Core MVC的插件式开发(六) - 如何加载插件引用

标题:从零开始实现ASP.NET Core MVC的插件式开发(六) - 如何加载插件引用。 作者:Lamond Lu 地址:https://www.cnblogs.com/lwqlun/p/11717254.html源代码:https://github.com/lamondlu/DynamicPlugins前景回顾•••••简介在前…

小波变换基础

http://blog.csdn.net/GarfieldEr007/article/details/50151845 第十二章 小波变换 目录 1 引言 2 连续小波变换 3 二进小波变换 3.1 Haar变换 4 离散小波变换 4.1 多分辨率分析 4.2 快速小波变换算法 4.3 离散小波变换的…

.Net Core3.0使用gRPC

gRPC是什么gRPC是可以在任何环境中运行的现代开源高性能RPC框架。它可以通过可插拔的支持来有效地连接数据中心内和跨数据中心的服务,以实现负载平衡,跟踪,运行状况检查和身份验证。它也适用于分布式计算的最后一英里,以将设备&am…

单链表逆向

转自:http://blog.csdn.net/heyabo/article/details/7610732 对于单链表的逆置有两种方法可以实现: (1)利用辅助指针 基本思想:在遍历结点过程中,设置辅助指针,用于记录先前遍历的结点。这样依次…

中国.NET开发者峰会特别活动-基于k8s的微服务和CI/CD动手实践报名

2019.11.9 的中国.NET开发者峰会将在上海举办,到目前为止,大会的主题基本确定,这两天就会和大家会面,很多社区的同学基于对社区的信任在我们议题没有确定的情况下已经购票超过了300张,而且分享的主题都来自于社区&…

高斯混合模型学习

转自:http://blog.csdn.net/jojozhangju/article/details/19182013 1.高斯混合模型概述 高斯密度函数估计是一种参数化模型。高斯混合模型(Gaussian Mixture Model, GMM)是单一高斯概率密度函数的延伸,GMM能够平滑地近似任意形状的…

[工具]OFFICE插件管理工具-帮助更好地管理及使用电脑安装过的OFFICE插件

在OFFICE软件的世界中,除了由微软提供的OFFICE软件功能外,还有大量的功能由第三方开发者完成,市面上也存在大量的OFFICE插件供用户选择。使用场景有些插件仅在某个特定场景下才会使用,日常办公过程中,无需开启&#xf…

随机梯度下降的实现细节

http://www.miaoerduo.com/deep-learning/%E5%9F%BA%E4%BA%8Ecaffe%E7%9A%84deepid2%E5%AE%9E%E7%8E%B0%EF%BC%88%E4%B8%8A%EF%BC%89.html 最近看了一篇文章,详细说明了随机梯度下降中随机是在create_imagenet.sh中shuffle实现的。 相关资源: DeepID&am…

那位标榜技术驱动的开发者去哪了?

作者:邹溪源,长沙资深互联网从业者,架构师社区合伙人!一他是一位曾经标榜技术驱动世界的开发者,在他年轻的时候,一段独特的经历,让他对技术充满了兴趣,并在技术这条道路上走了很远很…

图像PCA方法

http://blog.csdn.net/lifeng_math/article/details/50014073 http://blog.csdn.net/lifeng_math/article/details/49993763#旋转不变的-lbp 引言 PCA是Principal Component Analysis的缩写,也就是主成分分析。也是用于降维常用的一中方法。PCA 主要用于数据降维&a…