当前位置: 首页 > 编程日记 > 正文

【CV知识学习】early stop、regularation、fine-tuning and some other trick to be known

深度学习有不少的trick,而且这些trick有时还挺管用的,所以,了解一些trick还是必要的。上篇说的normalization、initialization就是trick的一种,下面再总结一下自己看Deep Learning Summer School, Montreal 2016 总结的一些trick。请路过大牛指正~~~

early stop

“早停止”很好理解,就是在validation的error开始上升之前,就把网络的训练停止了。说到这里,把数据集分成train、validation和test也算是一种trick吧。看一张图就明白了:

L1、L2 regularization

第一次接触正则化是在学习PRML的回归模型,那时还不太明白,现在可以详细讲讲其中的原理了。额~~~~(I will write the surplus of this article in English)

At the very outset, we take a insight on L1, L2 regularization. Assume the loss function of a linear regression model as . In fact, L1, L2 regularization can be seen as introducing prior distribution for the parameters. Here, L1 regularization can be interpreted as Laplace prior, and Guass prior for L2 regularization.Such tricks are used to reduce the complexity of a model.

L2 regularization

As before, we make a hypothesis that the target variable  is determined by the function  with an additive guass noise ,  resulting in, where is a zero mean Guassian random variable with precision . Thus we know  and its loglikelihood function form can be wrote as 

Finding the optimal solution for this problem is equal to minimize the least squre function .   If a zero mean  variance Guass prior is introduced for ,  we get the posterior distribution for  from the function (need to know prior + likelihood = posterior)

rewrite the equaltion in loglikelihood form, we will get 

 

 at the present,  you see . This derivation process accounts for why L2 regularization could be interpreted as Guass Prior.

L1 regularization

Generally, solving the the L1 regularization is called LASSO problem, which will force some coefficients to zero thus create a sparse model. You can get reference from here.

  

From the above images(two-dimensionality), something can be discovered that for the L1 regularization, the interaction points always locate on the axis, and this will forces some of the variables to be zero. Addtionally, we can learn that L2 regularization doesn't produce a sparse model(the right side image).

Fine tuning

It's easy to understand fine tuning, which could be interpreted as a way to initailizes the weight parameters then proceed a supervised learning. Parameters value can be migrated from a well-trained network, such as ImageNet. However, sometimes you may need an autoencoder, which is an unsupervised learning method and seems not very popular now. An autoencoder will learn the latent structure of the data in hidden layers, whose input and output should be same.

In fact, supervised learning of fine tune just performs regular feed forward process as in a feed-forwad network.

Then, I want to show you an image about autoencoder, also you can get more information in detail through this website.

Data argumentation

If training data is not large enough, it's a neccessary to expand the data by fliping, transferring or rotating to avoid overfit. However, according to the paper "Visualizing and Understanding Convolutional Networks",  CNN may not be as stable when fliping for image as transferring and rotating, except a symmetrical image. 

Pooling

I have introduced why pooling works well in the ealier article in this blog, if interested, you may need patience to look through the catalogue. In the paper "Visualizing and Understanding Convolutional Networks", you will see pooling sometimes a good way to control the invariance, I want to write down my notes about this classical paper in next article.

Dropout and Drop layer

Dropout now has become a prevalent technique to prevent overfitting, proposed by Hinton, etc. The dropout program will inactivate some nodes according to a probability p, which has been fixed before training. It makes the network more thinner. But why does it works ?  There may exist two main reasons, (1) for a batch of input data, nodes can be trained better in a thinner network, for they trained with more data in average.  (2) dropout inject noise into network which will do help.

Inspired by dropout and ResNet, Huang, etc propose drop layer, which make use of the shortcut connection in ResNet. It will enforce the information flow through the shortcut connection directly and obstruct the normal way according to a probability just like what dropout does. This technique makes the network  shorter in training, and can be used to trained a deeper network even more than 1000 layers.

Depth is important

The chart below interprets the reason why depth is important,

as the number of layer increasing, the classification accuracy arises. While visualizing the feature extracted from layers using decovnet("Visualizing and Understanding Convolutional Networks"), the deeper layer the more abstract feature extracted. And abstract feature will strengthen the  robustness, i.e. the invariance to transformation.

转载于:https://www.cnblogs.com/jie-dcai/p/5822333.html

相关文章:

etw系统provider事件较多_【Flutter 实战】文件系统目录

老孟导读:Flutter 中获取文件路径,我们都知道使用 path_provider,但对其目录对含义不是很清楚,此文介绍 Android、iOS 系统的文件目录,不同场景下建议使用的目录。 不同的平台对应的文件系统是不同的,比如文…

BZOJ4491: 我也不知道题目名字是什么

【传送门:BZOJ4491】 简要题意: 给出一个长度为n的序列,m个操作,每个操作输入x,y,求出第x个数到第y个数的最长子串,保证这个最长子串是不上升或不下降子串 题解: 线段树 因为不上升或…

区块链挖矿的钱从哪来 区块链挖矿怎么挣钱

链客,专为开发者而生,有问必答! 此文章来自区块链技术社区,未经允许拒绝转载。 进入2018年以来,区块链在资本市场的风口上依然热度不减,已成为当下最热的投资领域。而普通投资者想通过区块链投资赚钱最简单…

Linux-TCP/IP TIME_WAIT状态原理

TIME_WAIT状态原理----------------------------通信双方建立TCP连接后,主动关闭连接的一方就会进入TIME_WAIT状态。客户端主动关闭连接时,会发送最后一个ack后,然后会进入TIME_WAIT状态,再停留2个MSL时间(后有MSL的解释)&#xf…

python如何实现找图_利用OpenCV和Python实现查找图片差异

使用OpenCV和Python查找图片差异 flyfish 方法1 均方误差的算法(Mean Squared Error , MSE)下面的一些表达与《TensorFlow - 协方差矩阵》式子表达式一样的拟合 误差平方和( sum of squared errors) residual sum of squares (RSS…

区块链还能赚钱吗 区块链挖矿赚钱吗

链客,专为开发者而生,有问必答! 此文章来自区块链技术社区,未经允许拒绝转载。 区块链有多火,连我母上都知道这个词,身边很多人也都向笔者咨询这个东西。 其实他们真实的想法是,想知道这东西到…

pythonfor循环遍历list_为什么for循环可以遍历list:Python中迭代器与生成器

1 引言 只要你学了Python语言,就不会不知道for循环,也肯定用for循环来遍历一个列表(list),那为什么for循环可以遍历list,而不能遍历int类型对象呢?怎么让一个自定义的对象可遍历? 这篇博客中&am…

Linux下查看和添加环境变量

转自:http://blog.sina.com.cn/s/blog_688077cf01013qrk.html $PATH:决定了shell将到哪些目录中寻找命令或程序,PATH的值是一系列目录,当您运行一个程序时,Linux在这些目录下进行搜寻编译链接。 编辑你的 PATH 声明&am…

iis7下站点日志默认位置

iis7下站点日志默认位置 原文:iis7下站点日志默认位置iis7下站点日志默认位置在iis6时,通过iis管理器的日志配置可以找到站点日志存储的位置。但是在iis7下,iis管理器下的日志配置只能找到iis日志配置的主目录,但到底在哪个子目录&#xff0c…

go语言有哪些优势

链客,专为开发者而生,有问必答! 此文章来自区块链技术社区,未经允许拒绝转载。 1、学习曲线容易 Go语言语法简单,包含了类C语法。因为Go语言容易学习,所以一个普通的大学生花几个星期就能写出来可以上手的…

重定向后,如何通过浏览器返回定向之前的页面?

js实现页面跳转重定向的几种方式 第一种&#xff1a; 代码如下: <script language"javascript"type"text/javascript">window.location.href"http://shanghepinpai.com";</script> 第二种&#xff1a; 代码如下: <script languag…

金蝶中间件部署报栈溢出_京东618压测时自研中间件暴露出的问题,压测级别数十万/秒...

618大促演练进行了全链路压测&#xff0c;在此之前刚好我的热key探测框架也已经上线灰度一周了&#xff0c;小范围上线了几千台服务器&#xff0c;每秒大概接收几千个key探测&#xff0c;每天大概几亿左右&#xff0c;因为量很小&#xff0c;所以框架表现稳定。借着这次压测&am…

利用box-shadow绘图

上篇博客提到过&#xff0c;box-shadow属性的本质是对形状的复制&#xff0c;那么如果我设置一个1*1px的i标签&#xff0c;利用box-shadow可以叠加的特性&#xff0c;给每一个1*1px的阴影赋上颜色&#xff0c;那么最后不就是一幅图片了么。 html代码很简单&#xff1a; <!do…

为什么要使用Go语言?Go语言的优势在哪里?

链客&#xff0c;专为开发者而生&#xff0c;有问必答&#xff01; 此文章来自区块链技术社区&#xff0c;未经允许拒绝转载。 Go语言之所有越来越受到开发者的欢迎&#xff0c;我认为与其超高的实用价值密不可分。要知道Go语言是为了解决现实问题而设计的&#xff0c;而不是为…

BI之SSAS完整实战教程3 -- 创建第一个多维数据集

上一篇我们已经完成了数据源的准备工作&#xff0c;现在我们就开始动手&#xff0c;创建第一个多维数据集(Cube)。 文章提纲 使用多维数据集向导创建多维数据集 总结Cube设计器简介 维度细化 总结 一、使用向导创建多维数据集 在Analysis Services中&#xff0c;可以通过3种…

python opencv local_threshold_Python-OpenCV中的cv2.threshold

主要记录Python-OpenCV中的cv2,threshold()方法&#xff1b;官方文档 cv2.threshold() def threshold(src, thresh, maxval, type, dstNone): """ 设置固定级别的阈值应用于多通道矩阵 例如&#xff0c;将灰度图像变换二值图像&#xff0c;或去除指定级别的噪声…

java中decimalFormat格式化数值

介绍 我们经常要对数字进行格式化&#xff0c;比如取小数点后两位小数&#xff0c;或者加个百分比符号等&#xff0c;Java提供了DecimalFormat这个类0 和 # 的区别 "#"可以理解为在正常的数字显示中&#xff0c;如果前缀与后缀出现不必要的多余的0&#xff0c;则将其…

GO语言有哪些优势?怎样入门?

链客&#xff0c;专为开发者而生&#xff0c;有问必答&#xff01; 此文章来自区块链技术社区&#xff0c;未经允许拒绝转载。 1、学习曲线 它包含了类C语法、GC内置和工程工具。这一点非常重要&#xff0c;因为Go语言容易学习&#xff0c;所以一个普通的大学生花一个星期就能…

POJ-2955 Brackets

题目大意&#xff1a; 给你一个只由(、)、[、]组成的字符串&#xff0c;问你这个字符串的子串能够匹配的最长长度是多少。 能够匹配的意思是这样的&#xff1a; 1.如果s是个空串&#xff0c;那么它是匹配的。 2.如果子串是(s)或者[s]&#xff0c;那么它也是匹配的&#xff0c;其…

CentOS7.4-btrfs管理及使用

btrfs, B-tree File System, GPL开源文件系统, 支持CoW即读时写入. 核心特性: 多物理卷支持;btrfs可由多个底层磁盘组成支持RAID mkfs.btrfs 命令的man文档支持: raid0, raid1, raid5, raid6,raid10, single or dup联机"添加, 移除, 修改" CoW写时复制更新机制 对文件…

取消对 null 指针“l”的引用。_C++中的引用

当变量声明为引用时&#xff0c;它将成为现有变量的替代名称。通过在声明中添加“&#xff06;”&#xff0c;可以将变量声明为引用。#include using namespace std; int main() { int x 10; // ref is a reference to x. int& ref x; // Value of x is no…

你没听说过的Go语言惊人优点

链客&#xff0c;专为开发者而生&#xff0c;有问必答&#xff01; 此文章来自区块链技术社区&#xff0c;未经允许拒绝转载。 在这篇文章中&#xff0c;我将讨论为什么你需要尝试一下 Go 语言&#xff0c;以及应该从哪里学起。 Go 语言是可能是最近几年里你经常听人说起的编…

JS document

<!DOCTYPE html> <html><head><meta charset"UTF-8"><title></title></head><body><div id"one">今天下雨</div><table border"1" cellspacing"0" cellpadding"…

python 流写入文件_python文件流操作

博主在学习python时对文件进行操作时经常踩一下坑。所以专门梳理了一下。有问题麻烦指出哈。 python对于文件的操作我们一般是用open&#xff08;&#xff09;。我们根据python的源码可以看出。我们必须要传的参是file即打开文件的URL。同时open方法默认是是r的打开方式即只读。…

使用 Python 从零开始开发区块链应用程序

链客&#xff0c;专为开发者而生&#xff0c;有问必答&#xff01; 此文章来自区块链技术社区&#xff0c;未经允许拒绝转载。 “区块链”是什么&#xff1f; 区块链是一种存储数字数据的方式。数据可以是任何内容。对于比特币&#xff0c;它是事务&#xff08;在帐户之间转移…

Mybatis学习记录-使用问题总结之一DISTINCT

问题1&#xff1a;手动修改的查询语句&#xff0c;放入到项目中后显示结果和实际查询结果不一致 由于实际情况中用的了分页功能&#xff0c;导致最终的语句在查询完成后&#xff0c;添加了分页项&#xff0c;即如下代码。 ROW_NUMBER() OVER ( ORDER BY COLUMNS) PAGE_ROW_NUMB…

python xlrd读取excel所有数据_python读取excel进行遍历/xlrd模块操作

我就废话不多说了&#xff0c;大家还是直接看代码吧~ #!/usr/bin/env python # -*- coding: utf-8 -*- import csv import xlrd import xlwt def handler_excel(filenamer/Users/zongyang.yu/horizon/ops_platform/assets/upload/1.xlsl): # 打开文件 workbook xlrd.open_work…

【NOIP2015提高组Day1】 神奇的幻方

【问题描述】 幻方是一种很神奇的 N*N矩阵&#xff1a;它由数字1,2,3, … … ,N*N 构成&#xff0c;且每行、每列及两条对角线上的数字之和都相同。 当N为奇数时&#xff0c;我们可以通过以下方法构建一个幻方&#xff1a; 首先将1写在第一行的中间。 之后&#xff0c;按如下…

40行python开发一个区块链

链客&#xff0c;专为开发者而生&#xff0c;有问必答&#xff01; 此文章来自区块链技术社区&#xff0c;未经允许拒绝转载。 尽管有人认为区块链目前还是个不成熟的解决方案&#xff0c;但它无疑称得上是计算机发展历史上的一个奇迹。但是&#xff0c;到底区块链是什么呢?…

网络实验的背景流

在最近做的网络实验中&#xff0c;发现背景流必须要先于实验流开始&#xff0c;并且要长于实验流的时间&#xff0c;这样才能看出实验流的规律。如果背景流后发于实验流&#xff0c;就会变成竞争模式&#xff0c;实验流就会被抢占或者挤压。转载于:https://www.cnblogs.com/fen…