diff --git a/.vscode/settings.json b/.vscode/settings.json index d3d97be..cccf708 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,10 @@ // Place your settings in this file to overwrite default and user settings. { - "update.channel": "none" + "update.channel": "none", + "files.associations": { + "*.pyx": "python", + "*.cu": "cpp", + "vector": "cpp", + "ostream": "cpp" + } } \ No newline at end of file diff --git a/algorithm/adaboost.md b/algorithm/adaboost.md index 87a58a4..a393699 100644 --- a/algorithm/adaboost.md +++ b/algorithm/adaboost.md @@ -143,6 +143,7 @@ nohup ./opencv_traincascade_tbb -data cascadeWide/ -vec posl.vec -bg bg.txt -num -w 宽度,与opencv_createsample用到的参数-w,-h保持一致 -h 高度 ``` + 听说,正负样本比例满足1:5最好 正样本总数要满足这个公示: > $$numPose + (numStages - 1) * (1 - minHitRate) * numPose + S$$ @@ -154,7 +155,9 @@ N|HR|FA ----|---|--- number|HitRate|FalseAlarm 弱分类器的个数|分类器在正样本中正确识别的比例|分类器在负样本中识别为正样本的比例 + ## 输出解释 + ```shell ===== TRAINING 0-stage ===== Training until now has taken 0 days 0 hours 3 minutes 50 seconds. ``` + ## 原理 + OpenCV中实现了 - DAB: discrete adaboost - RAB: real adaboost - LB: logitboost - [GAB](http://blog.csdn.net/dataningwei/article/details/54836386) -一个完整的GAB(gentle adaboost)训练过程算是对一个stage的训练,一个stage就是一个强分类器。通过将强分类器级联就得到了OpenCV中的级联Adaboost分类器。而强分类器是由多个弱分类器'并联'组成的,'并联'的意思是多个弱分类器的输出值加起来与该级强分类器阈值比较。 +一个完整的GAB(gentle adaboost)训练过程算是对一个stage的训练,一个stage就是一个强分类器。通过将强分类器级联就得到了OpenCV中的级联Adaboost分类器。而强分类器是由多个弱分类器'并联'组成的,'并联'的意思是多个弱分类器的输出值加起来与该级强分类器阈值比较,即加法模型。 ```html <_> diff --git a/algorithm/blob.md b/algorithm/blob.md index 9d1f264..c677ae4 100644 --- a/algorithm/blob.md +++ b/algorithm/blob.md @@ -1,13 +1,16 @@ -blob feature ----- +# blob feature + ## 定义 + 一个blob是图像中一块像素相似的区域,并且它的属性异于块的周围。 ## 检测方法分类 + 1. 差分方法 2. 极值方法 ## 检测方法 + 1. laplacian of gaussian 2. difference of gaussians 3. determinant of hessian \ No newline at end of file diff --git a/algorithm/color.md b/algorithm/color.md index 848548e..1e97b1f 100644 --- a/algorithm/color.md +++ b/algorithm/color.md @@ -1,4 +1,5 @@ -颜色空间 +# 颜色空间 + rgb: 三个元素对亮度都比较敏感,即亮度改变,三个值随之改变,是针对人眼设计的色彩空间 yuv: \ No newline at end of file diff --git a/algorithm/descent.md b/algorithm/descent.md new file mode 100644 index 0000000..66cfefa --- /dev/null +++ b/algorithm/descent.md @@ -0,0 +1,5 @@ +# coordinate descent + +[wiki](https://en.wikipedia.org/wiki/Coordinate_descent) + +变量不可导情况 \ No newline at end of file diff --git a/algorithm/acf.md b/algorithm/feature/acf.md similarity index 97% rename from algorithm/acf.md rename to algorithm/feature/acf.md index 7e123cc..a43f6ef 100644 --- a/algorithm/acf.md +++ b/algorithm/feature/acf.md @@ -1,10 +1,12 @@ +# acf + [acf](https://github.com/yaoweidong/ACFPedestrianDetection) integral channel feature(积分通道特征) aggregated channel features(聚合通道特征),是基于ICF的改进 ## acf实现 + 图像10个通道的计算, 特征向量的获取, 窗口遍历检测 决策树adaboost - diff --git a/algorithm/hog.md b/algorithm/feature/hog.md similarity index 100% rename from algorithm/hog.md rename to algorithm/feature/hog.md diff --git a/algorithm/surf.md b/algorithm/feature/surf.md similarity index 94% rename from algorithm/surf.md rename to algorithm/feature/surf.md index 5c51642..ea83acc 100644 --- a/algorithm/surf.md +++ b/algorithm/feature/surf.md @@ -1,5 +1,8 @@ +# surf + notes on the openSurf Library --------- + [openSurf](https://web.archive.org/web/20150206140535/http://www.chrisevansdev.com/) + **Author: Shristopher Evans** **Year: 2009** diff --git a/algorithm/icp.md b/algorithm/icp.md new file mode 100644 index 0000000..e441775 --- /dev/null +++ b/algorithm/icp.md @@ -0,0 +1 @@ +# ICP(Iterative Closest Point) \ No newline at end of file diff --git a/algorithm/kcf.md b/algorithm/kcf.md index 271cb46..ceec43d 100644 --- a/algorithm/kcf.md +++ b/algorithm/kcf.md @@ -1,4 +1,14 @@ -[kcf](https://zhuanlan.zhihu.com/p/26685032) -[staple](https://zhuanlan.zhihu.com/p/25312595) +# kcf + +[kcf](https://zhuanlan.zhihu.com/p/26685032) +[staple](https://zhuanlan.zhihu.com/p/25312595) +[kcf原理](https://blog.csdn.net/shenxiaolu1984/article/details/50905283) +[kcf原理详细](https://www.cnblogs.com/YiXiaoZhou/p/5925019.html) + +跟踪问题可以按如下步骤解决: + +1. 在It帧中,在当前位置pt附近采样,训练一个回归器。这个回归器能计算一个小窗口采样的响应。 +2. 在It+1帧中,在前一帧位置pt附近采样,用前述回归器判断每个采样的响应。 +3. 响应最强的采样作为本帧位置pt+1。 行人跟踪 \ No newline at end of file diff --git a/algorithm/math/calculas.md b/algorithm/math/calculas.md new file mode 100644 index 0000000..e76aa56 --- /dev/null +++ b/algorithm/math/calculas.md @@ -0,0 +1,15 @@ +## 积分 + +- 分部积分法 + +> $$\begin{aligned} d(uv) &=udv+vdu \rightarrow\\ + \int(d(uv)) &=\int udv+\int vdu \rightarrow\\ + uv &=\int udv+\int vdu \end{aligned}$$ + +- 换元积分法 + + > $$u=g(x)$$ + > $$\int(f(u)u')dx = \int(f(u))du$$ + + eg. + > $$\int \frac{x^2}{\exp(-x)+1} dx$$ \ No newline at end of file diff --git a/algorithm/chainrule.md b/algorithm/math/chainrule.md similarity index 100% rename from algorithm/chainrule.md rename to algorithm/math/chainrule.md diff --git a/algorithm/math/lagrange.md b/algorithm/math/lagrange.md new file mode 100644 index 0000000..d3fc368 --- /dev/null +++ b/algorithm/math/lagrange.md @@ -0,0 +1,9 @@ +## [如何通俗地讲解对偶问题?尤其是拉格朗日对偶lagrangian duality? - 彭一洋的回答 - 知乎](https://www.zhihu.com/question/58584814/answer/159863739) + +1. 无约束优化问题,极致处对各变量的偏导数为0的条件。 +2. 等式约束优化问题,拉格朗日条件,对应的拉格朗日函数为$L(x,\lambda)=f(x)+\lambda h(x)$。 +3. 不等式约束优化问题,KKT条件。 + +## [对偶问题][http://www.hanlongfei.com/convex/2015/11/05/duality/] + +## [KKT条件] \ No newline at end of file diff --git a/algorithm/math/line.md b/algorithm/math/line.md new file mode 100644 index 0000000..4b03e5d --- /dev/null +++ b/algorithm/math/line.md @@ -0,0 +1,6 @@ +## 空间三维直线方程 + +1. 两点式 +2. 点向式 + +## 点到直线的距离 diff --git a/algorithm/math.md b/algorithm/math/matrix.md similarity index 50% rename from algorithm/math.md rename to algorithm/math/matrix.md index 3da0430..7e93965 100644 --- a/algorithm/math.md +++ b/algorithm/math/matrix.md @@ -1,19 +1,51 @@ +# matrix + ## 矩阵乘法 -- dot product, scalar product, inner product,点积,内积 + +- dot product, scalar product, inner product,点积,内积(又称为数量积,接受两个向量返回一个标量值;在欧几里得空间称为内积) + 是向量之间的乘积,是行向量乘以列向量,得到标量数值 > $$a\cdot b = \sum_{i=1}^{n}a_i b_i$$ + +余弦定理 +> $$\vec{a}\cdot \vec{b}=|\vec{a}|*|\vec{b}|*cos(\theta)$$ +$\vec{a}$在$\vec{b}$上的投影长度为: +> $$\vec{a} \cdot \frac{\vec{b}}{|\vec{b}|}=|\vec{a}|*cos(\theta)$$ + - outer product 外积 + 是向量之间的乘积,是列向量乘以行向量,得到的是矩阵 -> $$a\otimes b$$ +> $$a\otimes b$$ + - 矩阵的内积是有公式定义的,矩阵论 + - 一般矩阵乘积 + 只有在第一个矩阵的列数与第二个矩阵的函数相同时,才有意义。可以分别将矩阵看做行向量或列向量然后按向量乘积规则内积或外积进行运算的。 -- Hadamard product + +- Hadamard product + 是两个相同维度的矩阵的乘积,按元素相乘 > $$A\odot B$$ + - Kronecker product,是外积的推广,叫克罗内克积 + 矩阵 > $$A \otimes B$$ + - cross product, vector product, 叉积 + 遵从右手法则的乘积 > $$a\times b = \|a\|\|b\| \sin(\theta)n \qquad \text{其中,n 是一个垂直a和b定义的平面的单位向量}$$ + +## [矩阵求逆](https://www.shuxuele.com/algebra/matrix-inverse.html) + +1. 初等行变换求解 + 对换两行的位置 + 把一行里的每个元素乘以或除以一个常数 + 把一行加上另一行的倍,并取代前者。 +2. 代数余子式求解 + 求余子式 $A_{ij}, i\in{[1\sim n]}$ + 求代数余子式$(-1)^{(i+j)}A_{ij}$ + 转成伴随矩阵?,即转置上一步中的代数余子式矩阵 + 除以原矩阵行列式 \ No newline at end of file diff --git a/algorithm/math/transform.md b/algorithm/math/transform.md new file mode 100644 index 0000000..6e28a32 --- /dev/null +++ b/algorithm/math/transform.md @@ -0,0 +1,48 @@ +# transform + +[等距变换->投影变换](https://blog.csdn.net/u014096352/article/details/53526747) +[opencv实现](https://www.cnblogs.com/wqj1212/p/3915859.html) + +## 1. 等距变换(isometric transform) + +3个自由度:左右平移、上下平移、旋转 + +## 2. 相似变换(similarity transform) + +4个自由度:左右平移、上下平移、旋转、均匀缩放 + +## 3. 仿射变换(affine transform) + +6个自由度:左右平移、上下平移、旋转、横向缩放、纵向缩放、同比例错切 + +由三个点确定的变换,即六个参数确定的变换 +[马同学对仿射变换的解释](https://www.zhihu.com/search?type=content&q=%E4%BB%BF%E5%B0%84%E5%8F%98%E6%8D%A2) +仿射变换 = 线性变换(旋转和拉伸) + 平移, 对应的数学公式为 +> $$\vec{y}=A\cdot\vec{x}+\vec{b}$$ (1) +- **线性变换 $\vec{y}=A\cdot \vec{x}$ 只有矩阵乘法** + +线性变化有如下3条属性: + +1. 直线经过变换后依旧是直线 +2. 并且比例不变 +3. 原点不变 + +- 平移不是线性变换而是仿射变换 +- 可以通过增加一个维度来使仿射变换表示线性变换(线性变换只有乘法没有加法),齐次坐标表示 + +> $$\begin{bmatrix}\vec{y} \\ 1\end{bmatrix}= \begin{bmatrix} A &\vec{b} \\ 0 & 1\end{bmatrix} \cdot \begin{bmatrix} \vec{x} \\ 1 \end{bmatrix}$$ (2) + +[最小二乘法求解](../../books/esl/2_overviewOfSupervisedLeraning.md) +[最小二乘法求解-Levenberg-Marquardt](../optim/lm.md) +[仿射变换矩阵求解](opencv-estimateAffine2D、estimateAffinePartial2D、estimateRigidTransform、getAffineTransform) +[svd解法及证明](https://igl.ethz.ch/projects/ARAP/svd_rot.pdf),并没有对旋转矩阵加约束 + +> $$y=x^Tw+b$$ (3) +数学中,线性函数指线性的函数(经过原点),但也常用做一次函数的别称,尽管一次函数不一定是线性的(即$b\rlap{\,/}{=}0$时) + +## 4. 透视变换(projection transform) + +8个自由度,左右平移、上下平移、旋转、横向缩放、纵向缩放、同比例错切? + +相机模型就是一个透视变换,是由四个点变换确定的变换,即八参数变换 +从一个透视点 \ No newline at end of file diff --git a/algorithm/optim/gd.md b/algorithm/optim/gd.md new file mode 100644 index 0000000..cea5f79 --- /dev/null +++ b/algorithm/optim/gd.md @@ -0,0 +1,4 @@ +# gradient descent + +2019-04-18 20:26 + diff --git a/algorithm/optim/icp.md b/algorithm/optim/icp.md new file mode 100644 index 0000000..5d2c5cb --- /dev/null +++ b/algorithm/optim/icp.md @@ -0,0 +1,35 @@ +# Iterative Closest Point (ICP,迭代最近邻点) + +2019-04-19 09:20 + +[icp总体思路](http://ais.informatik.uni-freiburg.de/teaching/ss12/robotics/slides/17-icp.pdf) + +根据对应点之间误差的度量方式,ICP可以分为: + +- point-to-point +- point-to-plane +- plane-to-plane + +## 闭式解 + +如果点与点之间的关系(旋转和平移)是确定的,就可以使用闭式解(closed form),即对协方差矩阵做奇异值分解的方法。[证明过程](https://igl.ethz.ch/projects/ARAP/svd_rot.pdf) + +- 协方差矩阵 + +> $$W=\sum_{i=1}^{N_p}x_iy_i$$(1) + +- 奇异值分解(SVD) + +> $$W=U\begin{bmatrix} \sigma1 & 0 & 0 \\ +0 & \sigma2 & 0 \\ +0 & 0 & \sigma3 \end{bmatrix}V^T$$(2) +其中,U、V是酉矩阵(unitary matrix),酉矩阵的共轭矩阵是其逆矩阵。$\sigma1\geqslant\sigma2\geqslant\sigma3$为奇异值。 + +- 那么,结果为 + +> $$\begin{aligned}R&=UV^T\\ +T&=\mu_x-R\mu_y\end{aligned}$$(3) + +## 迭代方法求解 + +如果点与点之间的关系不是确定的,那么就无法确定全局最优解,而只能得到局部最小值。 \ No newline at end of file diff --git a/algorithm/optim/lm.md b/algorithm/optim/lm.md new file mode 100644 index 0000000..9d940ce --- /dev/null +++ b/algorithm/optim/lm.md @@ -0,0 +1,9 @@ +# Levenberg-Marquardt algorithm + +2019-04-18 20:14 + +[implmentation c/c++](http://users.ics.forth.gr/~lourakis/levmar/index.html) +[Methods for non-linear least squares problems](http://www2.imm.dtu.dk/pubdb/views/edoc_download.php/3215/pdf/imm3215.pdf) + +从opencv计算仿射变换矩阵的函数检索到这里。 +中文名为列文伯格-马夸尔特法,是一个通过迭代的步骤来求解使非线性方程的平方误差和最小的方法。它已经成为一个解决非线性最小二乘问题的经典算法,可以看做最速下降法和牛顿法的结合体。当前解与最优解较远时,是[最速下降法](./gd.md),当前解与最优解较近时,是牛顿法。 diff --git a/algorithm/simulatedAnnealing.md b/algorithm/simulatedAnnealing.md new file mode 100644 index 0000000..ee855ee --- /dev/null +++ b/algorithm/simulatedAnnealing.md @@ -0,0 +1,12 @@ +# simulated annealing 模拟退火 +[blog](http://www.cnblogs.com/heaad/archive/2010/12/20/1911614.html) + +使用场景: +在一定时间内寻找一个很大搜索空间中的近似最优解 + +算法包括新解的产生和接受新解两个步骤: +1. 生成函数基于当前解生成新解。 +参数更新包括两种策略: +1. 参数更新后的损失更低,则总是接受更新 +2. 参数更新后的损失变高,则以一定概率接收该更新,概率随着迭代次数的增加降低 + diff --git a/algorithm/track.md b/algorithm/track.md index 84c2813..647f429 100644 --- a/algorithm/track.md +++ b/algorithm/track.md @@ -1,5 +1,6 @@ 1. 各种色彩空间直方图,利用色彩空间的直方图分布作为目标跟踪的特征的一个显著性特点是可以减少物体远 近距离对跟踪的影响,因为其颜色分布大致相同。 + 2. 轮廓特征,提取目标的轮廓特征不但可以加快算法的速度还可以在目标有小部分影响的情况下同样有效果。 3. 纹理特征,如果被跟踪目标是有纹理的,根据其纹理特征来跟踪,效果会有所改善。 当前目标跟踪算法大体可分为以下七种 diff --git a/balackfive/blog/distance.md b/balackfive/blog/distance.md index 188b109..7d0fd0a 100644 --- a/balackfive/blog/distance.md +++ b/balackfive/blog/distance.md @@ -1,8 +1,8 @@ -![111.jpg](.111.jpg) +![111.jpg](111.jpg) 点$A(x_0,y_0)$到直线$ax+by+c=0$的距离就等价于点A到直线$ax+by=0$的距离(图中的OB),加上直线$ax+by+c=0$在y轴的交点$C(0,-\frac{c}{b})$到直线$ax+by=0$的距离(图中的OD)之和。即 -$$d=OB+OD$$ +> $$d=OB+OD$$ 直线$ax+by+c=0$的单位法向量是$\frac{(a,b)}{\sqrt{a^2+b^2}}$,那么由向量 -$$\begin{aligned} OB&=|(x_0,y_0)\cdot \frac{(a,b)}{\sqrt{a^2+b^2}}|=\frac{|a*x_0 + b*y_0|}{\sqrt{a^2+b^2}} \\ +> $$\begin{aligned} OB&=|(x_0,y_0)\cdot \frac{(a,b)}{\sqrt{a^2+b^2}}|=\frac{|a*x_0 + b*y_0|}{\sqrt{a^2+b^2}} \\ OD&=|(0,-\frac{c}{b})\cdot \frac{(a,b)}{\sqrt{a^2+b^2}}|=\frac{|-c|}{\sqrt{a^2+b^2}} \end{aligned}$$ 实际情况也可能是两者相减,这里不再考虑,对于图中的情况是两者相加 \ No newline at end of file diff --git a/balackfive/blog/evaluate.md b/balackfive/blog/evaluate.md index 8c15d47..f1f57d7 100644 --- a/balackfive/blog/evaluate.md +++ b/balackfive/blog/evaluate.md @@ -1,4 +1,5 @@ -## evaluation +# evaluation + 这是FDDB数据集自带的绘ROC曲线程序,但是也可以用在其它目标检测数据集上面。 1. evaluate程序的编译 下载evaluation code, 链接: http://vis-www.cs.umass.edu/fddb/results.html @@ -11,7 +12,7 @@ INCS = -I/usr/local/include/opencv LIBS = -L/usr/local/lib -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy - + # Change the order in the evaluate. evaluate: $(OBJS) diff --git a/books/aByteOfPython/preface.md b/books/aByteOfPython/0_preface.md similarity index 93% rename from books/aByteOfPython/preface.md rename to books/aByteOfPython/0_preface.md index 876a6f2..76e03ed 100644 --- a/books/aByteOfPython/preface.md +++ b/books/aByteOfPython/0_preface.md @@ -1,3 +1,5 @@ +# [a byte of python](https://python.swaroopch.com/) + ## 面向对象的特性 ``` Python 同时支持面向过程编程与面向对象编程。在 面向过程 的编程语言中,程序是由仅仅带有可重用特性的子程序与函数所构建起来的。在 面向对象 的编程语言中,程序是由结合了数据与功能的对象所构建起来的。与 C++ 或 Java 这些大型语言相比,Python 具有其特别的、功能强大又简单的方式来实现面向对象编程。 diff --git a/books/aByteOfPython/exception.md b/books/aByteOfPython/10_exception.md similarity index 100% rename from books/aByteOfPython/exception.md rename to books/aByteOfPython/10_exception.md diff --git a/books/aByteOfPython/stdlib.md b/books/aByteOfPython/11_stdlib.md similarity index 100% rename from books/aByteOfPython/stdlib.md rename to books/aByteOfPython/11_stdlib.md diff --git a/books/aByteOfPython/more.md b/books/aByteOfPython/12_more.md similarity index 88% rename from books/aByteOfPython/more.md rename to books/aByteOfPython/12_more.md index 774f9b8..0a3c720 100644 --- a/books/aByteOfPython/more.md +++ b/books/aByteOfPython/12_more.md @@ -1,15 +1,19 @@ -## 传递元组 +## 传递元组 ## 特殊方法 + ```python __init__() ``` ## 单语句块 + 避免使用 ## lambda表格 + 从本质上说,lambda 需要一个参数,后跟一个表达式作为函数体,这一表达式执行的值将作为这个新函数的返回值。 + ```python points = [{'x': 2, 'y': 3}, {'x': 4, 'y': 1}] @@ -18,6 +22,7 @@ print(points) ``` ## line comprehension(列表推导) + ```python listone = [2, 3, 4] listtwo = [2*i for i in listone if i > 2] @@ -25,7 +30,13 @@ print(listtwo) ``` ## assert + 当失败时,会报错 +```python +assert False, "message %d" % i +``` + ## 包装器 + decorators \ No newline at end of file diff --git a/books/aByteOfPython/basis.md b/books/aByteOfPython/1_basis.md similarity index 91% rename from books/aByteOfPython/basis.md rename to books/aByteOfPython/1_basis.md index 25d9fea..5a7e322 100644 --- a/books/aByteOfPython/basis.md +++ b/books/aByteOfPython/1_basis.md @@ -1,6 +1,6 @@ ## 字面常量(Literal Constants) -## 字符串 +## string 字符串 - python中没有char类型 - 单引号与双引号(''与"")的作用完全相同,没有任何区别, - 三引号('''与""")用来指定多行字符串,可以在三引号之间自由的使用单引号、双引号 @@ -12,7 +12,7 @@ print('{0}abcd'.format(a)) # 对于浮点数 '0.333' 保留小数点(.)后三位 print('{0:.3f}'.format(1.0/3)) -# 在一个字符串中,一个放置在末尾的反斜杠表示字符串将在下一行继续,但不会添加新的一行。 +# 在一个字符串中,一个放置在末尾的反斜杠(前无空格)表示字符串将在下一行继续,但不会添加新的一行。 "This is the first sentence. \ This is the second sentence." # 相当于 diff --git a/books/aByteOfPython/operatorAndExpress.md b/books/aByteOfPython/2_operatorAndExpress.md similarity index 99% rename from books/aByteOfPython/operatorAndExpress.md rename to books/aByteOfPython/2_operatorAndExpress.md index f7a3298..0dafb13 100644 --- a/books/aByteOfPython/operatorAndExpress.md +++ b/books/aByteOfPython/2_operatorAndExpress.md @@ -1,4 +1,5 @@ ## 运算符与操作数(operators and operands) + 常用operators ```python ** # 乘方 diff --git a/books/aByteOfPython/control.md b/books/aByteOfPython/3_control.md similarity index 100% rename from books/aByteOfPython/control.md rename to books/aByteOfPython/3_control.md diff --git a/books/aByteOfPython/function.md b/books/aByteOfPython/4_function.md similarity index 91% rename from books/aByteOfPython/function.md rename to books/aByteOfPython/4_function.md index b767e69..e0e0acc 100644 --- a/books/aByteOfPython/function.md +++ b/books/aByteOfPython/4_function.md @@ -1,35 +1,45 @@ +# function + ## 函数参数 + 在定义函数时给定的名称称作“形参”(Parameters),在调用函数时你所提供给函数的值称作“实参”(Arguments)。 +参数顺序: +位置参数,默认参数,包裹位置(元组),包裹关键字(字典) ## 局部变量 - ## global语句 + 你可以使用定义于函数之外的变量的值(假设函数中没有具有相同名字的变量)然而,这种方式不会受到鼓励而且应该避免,因为它对于程序的读者来说是含糊不清的,无法弄清楚变量的定义究竟在哪。而通过使用 global 语句便可清楚看出这一变量是在最外边的代码块中定义的 ## 默认参数值 -要注意到,默认参数值应该是常数。 + +要注意到,默认参数值应该是常数。 在函数定义时,在行参后接=来定义 > 只有那些位于参数列表末尾的参数才能被赋予默认参数值,意即在函数的参数列表中拥有默认参数值的参数不能位于没有默认参数值的参数之前。这是因为值是按参数所处的位置依次分配的 ## 关键字参数 + 我们使用命名(关键字)而非位置(一直以来我们所使用的方式)来指定函数中的参数。 ## 可变参数 + 有时你可能想定义的函数里面能够有任意数量的变量,也就是参数数量是可变的,这可以通过使用星号来实现 > 当我们声明一个诸如 *param 的星号参数时,从此处开始直到结束的所有位置参数(Positional Arguments)都将被收集并汇集成一个称为“param”的元组(Tuple)。 > 类似地,当我们声明一个诸如 **param 的双星号参数时,从此处开始直至结束的所有关键字参数都将被收集并汇集成一个名为 param 的字典(Dictionary)。 - ## return + 要注意到如果 return 语句没有搭配任何一个值则代表着 返回 None。None 在 Python 中一个特殊的类型,代表着虚无。举个例子, 它用于指示一个变量没有值,如果有值则它的值便是 None(虚无)。 每一个函数都在其末尾隐含了一句 return None,除非你写了你自己的 return 语句 > Python 中的 pass 语句用于指示一个没有内容的语句块。 +当返回多个值时,其实返回的是tuple,也就是语法上,返回语句的小括号被省略了。而多个值可以同时接受一个tuple。 ## DocStrings(文档字符串) -``` + +```txt 函数的第一行逻辑行中的字符串是该函数的 文档字符串(DocString)。这里要注意文档字符串也适用于后面相关章节将提到的模块(Modules)与类(Class) 。 该文档字符串所约定的是一串多行字符串,其中第一行以某一大写字母开始,以句号结束。第二行为空行,后跟的第三行开始是任何详细的解释说明。5在此强烈建议你在你所有重要功能的所有文档字符串中都遵循这一约定。 我们可以通过使用函数的 __doc__(注意其中的双下划綫)属性(属于函数的名称)来获取函数的文档字符串属性。只消记住 Python 将所有东西都视为一个对象,这其中自然包括函数。我们将在后面的类(Class)章节讨论有关对象的更多细节。 diff --git a/books/aByteOfPython/modules.md b/books/aByteOfPython/5_modules.md similarity index 100% rename from books/aByteOfPython/modules.md rename to books/aByteOfPython/5_modules.md diff --git a/books/aByteOfPython/dataStructure.md b/books/aByteOfPython/6_dataStructure.md similarity index 81% rename from books/aByteOfPython/dataStructure.md rename to books/aByteOfPython/6_dataStructure.md index 68c1f11..d608c50 100644 --- a/books/aByteOfPython/dataStructure.md +++ b/books/aByteOfPython/6_dataStructure.md @@ -1,6 +1,10 @@ +# data structure + ## 列表 List, Mutable(可变数据类型) + 方法: 这个类定义仅对于它启用某个函数。 字段:它是只为该类定义且只为该类所用的变量。 + ```python shoplist = ['apple', 'mango', 'carrot', 'banana'] # 使用索引(index, [])运算符 @@ -8,7 +12,9 @@ shoplist = ['apple', 'mango', 'carrot', 'banana'] ``` ## 元组 Tuple, unMutable + 元组通常用于保证某一语句或某一用户定义的函数可以安全地采用一组数值,意即元组内的数值不会改变。 + ```python a = ('1', '2', '3') # 使用索引(index, [])运算符 @@ -17,7 +23,9 @@ b = ('4',) ``` ## 字典 Dictionary + 将键值(keys) 与 值(values) 联立到一起的结构。键值必须是唯一的,并且只能是不可变对象。 + ```python ab = { 'Swaroop': 'swaroop@swaroopch.com', @@ -26,22 +34,28 @@ ab = { 'Spammer': 'spammer@hotmail.com' } # 使用索引运算符 -ab['Larry'] +ab['Larry'] ``` + ## 序列 -列表、元组、字典都属于序列。序列的主要功能是**资格测试**(membership test,即 in 与 not in 表达式),和索引操作。序列还支持**切片**(slicing)运算符 + +列表、元组、字典都属于序列。序列的主要特征是**资格测试**(membership test,即 in 与 not in 表达式),和索引,以及**切片**(slicing)运算符 + ```python # 切片操作可以指定初始位置、结束位置、步长(缺省时为1) a[::2] ``` ## 集合 Set + 集合(Set)是简单对象的无序集合(Collection)。当集合中的项目存在与否比起次序或其出现次数更加重要时,我们就会使用集合。 可以验证一个集合是否为另一集合的子集,用于求两个集合的交集、并集等 + ```python bri = set(['brazil', 'russia', 'india']) ``` ## 引用 -对于序列对象制作副本时,必须使用切片操作,否则生成的只是原对象的引用,即变量名只是指向你计算机内存中存储了相应对象的那一部分。这叫作将名称绑定(Binding)给那一个对象。 +变量名并不代表对象,它只是指向你计算机内存中存储了相应对象的那一部分,这叫作将名称绑定(Binding)给那一个对象。 +对于序列对象制作副本时,必须使用切片操作,否则生成的只是原对象的引用。 diff --git a/books/aByteOfPython/problem.py b/books/aByteOfPython/7_problem.py similarity index 100% rename from books/aByteOfPython/problem.py rename to books/aByteOfPython/7_problem.py diff --git a/books/aByteOfPython/objectOrient.md b/books/aByteOfPython/8_objectOrient.md similarity index 100% rename from books/aByteOfPython/objectOrient.md rename to books/aByteOfPython/8_objectOrient.md diff --git a/books/aByteOfPython/inputAndOutput.md b/books/aByteOfPython/9_inputAndOutput.md similarity index 100% rename from books/aByteOfPython/inputAndOutput.md rename to books/aByteOfPython/9_inputAndOutput.md diff --git a/books/aByteOfPython/tackleProblem.md b/books/aByteOfPython/tackleProblem.md index 618d46c..e43885d 100644 --- a/books/aByteOfPython/tackleProblem.md +++ b/books/aByteOfPython/tackleProblem.md @@ -7,5 +7,3 @@ os.sep 有助于程序的跨平台移植,os.sep根据系统平台返回路径 4. Test/测试(测试与修复错误)错误修复(Bug Fixing) 5. Use/使用(操作或开发)操作或部署阶段(Operation、Deployment) 6. Maintain/维护(改进)维护阶段(maintenance) - - diff --git a/books/readnotes.md b/books/books.md similarity index 91% rename from books/readnotes.md rename to books/books.md index 73a3a0a..e7e685e 100644 --- a/books/readnotes.md +++ b/books/books.md @@ -1,11 +1,19 @@ ## c++ + [豆列推荐](https://www.douban.com/doulist/48208/) 在数值计算(或者任何其他工程领域)里,知道一个东西的基本算法和写出一个能在实际中工作得很好的程序之间还是有一段不小的距离的。有很多可能看似无关紧要的小细节小 trick,可能会对结果带来很大的不同。当然这样的现象其实也很合理:因为理论上的工作之所以漂亮正是因为抓住了事物的主要矛盾,忽略“无关”的细节进行了简化和抽象,从而对比较“干净”的对象进行操作,在一系列的“assumption”下建立起理论体系。但是当要将理论应用到实践中的时候,又得将这些之前被忽略掉了的细节全部加回去,得到一团乱糟糟,在一系列的“assumption”都不再严格满足的条件下找出会出现哪些问题并通过一些所谓的“engineering trick”来让原来的理论能“大致地”继续有效,这些东西大概就主要是 Engineer 们所需要处理的事情了吧?这样说来 Engineer 其实也相当不容易。这样的话其实 Engineer 和 Scientist 的界线就又模糊了,就是工作在不同的抽象程度下的区别的样子。 > http://freemind.pluskid.org/machine-learning/softmax-vs-softmax-loss-numerical-stability/ -- 线性代数 +## 线性代数 + 首先说说空间(space),这个概念是现代数学的命根子之一,从拓扑空间开始,一步步往上加定义,可以形成很多空间。线形空间其实还是比较初级的,如果在里面定义了范数,就成了赋范线性空间。赋范线性空间满足完备性,就成了巴那赫空间;赋范线性空间中定义角度,就有了内积空间,内积空间再满足完备性,就得到希尔伯特空间。 有兴趣的读者可以去看看齐民友教授写的**《重温微积分》**。我就是读了这本书开头的部分,才明白“高等数学是研究运动的数学”这句话的道理。 而仿射变换的矩阵表示根本就是4 x 4的。又扯远了,有兴趣的读者可以去看**《计算机图形学——几何工具算法详解》**。 -> http://www.guokr.com/post/300903/ \ No newline at end of file +> http://www.guokr.com/post/300903/ + +[Linear Algebra and Learning from Data](http://www-math.mit.edu/~gs/) + +## python + +[cookbook](https://python3-cookbook.readthedocs.io/zh_CN/latest/) \ No newline at end of file diff --git a/books/deepLearning/2_linearAlgebra.md b/books/deepLearning/2_linearAlgebra.md index 9499b70..814a2e8 100644 --- a/books/deepLearning/2_linearAlgebra.md +++ b/books/deepLearning/2_linearAlgebra.md @@ -31,6 +31,7 @@ tensor:表示维度大于2的矩阵 其中, $U$ 是左奇异向量, $V$ 是右奇异向量, $D$ 除了对角线元素都是0。 ## 特征分解与奇异分解的关系 + > $$A=UDV^T \rightarrow \begin{cases} & A^TA=VD^TDV^T \\ & AA^T=UDD^TU^T \end{cases}$$ diff --git a/books/deepLearning/3_proAndInfTheory.md b/books/deepLearning/3_proAndInfTheory.md index 5bd0ca2..f74489b 100644 --- a/books/deepLearning/3_proAndInfTheory.md +++ b/books/deepLearning/3_proAndInfTheory.md @@ -1,12 +1,13 @@ -probability and information theory ----- +# probability and information theory + 放空 练功 痴迷 不好 + ## books recormendation + jaynes(2003) cover and thomas(2006) mackay(2003) - # probability theory ## tips - expectation 期望 diff --git a/books/deepLearning/4_numericalComputation.md b/books/deepLearning/4_numericalComputation.md index 48cf1b4..69da35c 100644 --- a/books/deepLearning/4_numericalComputation.md +++ b/books/deepLearning/4_numericalComputation.md @@ -1,7 +1,7 @@ -numerical computation ------ +# numerical computation ## 上溢、下溢 + 下溢指将一个非常接近0的数看做0; 上溢指一个非常大的数超出了有限精度表示的范围,被看做了一个$\infty$ 符号 对于softmax,解决方法如下式,这样会保证分母有1,从而不会下溢;并且分子最大值为1,会保证不会上溢;但分子仍会下溢。 @@ -17,6 +17,7 @@ softmax 它的大小表征了矩阵输入变化与输出变化量的大小关系。 ## 基于梯度的优化 + 输入是向量、输出是标量的函数的梯度,是偏导数组成的向量,记作: > $$\nabla x f(x)$$ @@ -25,7 +26,8 @@ softmax > $$x'=x-\epsilon * \nabla x f(x)$$ -## 梯度之上:jacobian and hessian matrix +## 梯度之上: jacobian and hessian matrix + 输入是向量、输出是向量的函数的导数,是**jacobian**矩阵 > $$J_{i,j}=\frac{\partial}{\partial x_j}f(x)_i$$ @@ -45,5 +47,6 @@ lipschitz continuity(利普希茨连续条件) 其中,$L$称为lipschitz constant(利普希茨常数),它的意义在于保证了,当给输入加了一个较小的扰动后,输出的变化量也较小。 ## 约束优化问题 + 拉格朗日对偶,KKT条件 凸优化一般针对矩阵为正定、半正定时才会有作用 diff --git a/books/deepLearning/5_machineLearningBasis.md b/books/deepLearning/5_machineLearningBasis.md index b655929..b911ebe 100644 --- a/books/deepLearning/5_machineLearningBasis.md +++ b/books/deepLearning/5_machineLearningBasis.md @@ -1,29 +1,48 @@ # machine learning basis -## words +``` + We then proceed to describe how the challenge of fitting the training data differs from the challenge of finding patterns that generalize to new data. +``` -population 总体 +两个统计学的中心方法:频率估计,贝叶斯推断。 -## books +## 5.1 an example: linear regression -murphy(2012) -bishop(2006) +监督与无监督并没有明显的区别,datasets与experience也没有明显的区别。 -## an example +描述训练集的一种方式是design matrix 设计矩阵,其中每行表示一个样本,每列表示一种属性。但是当不同样本的属性个数不一致时,就不能再使用design matrix的方式来描述,而是set。 -design matrix 设计矩阵(训练集的矩阵表示) MSE(mean squared error,均方差、均方误差) + 对向量的二次方求导时,应该先将二次方分解成多项式的形式再求导。 -normal equations(正规方程):优化方程的确切解 -## capacity +normal equations(正规方程):优化方程的确切解 +本书全文使用"linear"来描述affine functions(实际只有过原点才算linear transformation) + +## 5.2 capacity + 机器学习与优化算法的区别在于机器学习不仅希望降低训练误差,还希望降低泛化误差(测试误差),而优化算法仅仅是以降低训练误差为目的。 + - 机器学习的前提假设 - 训练样本与测试样本都是独立同分布的,内在的分布称为**数据生成分布** + +训练样本与测试样本都是独立同分布的,内在的分布称为**数据生成分布** + +决定一个机器学习算法好坏的标准有两个: + +1. 模型在训练集上的误差大小,过大意味着underfitting +2. 模型的训练误差与测试误差之间的间隔(gap),gap过大意味着overfitting + +capacity, hypothesis space +通过添加输入特征也可以改变capacity。 + - 模型复杂度 representational capacity(表示容量) - effective capacity(有效容量,优化算法能够为模型真实提供的容量,一般少于模型的表示容量) - VC维:一种模型容量的量化方法 + effective capacity(有效容量,优化算法能够为模型真实提供的容量,一般少于模型的表示容量 + +> **奥卡姆剃刀**: 选择符合要求的模型中复杂度最低的。 + +> **VC维**: 是一种模型容量的量化方法,它主要表示二分类模型的容量,度量的是能够最多对多少个x维度的数据进行任意的二分类。。 + - 由预先知道的真实分布$p(x,y)$(理想条件下)预测而出现的误差称为贝叶斯误差 这个误差可以是由训练集的噪声等诸多因素引起的,是理想模型条件下的最小误差 - the no free lunch theorem @@ -33,17 +52,17 @@ normal equations(正规方程):优化方程的确切解 定义:任何以减小泛化误差而不是训练误差为目的在学习算法上的修改,统称为规则化 权重衰减(L1、L2)表示了对模型的某部分假设空间的偏好,这样也修改了模型容量 -## hyperparameters and validation sets +## 5.3 hyperparameters and validation sets - hyperparameters 一般不适合通过在训练集上学习得到,因为像表征模型容量的超参数一定会是越大越好,然而这样会造成过拟合 - validation set 测试集是为了评估一个模型的泛化误差,当然不能用于选模型或者模型的超参数,因此测试集中的样本不能出现在验证集中(测试集是由与训练集同样分布的样本组成) 训练集通常分成两个子集(80%、20%),一个用于模型参数的训练,仍称为训练集;另一个用于训练后评估模型的泛化误差,同时用于选择超参数,称为验证集;在验证集选完超参数后,再由测试集评定泛化误差 -- k折交叉验证 +- k折交叉验证 将训练集分为k个子集,使用k-1个子集训练,1个子集测试,对所有这种划分的测试集误差做平均,作为泛化误差 -# estimator, bias, variance +## 5.4 estimator, bias, variance 基本的参数估计、偏差和方差的概念有利于正式的刻画泛化、欠拟合和过拟合的概念 - point estimator(点估计) @@ -116,7 +135,7 @@ normal equations(正规方程):优化方程的确切解 \end{aligned}$$ [证明](https://en.wikipedia.org/wiki/Mean_squared_error) -# MLE +## 5.5 MLE ## 似然函数 @@ -142,7 +161,7 @@ normal equations(正规方程):优化方程的确切解 > $$D_{KL}(\hat p_{data}||p_{model})=\mathbb{E}_{x\sim \hat p_{data}}[log\hat p_{data}-\log p_{model}]$$ (2) 1和2式是等价的。 -# 贝叶斯统计 +## 5.6 贝叶斯统计 ## 贝叶斯估计(全贝叶斯推断) 贝叶斯估计与极大似然估计(点估计)有两点主要不同 1. 极大似然估计中预测只使用了一个参数值$\theta$,贝叶斯估计是依据概率分布做期望预测的 @@ -160,7 +179,7 @@ m应该就是样本的数目,因为在其它机器学习算法中,$w$一般 > $$w^Tx+b=b+\sum_{i=1}^{m}\alpha_i x^Tx^{(i)}=b+\sum_{i}\alpha_ik(x,x^{(i)})$$ 3. k-nearest neighbor -## unsupervised learning algorithm +## 5.8 unsupervised learning algorithm 无监督学习与监督学习并没有一个明显的区分界限,因为监督学习意思是存在一个目标量,但是这个目标量也可以看做是一个特征或样本属性。 simpler representation @@ -168,7 +187,7 @@ simpler representation 2. sparse representations 3. independent representations -## stochastic gradiant descent +## 5.9 stochastic gradiant descent 代价函数中的代价值是基于所有样本的,SGD使用 minibatch 的例子来计算代价函数的梯度,相当于以样本代替总体。 ## 维数灾难 @@ -182,4 +201,15 @@ simpler representation 流形指连接在一起的区域。是一种使用低维数据表达高维度数据的方法 支持流形学习有效的证据是: 1. 数据的概率分布是高度集中的 -2. 数据总可以变换到其他同类数据(其邻域) \ No newline at end of file +2. 数据总可以变换到其他同类数据(其邻域) + + + +## words + +population 总体 + +## books + +murphy(2012) +bishop(2006) \ No newline at end of file diff --git a/books/deepLearning/6_deepFeedforwardNetworks.md b/books/deepLearning/6_deepFeedforwardNetworks.md index 0d19e06..884f588 100644 --- a/books/deepLearning/6_deepFeedforwardNetworks.md +++ b/books/deepLearning/6_deepFeedforwardNetworks.md @@ -1,15 +1,18 @@ # deep feedforward networks + 深度前馈网络、前馈神经网络、多层感知机是同一个概念,都是指只有前向传播的网络;当前馈网络被扩展为包含反馈连接时,称为循环神经网络。 一种理解前馈神经网络的方式是从线性模型开始,可以看做是使用核技巧的线性模型: > $$y=f(x; \theta, w) = \phi(x; \theta)^Tw$$ 其中,$\phi(x;\theta)$定义了一个隐藏层,$w$用与将 $\phi(x)$ 映射到 $y$ ## word + implicitly 含蓄的 ## books + - ReLU -jarrett et al. 2009 +jarrett et al. 2009 nair and hinton 2010 glorot et al 2011a diff --git a/books/deepLearning/7_reguarization.md b/books/deepLearning/7_reguarization.md index d02f9cc..1de5038 100644 --- a/books/deepLearning/7_reguarization.md +++ b/books/deepLearning/7_reguarization.md @@ -85,11 +85,11 @@ orthognonal mathing pursuit , OMP-k 测试 ## 12. Dropout -can be thought of as a method making bagging practical for ensembles of very many large neural networks. -输入层神经元被选中的概率设为0.8,隐藏层神经元被选中的概率设为0.5 + can be thought of as a method making bagging practical for ensembles of very many large neural networks. + dropout与bagging的不同之处: - bagging中所有模型是相互独立的,而dropout中各模型是参数共享的 -- bagging各模型是独立训练并且在某一数据集上收敛的模型,而dropout并没有为每一模型进行显而易见地 单独训练 +- bagging各模型是独立训练并且在某一数据集上收敛的模型,而dropout并没有为每一模型进行显而易见地单独训练 geometric mean 、arithmetic mean weight scaling inference rule,训练好dropout模型后,使用一次网络前向传播来得到output,这个网络包括所有神经元,它的每一个神经元输出要和它的dropout概率相乘来作为该神经元的输出。经验效果比较好,但没有理论说明。它需要模型中不存在非线性特性。 @@ -101,7 +101,14 @@ dropout的advatange: dropout的disadvantage: - 作为一项规则化技术,会降低模型的有效容量,然后对于数据集很充分的任务,dropout并不能有效减少泛化误差 -dropout 也可以看做是一个共性隐藏层神经元的模型的集合 +dropout 也可以看做是一个共性隐藏层神经元的模型的集合 + +前向传播时,采用weight scaling inference rule,即权重乘以该神经元被使用的概率作为Inference时的权重。目前还没有理论可以解释,但实验效果良好。 +文中的解释: +> the goal is to make sure that the expected total input to a unit at test time is roughly the same as the expected total input to that unit at train time + + +典型的超参数如输入层神经元被选中的概率设为0.8,隐藏层神经元被选中的概率设为0.5 ## 13. adversarial(排斥的) training (难例学习) (adversarial nets 对抗神经网络) excessive linearity diff --git a/books/esl/2_overviewOfSupervisedLeraning.md b/books/esl/2_overviewOfSupervisedLeraning.md index 8ab963b..3afae5a 100644 --- a/books/esl/2_overviewOfSupervisedLeraning.md +++ b/books/esl/2_overviewOfSupervisedLeraning.md @@ -1,42 +1,61 @@ # overview of supervised learning + [标量对矩阵的求导,绝对值得细看](https://zhuanlan.zhihu.com/p/24709748) ## 数据类型 + - quantitative variable 连续型变量 - qualitative variable 质变量、类别变量 - ordered categorical 如小、中、大 - dummy variable 哑变量,是量化了的质变量,即one-hot编码的形式就是 + ## 两个估计方法 + 最小二乘法对于结构有较强的假设,但是结果稳定; k-近邻法对于结构有较弱的假设,但是预测结果不稳定。 -### 最小二乘法(least squares) + +### 最小二乘法(least squares) + 目标函数,residual sum of squares,其中$y_i$是标量,$x_i$是列向量,$\beta$是线性模型参数,列向量: > $$RSS(\beta)=\sum_{i=1}^N (y_i-x_i^T \beta)$$ 目标函数的向量化表示,其中$\bold{y}$是列向量,$\bold{X}$是矩阵: > $$\begin{aligned} RSS(\beta) &= \|\bold{y}-\bold{X}\beta \|_2 \\ &= (\bold{y}-\bold{X}\beta)^T(\bold{y}-\bold{X}\beta)\end{aligned}$$ -``` + +```md 若标量函数f是矩阵X经加减乘法、行列式、逆、逐元素函数等运算构成,则使用相应的运算法则对f求微分,再使用迹技巧给df套上迹并将其它项交换至dX左侧,即能得到导数。 ``` + 为求$RSS(\beta)$对$\beta$的导数,先求方程的微分 + > $$\begin{aligned} d RSS(\beta) &= d [(\bold{y}-\bold{X}\beta)^T(\bold{y}-\bold{X}\beta)] \\ &= d[(\bold{y}-\bold{X}\beta)^T] (\bold{y}-\bold{X}\beta) + (\bold{y}-\bold{X}\beta)^T d[(\bold{y}-\bold{X}\beta)] \\ &= [d(\bold{y}-\bold{X}\beta)]^T (\bold{y}-\bold{X}\beta) + (\bold{y}-\bold{X}\beta)^T (-\bold{X}d\beta) \\ &= [(-\bold{X}d\beta)]^T (\bold{y}-\bold{X}\beta) + (\bold{y}-\bold{X}\beta)^T (-\bold{X}d\beta) \\ -&= tr[[(-\bold{X}d\beta)]^T (\bold{y}-\bold{X}\beta) + (\bold{y}-\bold{X}\beta)^T (-\bold{X}d\beta)] \qquad \text{对常数加迹,值不变} \\ +&= tr[[(-\bold{X}d\beta)]^T (\bold{y}-\bold{X}\beta) + (\bold{y}-\bold{X}\beta)^T (-\bold{X}d\beta)] \qquad \text{对常数加迹,值不变} \\ &= tr[(\bold{y}-\bold{X}\beta)^T (-\bold{X}d\beta)] + tr[(\bold{y}-\bold{X}\beta)^T (-\bold{X}d\beta)] \qquad \text{根据迹的运算法则} \\ -&= 2(\bold{y}-\bold{X}\beta)^T (-\bold{X}d\beta) \\ +&= 2(\bold{y}-\bold{X}\beta)^T (-\bold{X}d\beta) \\ &= 2(\bold{X}\beta - \bold{y})^T (\bold{X}d\beta) \end{aligned}$$ + 根据微分方程与导数的关系,可得: > $$\frac{\partial{RSS(\beta)}}{\partial \beta} = 2\bold{X}^T(\bold{X}\beta-\bold{y})$$ 为求最优解,令$\frac{\partial{RSS(\beta)}}{\partial \beta} = 0$,如果$\bold{X}^T\bold{X}$非奇异,那么$\beta$有解析解 > $$\hat \beta = (\bold{X}^T\bold{X})^{-1}\bold{X}^T\bold{y}$$ +这里的最小二乘法求解的是向量$\beta$,而仿射变换中求解的是变换矩阵 + ### nearest-neighbor methods + > $$\hat Y(x) = \frac{1}{k} \sum_{x_i \in N_k(x)} y_i$$ + ## statistical decision theory + ## local methods in high dimensions -## statistical models, + +## statistical models + ## structured regression model + ## classes of restricted estimators + ## model selection diff --git a/books/essenceOfLinearAlgebra.md b/books/essenceOfLinearAlgebra.md deleted file mode 100644 index eaf43f4..0000000 --- a/books/essenceOfLinearAlgebra.md +++ /dev/null @@ -1,6 +0,0 @@ -[3blue1brown](https://www.youtube.com/watch?v=kYB8IZa5AuE) ------- -1. -2. -3. linear transformations - 要把矩阵都看作一个线性变换 \ No newline at end of file diff --git a/books/math/esseceOfLinearAlgebra.md b/books/linearAlgebra/esseceOfLinearAlgebra.md similarity index 100% rename from books/math/esseceOfLinearAlgebra.md rename to books/linearAlgebra/esseceOfLinearAlgebra.md diff --git a/linux/linuxPrograming.md b/books/linuxProgram/readme.md similarity index 98% rename from linux/linuxPrograming.md rename to books/linuxProgram/readme.md index 35e3734..3110b09 100644 --- a/linux/linuxPrograming.md +++ b/books/linuxProgram/readme.md @@ -1,13 +1,16 @@ -[linux-turtorial for befinners](http://www.ee.surrey.ac.uk/Teaching/Unix/index.html) -[ubuntu wiki](http://wiki.ubuntu.org.cn/%E9%A6%96%E9%A1%B5) -[the linux programing interface](http://www.man7.org/tlpi/index.html) -[linux usb](http://www.linux-usb.org/) -[linux man-pages](https://www.kernel.org/doc/man-pages/) -[linux kernel api](https://www.kernel.org/doc/htmldocs/kernel-api/) +# linux program + +[linux-turtorial for befinners](http://www.ee.surrey.ac.uk/Teaching/Unix/index.html) +[ubuntu wiki](http://wiki.ubuntu.org.cn/%E9%A6%96%E9%A1%B5) +[the linux programing interface](http://www.man7.org/tlpi/index.html) +[linux usb](http://www.linux-usb.org/) +[linux man-pages](https://www.kernel.org/doc/man-pages/) +[linux kernel api](https://www.kernel.org/doc/htmldocs/kernel-api/) [gnu c library](http://www.gnu.org/software/libc/manual/html_node/) ## LINUX程序设计 第三版(neil...) -``` + +```c linux使用技巧 ctrl+d 关闭终端 ctrl+c 结束进程 @@ -24,6 +27,7 @@ alt+tab切换不同应用的窗口 长按super键(windows下的win键),显示快捷键 ``` + ctrl+c和ctrl+z都是中断命令,但是他们的作用却不一样.ctrl+c是强制中断程序的执行,而ctrl+z的是将任务中断,但是此任务并没有结束,他仍然在进程中他只是维持挂起的状态,用户可以使用fg/bg操作继续前台或后台的任务,fg命令重新启动前台被中断的任务,bg命令把被中断的任务放在后台执行.例如:当你vi一个文件是,如果需要用shell执行别的操作,但是你又不打算关闭vi,因为你得存盘推出,你可以简单的按下ctrl+z,shell会将vi进程挂起~,当你结束了那个shell操作之后,你可以用fg命令继续vi你的文件 删除内核命令 ubuntu tweak,或者sudo apt-get remove linux-image @@ -64,7 +68,9 @@ LINUX程序运行时,自动在PATH搜索路径下搜索(目录名以冒号 文件和目录的维护 chmod//改变文件和目录的访问权限 chown//改变文件属主 + ### 第四章 Linux环境 + - cd - - getopt(); putopt(); - set:命令,列出所有的环境变量 diff --git a/books/machineVision/3_templateMatching.md b/books/machineVision/3_templateMatching.md new file mode 100644 index 0000000..a97b2e1 --- /dev/null +++ b/books/machineVision/3_templateMatching.md @@ -0,0 +1,9 @@ +# algorithm + +## 13 template matching + +边缘匹配中的几种策略: + +1. 原始的边缘点,或加上其它一些描述信息 +2. 将边缘分割为多个几何基元,然后匹配边缘 +3. 基于边缘分割,匹配边缘上的突变点 \ No newline at end of file diff --git a/books/math/math.md b/books/math/math.md deleted file mode 100644 index bda9e8e..0000000 --- a/books/math/math.md +++ /dev/null @@ -1,30 +0,0 @@ - -## 点积(又称为数量积,接受两个向量返回一个标量值;在欧几里得空间称为内积) -> $$\vec{a}\cdot \vec{b}=|\vec{a}|*|\vec{b}|*cos(\theta)$$ -$\vec{a}$在$\vec{b}$上的投影长度为: -> $$\vec{a} \cdot \frac{\vec{b}}{|\vec{b}|}=|\vec{a}|*cos(\theta)$$ - - - -## 仿射变换(affine) -由三个点确定的变换,即六个参数确定的变换 -[马同学对仿射变换的解释](https://www.zhihu.com/search?type=content&q=%E4%BB%BF%E5%B0%84%E5%8F%98%E6%8D%A2) -仿射变换 = 线性变换(旋转和拉伸) + 平移, 对应的数学公式为 -> $$\vec{y}=A\cdot\vec{x}+\vec{b}$$ (1) -- **线性变换 $\vec{y}=A\cdot \vec{x}$ 只有矩阵乘法** -线性变化有如下3条属性: - 1. 直线经过变换后依旧是直线 - 2. 并且比例不变 - 3. 原点不变 - -- 平移不是线性变换而是仿射变换 -- 可以通过增加一个维度来使仿射变换表示线性变换(线性变换只有乘法没有加法) -> $$\begin{bmatrix}\vec{y} \\ 1\end{bmatrix}= \begin{bmatrix} A &\vec{b} \\ 0 & 1\end{bmatrix} \cdot \begin{bmatrix} \vec{x} \\ 1 \end{bmatrix}$$ (2) - -## 线性函数 -> $$y=x^Tw+b$$ (3) -数学中,线性函数指线性的函数(经过原点),但也常用做一次函数的别称,尽管一次函数不一定是线性的(即$b\rlap{\,/}{=}0$时) - -## 透视变换(projective) -相机模型就是一个透视变换,是由四个点变换确定的变换,即八参数变换 -从一个透视点 \ No newline at end of file diff --git a/books/neural_networks_and_deep_learning/improving_the_way_neural_networks_learin_three.md b/books/neuralNetworksAndDeepLearning/3_improving_the_way_neural_networks_learin_three.md similarity index 95% rename from books/neural_networks_and_deep_learning/improving_the_way_neural_networks_learin_three.md rename to books/neuralNetworksAndDeepLearning/3_improving_the_way_neural_networks_learin_three.md index 04deac9..9de1cc2 100644 --- a/books/neural_networks_and_deep_learning/improving_the_way_neural_networks_learin_three.md +++ b/books/neuralNetworksAndDeepLearning/3_improving_the_way_neural_networks_learin_three.md @@ -9,7 +9,7 @@ The philosophy is that the best entree to the plethora of available techniques i ### 2. introducing the cross-entropy cost function 为了解决学习速度慢的问题,替换二范数代价函数为交叉熵(cross-entropy)代价函数。 - 一个神经元的代价函数,x是样本 -$$C=-\frac{1}{n}\sum _{x}[y*ln(a)+(1-y)*ln(1-a)$$(57) +> $$C=-\frac{1}{n}\sum _{x}[y*ln(a)+(1-y)*ln(1-a)$$(57) - 多个神经元的代价函数 ![math67](../image/math63.png) - 对于回归问题,采用代价函数形式,binary entropy?? @@ -55,10 +55,11 @@ overfitting or overtraining 规则化项并没有包括偏置系数b,因为一个比较大的偏置,可以让我们更容易改变网络的行为。 **other techniques for regualrization** - L1 regularization -$$C=C_0+\frac{\lambda}{n}\sum_w |w|$$ (95) -- dropout +> $$C=C_0+\frac{\lambda}{n}\sum_w |w|$$ (95) +- dropout 思想是更改网络结构。在每轮训练开始前,随机地临时删除一半的隐藏层神经元,再进行前向传播、反向梯度传递,训练结束后,把所有隐藏层神经元的权重都降低一半,然后使用所有隐藏层神经元预测。 -- artificiallly expanding the training data,如对数字进行旋转,就得到了新的数据 +- artificiallly expanding the training data + 如对数字进行旋转,就得到了新的数据 ### 7. weight initialization 前面用到的权重、偏置初始化是用的均值为0,标准差为1的独立高斯分布随机数。 改变权重、偏置的初始化,可以让神经网络的最初结果较好,也就加速了训练过程。当前,对最后的正确率影响不打,但在第四章会讲到,对最后结果的改善。 diff --git a/books/neural_networks_and_deep_learning/a_visual_proof_that_neural_nets_can_compute_any_function_four.md b/books/neuralNetworksAndDeepLearning/a_visual_proof_that_neural_nets_can_compute_any_function_four.md similarity index 100% rename from books/neural_networks_and_deep_learning/a_visual_proof_that_neural_nets_can_compute_any_function_four.md rename to books/neuralNetworksAndDeepLearning/a_visual_proof_that_neural_nets_can_compute_any_function_four.md diff --git a/books/neural_networks_and_deep_learning/code/number_recognize.py b/books/neuralNetworksAndDeepLearning/code/number_recognize.py similarity index 100% rename from books/neural_networks_and_deep_learning/code/number_recognize.py rename to books/neuralNetworksAndDeepLearning/code/number_recognize.py diff --git a/books/neural_networks_and_deep_learning/deep_learning_six.md b/books/neuralNetworksAndDeepLearning/deep_learning_six.md similarity index 100% rename from books/neural_networks_and_deep_learning/deep_learning_six.md rename to books/neuralNetworksAndDeepLearning/deep_learning_six.md diff --git a/books/neural_networks_and_deep_learning/how_the_backpropagation_algorithm_works_two.md b/books/neuralNetworksAndDeepLearning/how_the_backpropagation_algorithm_works_two.md similarity index 100% rename from books/neural_networks_and_deep_learning/how_the_backpropagation_algorithm_works_two.md rename to books/neuralNetworksAndDeepLearning/how_the_backpropagation_algorithm_works_two.md diff --git a/books/neural_networks_and_deep_learning/neural_network_and_deep_learning_preface.md b/books/neuralNetworksAndDeepLearning/neural_network_and_deep_learning_preface.md similarity index 100% rename from books/neural_networks_and_deep_learning/neural_network_and_deep_learning_preface.md rename to books/neuralNetworksAndDeepLearning/neural_network_and_deep_learning_preface.md diff --git a/books/neural_networks_and_deep_learning/neural_networks_and_deep_learning_one.md b/books/neuralNetworksAndDeepLearning/neural_networks_and_deep_learning_one.md similarity index 100% rename from books/neural_networks_and_deep_learning/neural_networks_and_deep_learning_one.md rename to books/neuralNetworksAndDeepLearning/neural_networks_and_deep_learning_one.md diff --git a/books/neural_networks_and_deep_learning/why_are_deep_neural_networks_hard_to_train_five.md b/books/neuralNetworksAndDeepLearning/why_are_deep_neural_networks_hard_to_train_five.md similarity index 100% rename from books/neural_networks_and_deep_learning/why_are_deep_neural_networks_hard_to_train_five.md rename to books/neuralNetworksAndDeepLearning/why_are_deep_neural_networks_hard_to_train_five.md diff --git a/books/primer/10_algorithm.md b/books/primerc++/10_algorithm.md similarity index 100% rename from books/primer/10_algorithm.md rename to books/primerc++/10_algorithm.md diff --git a/books/primer/12_memory.md b/books/primerc++/12_memory.md similarity index 100% rename from books/primer/12_memory.md rename to books/primerc++/12_memory.md diff --git a/books/primer/2_variable.md b/books/primerc++/2_variable.md similarity index 100% rename from books/primer/2_variable.md rename to books/primerc++/2_variable.md diff --git a/books/primer/6_function.md b/books/primerc++/6_function.md similarity index 100% rename from books/primer/6_function.md rename to books/primerc++/6_function.md diff --git a/books/primer/7_class.md b/books/primerc++/7_class.md similarity index 100% rename from books/primer/7_class.md rename to books/primerc++/7_class.md diff --git a/books/primer/9_cantainer.md b/books/primerc++/9_cantainer.md similarity index 100% rename from books/primer/9_cantainer.md rename to books/primerc++/9_cantainer.md diff --git a/books/prml/12_continuouslatentvariable.md b/books/prml/12_continuouslatentvariable.md index 9296bb9..87276ef 100644 --- a/books/prml/12_continuouslatentvariable.md +++ b/books/prml/12_continuouslatentvariable.md @@ -13,13 +13,12 @@ fisher linear discriminant利用了label信息,而PCA是无监督学习。 数据预处理 - 标准化 > $$y_i=\frac{x_i-\bar x}{\sigma(x)}$$(1) -其中,这里将$x$看做标量,$\bar x$是$x$变量的均值,$\sigma(x)$是$x$变量的标准差。 -标准化后,$x$的均值为$0$,方差为$1$ -- 白化(whitening) +其中,这里将$x$看做标量,$\bar x$是$x$变量的均值,$\sigma(x)$是$x$变量的标准差。标准化后,$x$的均值为$0$,方差为$1$ +- 白化(whitening),PCA白化,相当于在PCA中融入标准化。 > $$S=\frac{1}{N}\sum_{n=1}^N (x_n-\bar x)(x_n-\bar x)^T$$ 上式是协方差矩阵$S$的求解,假设$x$是$D$维向量,则$S$是$D\times D$的矩阵 > $$SU=UL$$ -其中,$S$是协方差矩阵,$U$是正交矩阵,由$S$的特征向量组成,$L$是对角矩阵,是$S$的特征值构成的矩阵 +其中,$S$是协方差矩阵,$U$是正交矩阵,由$S$的特征向量组成,$L$是对角矩阵,是$S$的特征值构成的矩阵。这里$S$是方阵所以写成了特征值分解的形式而不是奇异值分解(SVD)。 > $$y_n = L^{-1/2}U^T(x_n-\bar x)$$(2) $(2)$式就是白化的处理的变换矩阵,首先和$(1)$式相同的部分,可以看出它是$0$均值、$1$方差的,其次正交矩阵$U$使变换后$y$的协方差矩阵为单位矩阵,即各元素只与自身有关,与其它元素的协方差为$0$。证明如下: > $$\begin{aligned} \frac{1}{N} \sum_{n=1}^N y_ny_n^T &= \frac{1}{N} \sum_{n=1}^N L^{-1/2}U^T(x_n-\bar x) (x_n-\bar x)^T U^T L^{-1/2} \\ diff --git a/books/prml/9_mixtureModelsEM.md b/books/prml/9_mixtureModelsEM.md index b1c2045..f940427 100644 --- a/books/prml/9_mixtureModelsEM.md +++ b/books/prml/9_mixtureModelsEM.md @@ -12,12 +12,15 @@ K-means的求解就是用到了EM算法的迭代思想,由于K-means需要同 K-medoids算法是对K-means算法通用化,K-means一般使用距离度量函数(欧氏距离)来对样本聚类,而K-medoids是通用的不相似度$\mathcal V(x_n,\mu_k)$函数,它同时可以对样本内的类别数据进行计算,而聚类中心通常可以选择那一类的其中一个样本,而不再是计算出来的均值。 -## mixtures of guassian +## mixtures of guassian + [笔记 ref from](https://book.douban.com/annotation/28457881/) ``` 作者在26页中提到用极大似然法确定分布中的未知参数可以理解为给定参数后使样本的概率最大化。而更自然的想法是给定样本后使参数的概率最大化,即使用贝叶斯方法得到参数的后验分布,再使其最大化。 ``` + ### 使用极大似然估计求解混合高斯分布的问题 + 1. 奇异问题? 在只有一个高斯分量时,若均值等于一个样本点$x_j$,虽然随着方差趋于$0$,似然函数中与$x_j$的项趋于无穷大;但是对于其它不等于均值的样本点,它们在似然函数中的项会趋向于$0$,因为随着方差趋于$0$,高斯分布的指数项会趋于$0$,而不严格的说,指数衰减是比$\frac{1}{\sqrt{2\pi\sigma^2}}$增长的快的,也就是在两个趋于无穷的综合作用下,这些点的概率会趋于$0$。而似然函数是所有样本点概率的乘积,所以似然函数会趋于$0$而不是无穷大。 但是一旦模型中存在两个高斯分量时,其中一个高斯分量方差正常,产生的概率分布也正常;而另一个高斯分量由于均值与一个样本点$x_j$重合,导致$x_j$趋于无穷大的概率,两个高斯分量相加后,概率依然趋于无穷大;而其它样本点,一个高斯分量概率分布正常,另一个高斯分量会趋于$0$,那么在两个高斯分量相加后,这样的样本点是正常值的,不会趋于$0$。那么,最后的混合分布的似然函数是所有样本点概率的乘积,会趋向于无穷大,这对于极大似然估计中求极大值来说是病态的? @@ -25,6 +28,7 @@ K-medoids算法是对K-means算法通用化,K-means一般使用距离度量函 会有$k!$个相同的解,那么也就不能直接求导,求极值? ### 使用最大期望估计混合高斯分布 + EM是求解带有隐变量模型的极大似然解的有效算法。 协方差矩阵$\Sigma$是半正定和对称矩阵,所以$\Sigma^T=\Sigma$,$\Sigma^{-1}$? EM往往需要更多迭代次数,所以可以使用K-means来求解EM算法的初始值,来开始迭代过程。 diff --git a/books/pythonCookbook/7_function.md b/books/pythonCookbook/7_function.md new file mode 100644 index 0000000..098e84d --- /dev/null +++ b/books/pythonCookbook/7_function.md @@ -0,0 +1,5 @@ +# function + +```yaml +None # 要用 is 来测试,不能用 not, 因为空的str也是False,而不是None +``` \ No newline at end of file diff --git a/books/pythonCookbook/9_meta.md b/books/pythonCookbook/9_meta.md new file mode 100644 index 0000000..f1a60b9 --- /dev/null +++ b/books/pythonCookbook/9_meta.md @@ -0,0 +1,2 @@ +# 元编程 + diff --git a/books/pythonCookbook/readme.md b/books/pythonCookbook/readme.md new file mode 100644 index 0000000..7a5a569 --- /dev/null +++ b/books/pythonCookbook/readme.md @@ -0,0 +1 @@ +[python3-cookbook](http://python3-cookbook.readthedocs.io/zh_CN/latest/index.html) diff --git a/books/pythontutorial.md/4_dict.md b/books/pythontutorial.md/4_dict.md index f681ea2..be4c43a 100644 --- a/books/pythontutorial.md/4_dict.md +++ b/books/pythontutorial.md/4_dict.md @@ -1,11 +1,15 @@ # 字典 -列表通过序号对值进行引用,映射通过名字来引用值。字典是python中唯一的內建映射类型。键(key)可以是数字、字符串、元组。 + +列表通过序号对值进行引用,映射通过名字来引用值。字典是python中唯一的內建映射类型。键(key)可以是数字、字符串、元组等不可变类型。 ## 使用 + 是为了方便通过查找某个特定的词语(键)来找到它的定义(值)。 ## 创建 + 键是任意的不可变类型,键是唯一的。 + ```python clear() copy() # 浅复制,deepcopy()深复制 diff --git a/books/pythontutorial.md/5_func.md b/books/pythontutorial.md/5_func.md index fdad5e8..74fbb5b 100644 --- a/books/pythontutorial.md/5_func.md +++ b/books/pythontutorial.md/5_func.md @@ -1,16 +1,20 @@ # 条件、循环、其它语句 + - 表达式,就是某件事情 - 语句,做某件事情,是指令 ## print、import + print在python3中是函数,不再是语句 ## 赋值魔法 + - 序列解包(递归解包) - 链式赋值 - 增量赋值 ### 条件语句 + '=='判断是否相等,'is'判断是否等同(同一个对象),两者不同 布尔运算符:and、or、not 可以利用布尔运算符的短路逻辑来实现c语言中的三元运算符 diff --git a/books/statistical_learning_method/1_introduction.md b/books/statisticalLearningMethod/1_introduction.md similarity index 64% rename from books/statistical_learning_method/1_introduction.md rename to books/statisticalLearningMethod/1_introduction.md index f4488a1..0b954e6 100644 --- a/books/statistical_learning_method/1_introduction.md +++ b/books/statisticalLearningMethod/1_introduction.md @@ -10,4 +10,15 @@ ## 生成模型&判别模型 - 生成模型:是由训练集的联合概率分布计算得到的条件概率分布。生成方法可以还原出联合概率分布。 $$P(y|x)=\frac{P(x,y)}{P(x)}$$ -- 判别模型:决策函数是直接学习得到的。 \ No newline at end of file +- 判别模型:决策函数是直接学习得到的。 + +## tips +针对二分类问题 +准确率 accuracy +> $$A=\frac{TP+TN}{TP+TN+FP+FN}$$ +精确率 precision +> $$P=\frac{TP}{TP+FP}$$ +召回率 recall +> $$R=\frac{TP}{TP+FN}$$ +F1 +> $$\frac{2}{F1}=\frac{1}{R}+\frac{1}{P} \Rightarrow F1=\frac{2RP}{R+P}$$ \ No newline at end of file diff --git a/books/statisticalLearningMethod/2_perceptron.md b/books/statisticalLearningMethod/2_perceptron.md new file mode 100644 index 0000000..538cba0 --- /dev/null +++ b/books/statisticalLearningMethod/2_perceptron.md @@ -0,0 +1,20 @@ +仅对线性可分数据有效 +## 模型 +模型是一个超平面,w是超平面法向量,b是超平面的截距 +> $$w\cdot x+b=0$$ +分类函数 +> $$f(x)=sign(w\cdot x+b)$$ +$sign(x)$是符号函数,定义式如下: +> $$sign(x)=\begin{cases} 1 + &\text{if }x\geqslant 0 + \\-1 &\text{if }x<0 \end{cases}$$ +## 策略 +所有**误分类点**到超平面的函数距离之和 +> $$L(w,b)=-\frac{1}{||w||}\sum_{x_i\in M}y_i(w\cdot x_i+b)$$ +## 算法 +- 感知机学习算法的原始形式 +- 感知机学习算法的对偶形式 + +两种形式使用的学习算法都是梯度下降法,只是看待问题的方式不同。 + +Gram Matrix(格拉姆矩阵)是内积空间中的一族向量的内积组成的对称矩阵,矩阵元素是$G_{ij}=(v_j^T \cdot v_i)$。格拉姆矩阵的行列式的不等于0意味着这族向量线性无关。 diff --git a/books/statistical_learning_method/3_kNearestNeighbor.md b/books/statisticalLearningMethod/3_kNearestNeighbor.md similarity index 61% rename from books/statistical_learning_method/3_kNearestNeighbor.md rename to books/statisticalLearningMethod/3_kNearestNeighbor.md index 8875a39..35fc53d 100644 --- a/books/statistical_learning_method/3_kNearestNeighbor.md +++ b/books/statisticalLearningMethod/3_kNearestNeighbor.md @@ -5,4 +5,5 @@ 损失函数 ## 算法 -kd树是二叉树,能够加快近邻的搜索。 \ No newline at end of file +1. 线性扫描法 +2. kd树是二叉树,能够加快近邻的搜索。 \ No newline at end of file diff --git a/books/statistical_learning_method/4_naiveBayes.md b/books/statisticalLearningMethod/4_naiveBayes.md similarity index 100% rename from books/statistical_learning_method/4_naiveBayes.md rename to books/statisticalLearningMethod/4_naiveBayes.md diff --git a/books/statisticalLearningMethod/5_decistionTree.md b/books/statisticalLearningMethod/5_decistionTree.md new file mode 100644 index 0000000..cbb30d7 --- /dev/null +++ b/books/statisticalLearningMethod/5_decistionTree.md @@ -0,0 +1,38 @@ +# 决策树 + +## 先验概率、后验概率 +先验分布与后验分布的区分点在于是否引入或者使用了新的信息(某个事实),即使用了新信息的为后验概率,没有使用新信息的为先验概率 + +## 熵 +> $$H(X)=-\sum_{i=1}^{n}p_i*log(p_i)$$ (1) +其中,对数以2或e为底,单位分别为比特、纳特。 +条件熵,定义为X给定条件下Y的条件概率分布的熵对X的数学期望 +> $$H(Y|X)=\sum_{i=1}^{n}p_i H(Y|X=x_i)$$ +其中,$p_i=p(X=x_i)$ + +## 信息增益 +特征A对训练数据集D的信息增益: +> $$g(D,A)=H(D)-H(D|A)$$ (2) +其中,$H(D)$,$H(D|A)$中的概率由数据估计(极大似然估计)得到,分别称为经验熵,经验条件熵。(依据提供的条件,数据的混乱程度减小,熵减小) +当$H(D)$、$H(D|A)$为熵、条件熵时,(2)式的值称为互信息(mutual information)。 +## 信息增益比 +使用信息增益作为划分训练数据集的特征时,会趋向于选择特征数较多的特征,信息增益比可以解决这个问题。 +特征A对训练数据集D的信息增益比: +> $$g_{_R}(D,A)=\frac{g(D,A)}{H_{_A}(D)}$$ +> $$H_{_A}(D)=\sum_{i=1}^{n}\frac{|D_i|}{|D|} \log(\frac{|D_i|}{|D|})$$ + +## 决策树生成算法 +ID3算法 只有树的生成,应用信息增益准则选择特征,(ID3相当于用极大似然估计法进行概率模型的选择) +C4.5算法 应用信息增益比准则选择特征。 + +## 决策树的剪枝 +损失函数极小化等价于正则化的极大似然估计。 + +## CART 分类与回归树 +包括特征选择、决策树生成、决策树剪枝。用于分类与回归的树统称为决策树。 +CART假设决策树是二叉树。 +- 对回归树用平方误差最小化准则,最小二乘回归树 +- 对分类树用基尼指数最小化准则。 +使用基尼指数选择最优特征,同时决定最优二值切分点。 +> $$Gini(p)=\sum_{k=1}^{K}p_k*(1-p_k)$$ +- CART剪枝 \ No newline at end of file diff --git a/books/statistical_learning_method/6_logistic.md b/books/statisticalLearningMethod/6_logistic.md similarity index 87% rename from books/statistical_learning_method/6_logistic.md rename to books/statisticalLearningMethod/6_logistic.md index 29c8196..50f162d 100644 --- a/books/statistical_learning_method/6_logistic.md +++ b/books/statisticalLearningMethod/6_logistic.md @@ -16,19 +16,22 @@ $logit$变换是一一映射的变换,且存在其反变换,反变化也就 ## 策略 这里使用最大似然估计来估计二项逻辑斯谛回归的参数$\theta$。 最大似然估计是建立在各样本间相互独立且样本满足随机抽样(可代表总体分布)下的估计方法。 -**核心思想是如果现有样本可以代表总体,那么最大似然估计就是找到一组参数使出现现有样本的可能性最大,也就是使所有观测样本的联合概率最大,由于样本相互独立,所以观测样本的联合概率可以写成各样本出现概率的连乘积。**因为单个样本不可能有$0,1$两个标签,所以化简为下式等号的右侧 +**核心思想是如果现有样本可以代表总体,那么最大似然估计就是找到一组参数使出现现有样本的可能性最大,也就是使所有观测样本的联合概率最大,由于样本相互独立,所以观测样本的联合概率可以写成各样本出现概率的连乘积**。因为单个样本不可能有$0,1$两个标签,所以化简为下式等号的右侧 > $$\prod^m_{i=1}\underbrace{P(y^{(i)}=1|x^{(i)})}_{where \, i\in m \, and \, y^{(i)}=1} \cdot \underbrace{P(y^{(i)}=0|x^{(i)})}_{where \, i\in m \, and \, y^{(i)}=0}=\prod^m_{i=1} P(y^{(i)}=1|x^{(i)})^{y(i)} \cdot P(y^{(i)}=0|x^{(i)})^{1-y(i)}$$ 通常,上式称为似然函数$\ell(\theta)$。(它的形式和概率相同,这里称为似然,是因为它在这里的使用场景,是在已知观测结果时,用于求解,使联合概率最大化时的模型参数$\theta$,[看wiki似然函数](https://zh.wikipedia.org/wiki/%E4%BC%BC%E7%84%B6%E5%87%BD%E6%95%B0)) 然而上面的似然函数形式是非凸的,可以使用对数函数使其转换为凸函数(局部最小即全局最小的函数),也就得到对数似然函数。 -对于线性回归,如果误差项满足正态分布,那么最小二乘估计的均方误差损失可以由最大似然估计推导出来。 +对于线性回归,如果误差项满足均值为0、方差为一定值的正态分布,那么最小二乘估计的均方误差损失可以由最大似然估计推导出来。[deepleaning book 133页] ## 算法 -模拟退火、单纯形算法、梯度下降算法。 +模拟退火、单纯形算法、梯度下降算法、牛顿法。 +- 梯度下降法迭代公式 +> $$w_i = w - \lambda\frac{\partial L(w)}{\partial w}=$$ +- 牛顿法 # 最大熵模型 -[Maxent theme page](https://homepages.inf.ed.ac.uk/lzhang10/maxent.html) +[Maxen= =t theme page](https://homepages.inf.ed.ac.uk/lzhang10/maxent.html) 主要用于NLP 熵是混乱度的表示,不要把鸡蛋放在一个篮子里就是最大熵原理。----吴军<数学之美> 思想是,满足约束条件,且没有更多信息的情况下,那些不确定的部分都是"等可能的"。最大熵原理通过熵的最大化来表示等可能度,"熵"是一个可优化的数值指标。 diff --git a/books/statisticalLearningMethod/7_supportVectorMachine.md b/books/statisticalLearningMethod/7_supportVectorMachine.md new file mode 100644 index 0000000..88900ef --- /dev/null +++ b/books/statisticalLearningMethod/7_supportVectorMachine.md @@ -0,0 +1,24 @@ +# SVM 支持向量机 +## 线性可分支持向量机 +- 目标函数:硬间隔最大化 + +定义分类超平面$(w,b)$关于样本点$(x_i,y_i)$的函数间隔为 +> $$\hat{\gamma}_i=y_i(w^Tx_i+b)$$ +定义分类超平面$(w,b)$关于数据集$T$的函数间隔为超平面关于$T$内所有样本点的函数间隔的最小值 +> $$\hat{\gamma}=\min_{i=1,2,...,N} \hat\gamma_i$$ +几何间隔 +> $$\gamma_i=y_i(\frac{w_i^T}{\|w\|}x_i+\frac{b}{\|w\|})$$ +## 线性支持向量机(线性不可分支持向量机) +- 目标函数:软间隔最大化 + +相当于使用使用合页损失函数(hinge函数) +> $$[z]_+=\begin{cases}z \quad \text{if} \space z>0 \\ 0 \quad \text{if} \space z\leqslant 0\end{cases}$$ +## 非线性支持向量机 +核方法是比支持向量机更为一般的机器学习方法。 +- 目标函数:使用核技巧,软间隔最大化 + +## 序列最小最优化算法 +SMO,一种快速学习算法 + +## tips +硬间隔和软间隔都是指的几何间隔,"软"指的是约束条件加入了松弛变量。 \ No newline at end of file diff --git a/books/statisticalLearningMethod/8_boosting.md b/books/statisticalLearningMethod/8_boosting.md new file mode 100644 index 0000000..5d25453 --- /dev/null +++ b/books/statisticalLearningMethod/8_boosting.md @@ -0,0 +1,62 @@ +# 提升方法 boosting +[wiki adaboost](https://zh.wikipedia.org/zh-cn/AdaBoost) +[wiki one perfect explain](http://www.inf.fu-berlin.de/inst/ag-ki/adaboost4.pdf) +方法:改变训练样本的权重,训练多个分类器;将多个分类器线性组合,提高分类的性能。 + +对于提升方法有两个关键点: +1. 每一轮如何改变训练样本的权重或概率分布? +2. 如何将弱分类器组合成强分类器? + +## 介绍 +kearns和valiant提出了强可学习(strongly learnable)和弱可学习(weakly learnable)的概念。在概率近似正确(probably approximately correct, PAC)学习框架下,两者是等价的。 + +adaboost就是一种将弱学习算法提升为强学习算法的一种具体的方法。 + +## 1. adaboost (adaptive boosting) +adaptive:自适应的,是指算法能适应弱分类器各自的训练误差率?。 +算法 +1. 样本权重初始化为均匀分布 +2. 训练基本分类器,形式可以是用$sign$符号函数 +> $$G_m(x): \mathcal{X} \rightarrow \{-1,+1\}$$ +3. 计算**基本分类器**的误差率,($I(x)$指示函数)。**为什么要带上$w_{mi}$?** +> $$e_m=\sum_{i=1}^{N} w_{mi} \cdot I(G_m(x_{i})!=y_i)$$ +4. 计算基本分类器的系数(在最终分类器中的比重) +> $$a_m=\frac{1}{2}\log(\frac{1-e_m}{e_m})$$ +5. 更新样本权重,返回第2步。其中,$Z_m$为规范化因子。 +> $$w_{m+1,i}=\frac{w_{m,i}}{Z_m}\exp(-\alpha_m \cdot y_i\cdot G_m(x_i))$$ +6. 基本分类器的线性组合作为最终的分类器 +> $$f(x)=\sum_{m=1}^{M}\alpha_m G_m(x)$$ + +## 3. adaboost算法解释,一种二类分类学习方法 +- 模型:加法模型。其中,$\gamma_m$为基函数$b(x)$的参数。 +> $$f(x)=\sum_{m=1}^M \beta_m b(x;\gamma_m)$$ + +- 损失函数:指数损失函数 +> $$L(y,f(x))=\exp(-y f(x))$$(2) + +- 算法:前向分步算法 +算法步骤: +1. 初始化分类器$f_0(x)=0$ +2. 极小化损失函数 +> $$(\beta_m,\gamma_m)=arg \min_{\beta,\gamma}\sum_{i=1}^{N}L(y_i, f_{m-1}(x_i)+\beta \cdot b(x;\gamma)) $$(3) +3. 更新分类器,返回第2步 +> $$f_m(x)=f_{m-1}(x)+\beta_m \cdot b(x;\gamma_m)$$ +4. 得到最终分类器 +> $$f(X)=f_M(x)=\sum_{m=0}^{M}\beta_m b(x;\gamma_m)$$ + +由2,3式推导样本权重更新系数 +> $$\begin{aligned} & arg\min_{\beta,\gamma}\sum_{i=1}^{N}\exp(-y_i \cdot [(f_{m-1}(x_i)+\beta\cdot b(x_i;\gamma))])\\ +&= arg\min_{\beta,\gamma} \sum_{i=1}^{N}w_{m,i}\exp(-y_i\beta \cdot b(x_i,\gamma))\end{aligned}$$ + +## 提升树 +以决策树为基函数的提升方法称为提升树,决策树可以是分类树或回归树。adaboost可以看做是以决策树桩为基函数的提升树。 +分类树一般使用指数损失函数 +回归树一般使用平方误差损失函数,回归树的求解目的主要在于拟合数据在当前模型中的残差(residual)。 + +## 梯度提升? +当使用其它一般损失函数时,使用梯度提升求解。 +> 残差很难求解?所以使用梯度来近似参数? + + +## tips +损失函数极小化就是经验风险极小化,而规则项则是结构风险极小化 \ No newline at end of file diff --git a/books/statistical_learning_method/9_expectationMaximum.md b/books/statisticalLearningMethod/9_expectationMaximum.md similarity index 100% rename from books/statistical_learning_method/9_expectationMaximum.md rename to books/statisticalLearningMethod/9_expectationMaximum.md diff --git a/books/statistical_learning_method/2_perceptron.md b/books/statistical_learning_method/2_perceptron.md deleted file mode 100644 index ba67dc1..0000000 --- a/books/statistical_learning_method/2_perceptron.md +++ /dev/null @@ -1,16 +0,0 @@ -仅对线性可分数据有效 -## 模型 -模型是一个超平面,w是超平面法向量,b是超平面的截距 -$$w\cdot x+b=0$$ -分类函数 -$$f(x)=sign(w\cdot x+b)$$ -$sign(x)$是符号函数,定义式如下: -$$sign(x)=\begin{cases} -1 &\text{if }x\geqslant0 \\ --1 &\text{if }x<0 -\end{cases}$$ -## 策略 -所有误分类点到超平面的函数距离之和 -$$L(w,b)=-\frac{1}{||w||}\sum_{x_i\in M}y_i(w\cdot x_i+b)$$ -## 算法 -梯度下降 diff --git a/books/statistical_learning_method/5_decistionTree.md b/books/statistical_learning_method/5_decistionTree.md deleted file mode 100644 index 113d3eb..0000000 --- a/books/statistical_learning_method/5_decistionTree.md +++ /dev/null @@ -1,18 +0,0 @@ -## 先验概率、后验概率 -先验分布与后验分布的区分点在于是否引入或者使用了新的信息(某个事实),即使用了新信息的为后验概率,没有使用新信息的为先验概率 - -## 熵 -$$H(X)=-\sum_{i=1}^{n}p_i*log(p_i)$$ (1) -其中,对数以2或e为底,单位分别为比特、纳特。 -## 信息增益 -特征A对训练数据集D的信息增益: -$$g(D,A)=H(D)-H(D|A)$$ (2) -其中,$H(D)$,$H(D|A)$中的概率由数据估计(极大似然估计)得到,分别称为经验熵,经验条件熵。(依据提供的条件,数据的混乱程度减小,熵减小) -当$H(D)$,$H(D|A)$为熵,条件熵时(2)式的值称为互信息(mutual information)。 -## 信息增益比 -使用信息增益作为划分训练数据集的特征时,会趋向于选择特征数较多的特征,信息增益比可以解决这个问题。 -特征A对训练数据集D的信息增益比: -$$g_{_R}(D,A)=\frac{g(D,A)}{H_{_A}(D)}$$ -$$H_{_A}(D)=$$ -## 基尼指数 -$$Gini(p)=\sum_{k=1}^{K}p_k*(1-p_k)$$ \ No newline at end of file diff --git a/books/ufldl/3_preprocessing_pca_whitening.md b/books/ufldl/3_preprocessing_pca_whitening.md index 28d163e..4c262ed 100644 --- a/books/ufldl/3_preprocessing_pca_whitening.md +++ b/books/ufldl/3_preprocessing_pca_whitening.md @@ -1,15 +1,18 @@ -## preview +# preview + +[python example](https://blog.csdn.net/weiwei9363/article/details/79437279) + - 范数(norm) - 满足1.非负性,2.齐次性,3.三角不等式 + 满足 1.非负性,2.齐次性,3.三角不等式 p-范数是常用空间范数,定义如下 > $$||X||_p=(\sum_{i=1}^{N}|x_i|^p)^{\frac{1}{p}}$$ - 方差 > $$s^2=\frac{1}{n}\sum_{i=1}^{n}(x_i-E(x))^2$$ - 样本方差 - 样本方差是对总体方差的无偏估计,[无偏估计](https://www.zhihu.com/question/20099757) - 里面比较本质的一个解释是,计算方差的公式中E(x)已经是从n个样本中得到的估计,所以数据的自由度已经减了一。 + 样本方差是对总体方差的无偏估计,[无偏估计](https://www.zhihu.com/question/20099757) 。 + 无偏估计的含义是说估计值的期望是完全正确的。 + 里面比较本质的一个解释是,计算方差的公式中样本均值(E(x))已经是从n个样本中得到的估计,所以数据的自由度已经减了一。 > $$s^2=\frac{1}{n-1}\sum_{i=1}^{n}(x_i-E(x))^2$$ - - 协方差 是用于衡量两个变量的总体误差,是一个衡量线性独立的无量纲的数。 方差是协方差的一种特殊情况,即两个相同变量的协方差。 @@ -20,23 +23,26 @@ > $$\Sigma=\frac{1}{m}XX^T$$ ## pca(prominantly component analysis) -统计学中称为主成分分析,图像处理中称为KL-变换 + +统计学中称为主成分分析,图像处理中称为KL-变换 通过计算协方差矩阵,确认使数据方差最大化的另一种基下的数据表达。 -先去均值,再计算协方差矩阵,对协方差矩阵做svd分解,u矩阵包含sigma的特征向量,u矩阵也就是pca的变换矩阵。 +先去均值,再计算协方差矩阵,对协方差矩阵做svd分解,u矩阵包含$\Sigma$的特征向量,u矩阵也就是pca的变换矩阵,s是奇异值矩阵。 > $$[u,s,v] = svd(\Sigma)$$ > $$x^{rot}=u^{'}x$$ 这里去均值讲得是每幅图像单独减去自己的均值,这与减去整个训练数据集的均值有什么区别?? ## whitening -- pca白化 + +- pca白化 + 其中,$\lambda$是旋转后数据协方差矩阵的特征值,就是svd分解得到的s矩阵的对角线元素,这是因为$\Sigma$是对称半正定矩阵。在这里起到归一化方差的作用,是每个特征具有单位方差。 其中i是第几个特征,而不是第几个样本数据。 > $$X_{PCAwhite,i}=\frac{X_{i}^{rot}}{\sqrt{\lambda_{i}}}$$ -正则化的pca白化 -eilson是一个很小的数,防止$\lambda$过小,导致数值不稳定。 +正则化的pca白化,epilson是一个很小的数,防止$\lambda$过小,导致数值不稳定。 > $$X_{PCAwhite,i}=\frac{X_{i}^{rot}}{\sqrt{\lambda_{i} + epilson}}$$ -- zca白化(使协方差矩阵为单位矩阵) +- zca白化(使协方差矩阵为单位矩阵) + 白化的定义式如下,u即为上面的svd分解得到的 -> $$X_{ZCAwhite}=u*X_{PCAwhite}$$ +> $$X_{ZCAwhite}=u*X_{PCAwhite}$$ diff --git a/books/watermelon/3_linearModel.md b/books/watermelon/3_linearModel.md index 2206cfe..0c062f1 100644 --- a/books/watermelon/3_linearModel.md +++ b/books/watermelon/3_linearModel.md @@ -1,9 +1,11 @@ # 线性模型 ## 线性回归 + 均方误差也叫作平方损失(square loss),它的几何意义是欧几里得距离,简称为欧氏距离。 使用均方误差最小化来求解模型的方法称为最小二乘法,求解过程称为最小二乘"参数估计" 最小二乘"参数估计"中,$X^TX$往往不是满秩的,那么最小二乘"参数估计"的解就不唯一,根据学习算法的归纳偏好,引入正则项来选择唯一解。 + - 对数线性回归 > $$\ln y=w^Tx+b$$ - 广义线性回归 @@ -11,6 +13,7 @@ 其中,$g(\cdot)$是单调可微函数。 ## 对数几率回归 + 对数几率函数 > $$y=\frac{1}{1+e^{-z}}$$ 对数几率函数是一种"Sigmoid"函数,"Sigmoid"函数是形似S的函数。 @@ -20,3 +23,13 @@ > $$g(y)=\ln\frac{y}{1-y}$$ 其中,$\frac{y}{1-y}$称为几率。$g(y)$称为对数几率。 梯度下降法、牛顿法求最优解。 + +## LDA(linear discriminant analysis)线性判别分析 + +核心思想是将训练集数据点映射到一条直线上,使得同类样例的投影点尽可能相近,异类样例点尽可能相远。测试时,将测试样例同样投影到直线上,再根据投影点的位置来确定新样本的类别。 +类内散度矩阵(within-class scatter matrix)、类间散度矩阵(between-class scatter matrix) +目标函数:最大化广义瑞利商 + +## tips + +最小二乘法名称的由来,least square(直译过来的) \ No newline at end of file diff --git a/books/watermelon/4_decisionTree.md b/books/watermelon/4_decisionTree.md new file mode 100644 index 0000000..d24f958 --- /dev/null +++ b/books/watermelon/4_decisionTree.md @@ -0,0 +1,19 @@ +# 决策树 +ID3算法: iterative dichotomiser(二分) +- 信息熵 +- 信息增益(Gain) +一个属性就有一个信息增益。 + +C4.5 +- 增益率(gain ratio) +增益率准则趋向于选择可取值数目较少的属性,因此C4.5采用了一种启发式,先从候选划分属性中找出信息增益高于平均水平的属性,再从中选择增益率最高的。 + +基尼指数 +CART是指分类和回归任务都可以采用的一种算法。 + +## 剪枝处理 +- 预剪枝 +使用验证集评估划分前后决策树的性能,只有性能(精度)提高时,才进行划分。是基于"贪心算法"的本质,然而有欠拟合的风险。 + +- 后剪枝 +基于奥卡姆剃刀原理,模型越简单越好,即对于剪枝前、剪枝后,模型在验证集精度指标不变的情况下,要做剪枝。 diff --git a/books/weixiushen/0.md b/books/weixiushen/0.md new file mode 100644 index 0000000..4639143 --- /dev/null +++ b/books/weixiushen/0.md @@ -0,0 +1,2 @@ +机器学习是学习的是模型,模型的输入是由人工选择的特征。而表示学习是将特征与模型一起学习。深度学习是表示学习的一个代表,有模型学习、特征学习、特征抽象,等模块,深度学习包括深度置信网络、递归神经网络RNN、CNN。 +训练数据集、计算力、训练方法的完善。 \ No newline at end of file diff --git a/books/weixiushen/4_compression.md b/books/weixiushen/4_compression.md new file mode 100644 index 0000000..26bee01 --- /dev/null +++ b/books/weixiushen/4_compression.md @@ -0,0 +1,6 @@ +# 模型压缩(体积和时间上的压缩) +过参数化(over parameterization)-模型内部存在大量的参数冗余。 Danil的研究表明$5%$的参数就可以完整地重构出剩余的参数。这种冗余对基于梯度下降的模型优化算法是必须的。 + +按照压缩过程对网络结构的破坏程度,模型压缩技术分为 +1. 前端压缩:不改变原网络结构的压缩方法,如知识蒸馏、紧凑模型设计、滤波器层面剪枝。 +2. 后端压缩:低秩近似、未加限制的剪枝、参数量化、二值网络。 \ No newline at end of file diff --git a/essay/alexnet.md b/essay/classification/alexnet.md similarity index 75% rename from essay/alexnet.md rename to essay/classification/alexnet.md index b334a7c..563f4dd 100644 --- a/essay/alexnet.md +++ b/essay/classification/alexnet.md @@ -1,13 +1,17 @@ -# imageNet classification with deep convolutional neural networks +# imageNet classification with deep convolutional neural networks 2012 hinton + ## tips + 输入是227还是256? ## abstract + 在ILSVRC-2010的1.2million图像上取得了top-1和top-5的错误率分别为37.5%和17.0% 。(top-1错误率指在模型的预测结果中,confidence最大的类别与label不同的数目占所有测试集图像的比例;top-5错误率指在模型的预测结果中,confidence最大的5个类别不包含label的数目占所有测试集图像的比例) 使用参数60million,神经元650,000个 5层卷积,3层全连接,最后输出1000-way softmax,为了加快训练使用了没有饱和的激活函数,并且使用GPU有效地实现了卷积操作。为了防止过拟合,使用了dropout,并且效果很好。 ## introduction + 使用机器学习的方法识别物体就需要大量的数据集,如larger datasets 有 LabelMe 图像分割, ImageNet 有15million幅图像,22000类 同时,由于物体识别具有极高的复杂度,即便有较大数据集,也不能够很清楚的描述问题,这时需要使用大量地人类先验知识来补偿数据集中缺少的例子。CNN就是其中一个很好的使用图像特性的模型(stationarity of statics and locality of pixel dependencies),并且模型容量可以通过深度、宽度控制。与similar-sized layer的标准feedforward neural network相比,CNN有更少的connections(一个connections表示神经元连接到下一层神经元)和parameters,因此也更容易训练,理论上效果只差一点。 contributions: @@ -15,27 +19,51 @@ contributions: 2块GTX 580 3GB GPUs,训练了5到6天。 ## the dataset + ImageNet包含15million高分辨率图像,大约有22,000类,这些图像是使用亚马逊的众包服务人工标注的。自2010年开始,ImageNet Large-Scale Visual Recognition Challenge作为Pascal Visual Object Challenge的一部分每年举行一届,ILSVRC使用ImageNet中的1000类图像,训练集1.2million,验证集50,000,测试集150,000幅图像进行比赛。2010年的ILSVRC中的测试集是公开的。 图像的处理方式是将原始图像的短边缩放到256,然后central crop一个$256\times 256$大小的图像作为训练集,没有其它数据增强操作。只是作了减去RGB像素均值操作。 -## the architecture -- ReLU -> $$f(x) = tanh(x)$$ (1) +## 3. the architecture + +### ReLU + +> $$f(x) = tanh(x)$$ (1) > $$f(x) = \frac{1}{1+e^{-x}}$$ (2) -1、2式都是saturating nonlinearities,在gradient descent算法中,很费时间,所以使用了ReLU $f(x)=\max(0,x)$,它是non-saturating nonlinearities的。实验中,使用相同的网络结构,达到相同的训练错误率,ReLU激活函数版网络需要的迭代次数为tanh激活函数版的1/3。激活函数在以往的论文中也有出现的更改,但是关注点不同,本篇文章的关注点是它能够加快模型的训练。 -- training on multiple gpus +1、2式都是saturating nonlinearities,在gradient descent算法中,很费时间,所以使用了ReLU $f(x)=\max(0,x)$,它是non-saturating nonlinearities的。实验中,使用相同的网络结构,达到相同的训练错误率,ReLU激活函数版网络需要的迭代次数为tanh激活函数版的1/3。 + +激活函数在以往的论文中也有出现的更改,但是关注点不同,本篇文章的关注点是它能够加快模型的训练。 + +### training on multiple gpus + +### local response normalization + +同一位置上不同通道的激活值归一化,作用在某些层的ReLU后。 + +### overall architecture -- overall architecture 目标函数:最大化multinomial logistic regression objective,多项逻辑回归,等价于最大化在当前预测分布下正确标签的log-probability -## reducing overfitting +## 4. reducing overfitting +采用了两种方法来减轻过拟合: + +1. 数据增强 +- 使用random crop,random flip。$256\times 256$ -> $224\times 224$ +- 改变图像强度,具体的先做PCA,求解RGB像素值协方差矩阵$3\times 3$,得到特征值、特征向量。然后为图像中的每一个像素,加上如下一个随机数 +> $$[p_1,p_2,p_3][\alpha_1 \lambda_1, \alpha_2 \lambda_2, \alpha_3 \lambda_3]^T$$ +其中,$p_i$和$\lambda_i$是像素$3\times 3$协方差矩阵的第$i$个特征向量和特征值。而$\alpha_i$是一个随机数,每幅图片对应一个随机数。 + +$3\times 3$协方差矩阵是如何计算的? + +2. dropout layer +加入dropout层后,模型近似增加了一倍的iteration才得以收敛。 ## details of leraning -batch size: 128 -weight decay: 0.0005 -momentum: 0.9 + +batch size: 128 +weight decay: 0.0005 +momentum: 0.9 leraning rate: 0.01,对于所有的层学习率是相同的,训练的时候手动调节学习率,当验证集的误差不再下降的时候除以10,在1.2 million数据集上训练了90轮,训练过程中学习率一共降了三次 diff --git a/essay/aognet.md b/essay/classification/aognet.md similarity index 100% rename from essay/aognet.md rename to essay/classification/aognet.md diff --git a/essay/bn.md b/essay/classification/bn.md similarity index 100% rename from essay/bn.md rename to essay/classification/bn.md diff --git a/essay/capsule.md b/essay/classification/capsule.md similarity index 53% rename from essay/capsule.md rename to essay/classification/capsule.md index 220af0b..e2092d5 100644 --- a/essay/capsule.md +++ b/essay/classification/capsule.md @@ -1,6 +1,10 @@ -# dynamic routing between capsules -[知乎解答理解](https://www.zhihu.com/question/67287444/answer/251241736) -[知乎长文科普](https://zhuanlan.zhihu.com/p/29435406) +# dynamic routing between capsules 2017.11 + +[capsule](https://github.com/gram-ai/capsule-networks) +[知乎解答理解](https://www.zhihu.com/question/67287444/answer/251241736) +[知乎长文科普](https://zhuanlan.zhihu.com/p/29435406) [t-SNE](https://colah.github.io/posts/2015-01-Visualizing-Representations/) -explaining away: 多余多因一果的问题,如果已知到一个因是否发生,那么其它因发生的概率会增加会降低。 \ No newline at end of file +explaining away: 多余多因一果的问题,如果已知到一个因是否发生,那么其它因发生的概率会增加会降低。 + +## Matrix capsules with EM routing 2018 ICLR \ No newline at end of file diff --git a/essay/classification/cbam.md b/essay/classification/cbam.md new file mode 100644 index 0000000..0812df5 --- /dev/null +++ b/essay/classification/cbam.md @@ -0,0 +1,4 @@ +# CBAM: Convolutional Block Attention Module ECCV 2018 Korea +2018-09-04 10:04 + +channel atention + spatial attention + resBlock = CBAM \ No newline at end of file diff --git a/essay/classreview.md b/essay/classification/classreview.md similarity index 100% rename from essay/classreview.md rename to essay/classification/classreview.md diff --git a/essay/convolution.md b/essay/classification/convolution.md similarity index 100% rename from essay/convolution.md rename to essay/classification/convolution.md diff --git a/essay/classification/dataDistillation.md b/essay/classification/dataDistillation.md new file mode 100644 index 0000000..932ddd4 --- /dev/null +++ b/essay/classification/dataDistillation.md @@ -0,0 +1,2 @@ +# Data Distillation: Towards Omni-Supervised Learning CVPR 2018 +使用无标签数据做训练 \ No newline at end of file diff --git a/essay/deeplearning.md b/essay/classification/deeplearning.md similarity index 100% rename from essay/deeplearning.md rename to essay/classification/deeplearning.md diff --git a/essay/classification/denseNet.md b/essay/classification/denseNet.md new file mode 100644 index 0000000..2a4d294 --- /dev/null +++ b/essay/classification/denseNet.md @@ -0,0 +1,39 @@ +# Densely Connected Convolutional Networks 2018 +## dense block +input -> Batch Norm -> ReLU -> Convolution -> channel concate + +有以下有点, +1. 避免梯度消失的问题 +2. 增强特征传播?feature propagation +3. 增强特征复用 +4. 减少了参数量。 + + +## introduction +作者从highway、resnet、stochastic depth、fractalnet中捕捉到shorcut很重要的信息,所以为了最大化信息流的流动,作者将所有大小一致的特征图都进行了连接,并且使用concat,而不是sum操作。 + +## dense net +resnet中由于identity function 和 transform function之间的特征是相加起来的,这会阻止信息流的反向传播? + +- dense block +> input -> channel concate -> Batch Norm -> ReLU -> 3x3 Convolution (属于pre-activation) + +- transition block (dense block之间的层,起降低特征图大小的作用) +> input -> Batch Norm -> 1x1 Convolution -> 2x2 average pooling + +- grouth rate +dense block内每一个卷积的输出特征图大小称为grouth rate,表示为$k$ + +- bottleneck layer +1x1卷积可以看做为bottleneck layer,这里就看的比较明白了,1x1卷积就像一个瓶口。 DenseNet-B 定义为: +> BN -> ReLU -> Conv(1x1,4k) -> BN -> ReLU -> Conv(3x3,k) + +- compression +transition layer的输出与输入通道的比值$\theta$,DenseNet-C定义为: +> $$\theta < 1$$ +DenseNet-BC +> $$\theta \lt 1 \quad\&\&\quad bottleneck \lt 1$$ + + +## 实验 +最后的图看的不明白 \ No newline at end of file diff --git a/essay/classification/distortion.md b/essay/classification/distortion.md new file mode 100644 index 0000000..57b1528 --- /dev/null +++ b/essay/classification/distortion.md @@ -0,0 +1,3 @@ +# Learning Better Features for Face Detection with Feature Fusion and Segmentation Supervision + +使用PIL以一个随机的顺序对图像contrast, brightness, color做变换(0.5~1.5),最后添加random lighting noise。 \ No newline at end of file diff --git a/essay/dropout.md b/essay/classification/dropout.md similarity index 99% rename from essay/dropout.md rename to essay/classification/dropout.md index a430f6f..2e60cd8 100644 --- a/essay/dropout.md +++ b/essay/classification/dropout.md @@ -1,2 +1,3 @@ # Dropout: A Simple Way to Prevent Neural Networks from overfitting 2014 + # 首次提出 Improving neural networks by preventing co-adaptation of feature detectors 2012 \ No newline at end of file diff --git a/essay/googleNet.md b/essay/classification/googleNet.md similarity index 99% rename from essay/googleNet.md rename to essay/classification/googleNet.md index 28e6b0d..899039d 100644 --- a/essay/googleNet.md +++ b/essay/classification/googleNet.md @@ -1,4 +1,5 @@ # going deeper with convolutions + 为什么全连接就容易发生过拟合呢?? 参数过多,模型容量过大,易致过拟合。 [知乎讲解](https://www.zhihu.com/question/27393324/answer/51075850) diff --git a/essay/inceptionv2.md b/essay/classification/inceptionv2.md similarity index 100% rename from essay/inceptionv2.md rename to essay/classification/inceptionv2.md diff --git a/essay/inceptionv4.md b/essay/classification/inceptionv4.md similarity index 100% rename from essay/inceptionv4.md rename to essay/classification/inceptionv4.md diff --git a/essay/classification/largeMiniBatch.md b/essay/classification/largeMiniBatch.md new file mode 100644 index 0000000..a761630 --- /dev/null +++ b/essay/classification/largeMiniBatch.md @@ -0,0 +1,20 @@ +# accurate, large minibatch sgd: training imagenet in one hour hekaiming 2017 +linear scale rule:当batchsize增加k倍时,学习率也增加k倍。 + +## rule +- linear scaling rule:当batch_size增大k倍时,学习率也增大k倍,保持其它参数不变,得到的性能与$k=1$时一致,并且训练曲线一致。这个规则是基于一个假设就是梯度不变,然而在初始阶段由于模型参数变化比较大,或者当$k$非常大时(实验中是当batch_size=8k时),这个假设并不成立 + + +## main results +在ImageNet上使用256台server(batch_size=8000)训练ResNet50一个小时能够达到与小batchsize同样的精度。 + +## experiments +所有的实验不管batch_size大小都训练了90 epoch。 +> $$\eta = 0.1 \times\frac{kn}{256}$$ +在一台机器上,$k=8,n=32$。 + +大batchsize时,使用gradual warmup得到的训练结果要比no warmup或者constant warmup的效果都要好。而小batchsize时, + +## tips +- worker:一个worker就是表示一块GPU +- server: 一台机器8块GPU \ No newline at end of file diff --git a/essay/maxout.md b/essay/classification/maxout.md similarity index 100% rename from essay/maxout.md rename to essay/classification/maxout.md diff --git a/essay/nin.md b/essay/classification/nin.md similarity index 100% rename from essay/nin.md rename to essay/classification/nin.md diff --git a/essay/nonlocalnn.md b/essay/classification/nonlocalnn.md similarity index 100% rename from essay/nonlocalnn.md rename to essay/classification/nonlocalnn.md diff --git a/essay/prelu.md b/essay/classification/prelu.md similarity index 100% rename from essay/prelu.md rename to essay/classification/prelu.md diff --git a/essay/resnet.md b/essay/classification/resnet.md similarity index 64% rename from essay/resnet.md rename to essay/classification/resnet.md index fc1ffe5..bc211e2 100644 --- a/essay/resnet.md +++ b/essay/classification/resnet.md @@ -19,7 +19,7 @@ hightway network在提升网络深度时,并没有带来精度的提升 ### identity mappings by shortcuts ### network architectures - plain network -依据VGG的网络设计原则,1.当特征图的大小没有变化时滤波器的个数也不变。2.当特征图的大小减半时,滤波器的数量加倍,以保持每层网络的时间复杂度相同。 +依据VGG的网络设计原则(信息瓶颈),1.当特征图的大小没有变化时滤波器的个数也不变。2.当特征图的大小减半时,滤波器的数量加倍,以保持每层网络的时间复杂度相同。 - residual network 当channel变化时:有两种方案,(1)如果是输出维度大于输入维度,直接为多出的维度补0,而不是自身;(2)使用1x1卷积网络来增加维度。 当feature map size变化时:使用stride 2。 @@ -35,6 +35,9 @@ network flow: learning rate 调整: 当loss不变时,将learning rate 缩小为1/10、 +![resnet](../../image/essay/resnet.jpg) +其中,conv3_1,conv4_1,conv5_1的卷积stride=2。图像输入大小为$224\times 224$,经过总的步长32降采样变为$7\times 7$大小的特征图。 + ## experiment ### ImageNet classification - plain network @@ -48,4 +51,28 @@ $50k$训练图像,$10k$测试图像,网络输入图像是$32\times 32$,输 ### Object detection on pascal and coco -BasicBlock与Bottleneck内的卷积都没有使用bias参数,这是因为batch normalization的作用会使bias参数无效。 \ No newline at end of file +BasicBlock与Bottleneck内的卷积都没有使用bias参数,这是因为batch normalization的作用会使bias参数无效。 + + +# Deep Residual Learning for Image Recognition 2015 +首次提出bottleNeck + +# identity mappings in deep residual networks 2016 +与original residual units的不同体现在各层连接顺序和residual units的结构上。 + +- pre-activation: bn->relu->weight +- post-activation: weight->bn->relu + +# training and investigating residual networks 2016.02 +[blog](http://torch.ch/blog/2016/02/04/resnets.html) + +# Aggregated Residual Transformations for Deep Neural Networks 2017.04 +提出了ResNeXt,在ImageNet 2016上获得第二名。 + +## related work +group convolution首次在alexnet中提出,主要是为了解决模型在多个GPU上运行的问题,有很少工作利用group convolution来提高精度的,有一个特例是channel-wise convolution。 +ResNeXt的basicblock就用到了group convolution。 + +## tips +weight layer is aliased to conv layer + diff --git a/essay/classification/senet.md b/essay/classification/senet.md new file mode 100644 index 0000000..e5a813c --- /dev/null +++ b/essay/classification/senet.md @@ -0,0 +1 @@ +# squeeze-and-excitation networks 2018 cvpr \ No newline at end of file diff --git a/essay/squeezenet.md b/essay/classification/squeezenet.md similarity index 100% rename from essay/squeezenet.md rename to essay/classification/squeezenet.md diff --git a/essay/stn.md b/essay/classification/stn.md similarity index 77% rename from essay/stn.md rename to essay/classification/stn.md index ed4bd15..0495599 100644 --- a/essay/stn.md +++ b/essay/classification/stn.md @@ -5,17 +5,21 @@ ## introduction 变换是作用在整个特征图上的 spatial transformer可以用于 -- 图像分类 -crop out and scale normalize the appropriate region +- 图像分类: crop out and scale normalize the appropriate region - co-localization - spatial attention ## related work +- modelling transformations with neural networks +- learning and analysing transformation-invariant representations +- attention and detection mechanisms for feature selection ## spatial transformers -单个变换、每个变换单个输出,分为三部分 +每个变换单个输出,分为三部分 + ### localization network -对应Localization Net,用于学习变换矩阵的参数。几层网络后接回归层,输出变换所需的参数个数个输出 +对应Localization Net,用于学习变换矩阵的参数。几层网络后接回归层,输出变换所需的参数个数个输出,这里使用的是仿射变换,所以输出6个参数。 + ### parameterised sampling grid 对应grid generator,用于由Regular Spatial Grid生成Sampling Grid,即点的映射,具体看$(1)$式。 deepmind这里提出定义: @@ -25,9 +29,14 @@ deepmind这里提出定义: 这里将$(x_i^t,y_i^t)$和$(x_i^s,y_i^t)$归一化到$-1\sim 1$,这样变换矩阵中的旋转中心位置才对应到图像的中心点。 spatial transformer使用$\mathcal{T}_\theta$表示,那么两个grid之间像素的映射可以使用下式表示, > $$\left( \begin{matrix} x_i^s \\ y_i^s \end{matrix}\right) =\mathcal{T}_{\theta}(G_i)=\mathcal{T}_\theta \left(\begin{matrix}x_i^t \\ y_i^t \\ 1\end{matrix}\right)$$(1) -之所以写成变换矩阵乘以regular grid的形式,是因为spatial transformer变换后的特征图,是整齐排列的,这样计算它映射回原图的点的像素值可以由插值得到 +之所以写成变换矩阵乘以regular grid的形式,是因为spatial transformer变换后的特征图,是整齐排列的,这样计算它映射回原图的点的像素值可以由插值得到。 + +crop功能由仿射变换矩阵左侧 2x2 sub-matrix的行列式小于1决定?why + ### differential image sampling -插值由上一步得到的sampling grid中坐标对应的像素值,插值可以是最近邻、双线性插值等 +插值由上一步得到的sampling grid中坐标对应的像素值,插值可以是最近邻、双线性插值等。 + +每一层的采样位置是相同的,这样保证了spatial consistency between channels。 ### spatial transformer networks @@ -36,3 +45,4 @@ spatial transformer使用$\mathcal{T}_\theta$表示,那么两个grid之间像 6k训练集,5.8k测试集,只使用类别信息进行监督训练 [Spatial Transformer Networks(空间变换神经网络) blog](http://www.linjm.tech/2016/12/03/stn-note/) + diff --git a/essay/classification/summaryImageNet.md b/essay/classification/summaryImageNet.md new file mode 100644 index 0000000..899acec --- /dev/null +++ b/essay/classification/summaryImageNet.md @@ -0,0 +1,25 @@ +# ImageNet + +Model| Resolution| FLOPS MAdds | params (Million) |model size (MB) |top-1 | top-5| time| description +---|---|---|---|---|---|---|---|--|-- +AlexNet|224*224||61 +ZFNet| +VGG-16||30.69 Billion| 138 ||71.59|90.38||torchvision +VGG-19|||143 | |72.38|90.88||torchvision +GoogleNet| +ResNet18|||11||69.76|89.08||torchvision +ResNet50|||25 ||76.15|92.87||torchvision +DenseNet121|||7.9 +YOLO-V1| |8.52 Billion|||88.0| +darknet-19| 224*224|5.58 Billion||| 72.9| 91.2 + + + + +AlexNet->VGG->GoogLeNet改进点 +## 解决梯度消失的方法 +1. 参数初始化,kaiming初始化 +2. 残差结构 +3. 激活函数 + +## 解决梯度爆炸的方法,与上相同? \ No newline at end of file diff --git a/essay/classification/vgg.md b/essay/classification/vgg.md new file mode 100644 index 0000000..ae6593e --- /dev/null +++ b/essay/classification/vgg.md @@ -0,0 +1,9 @@ +# very deep convolutional networks for large-scale image recognition 2014 + +## classification network +最后的两层全连接后都接dropout(p=0.5)层,具体如下: +> $$fc \rightarrow relu \rightarrow dropout(p=0.5)$$ + +有5层maxpool2d,没有global average pooling。第一层全连接相当于卷积核为$512\times 7\times 7$的卷积。 + +但是论文中有提到global average pooling? \ No newline at end of file diff --git a/essay/zfnet.md b/essay/classification/zfnet.md similarity index 91% rename from essay/zfnet.md rename to essay/classification/zfnet.md index 4109e44..060c7fd 100644 --- a/essay/zfnet.md +++ b/essay/classification/zfnet.md @@ -1,15 +1,22 @@ # visualizing and understanding convolutinal networks(ZF-net) + +[reproduction](https://github.com/huybery/VisualizingCNN) [blog](https://xmfbit.github.io/2018/02/08/paper-visualize-convnet/#more) ## abstract + Alexnet在Imagenet上表现良好,但是,1.当前能解释它为什么会好的理论,2.如何改进它,有这样两个问题。 ## introduction + multi-layered 反卷积。 通过部分遮挡原图,分析分类器的结果受输入图像的哪部分影响。 related work ## Approach + 作者使用的网络结构,输入$224\times 224 \times 3$, cross-entropy loss function用于图像分类。 + ### visualization with a deconvnet + deconvnet被提出来用于无监督学习,而这里是将convolution的输出映射回输入。 diff --git a/essay/crystal/cascade.md b/essay/crystal/cascade.md new file mode 100644 index 0000000..5b6782b --- /dev/null +++ b/essay/crystal/cascade.md @@ -0,0 +1,7 @@ +# automatic direct detection of fasteners on the catenary support device using deep convolutional neural network 2017西南交通大学 + +作者提出了一个新的检测框架,是基于coarse-to-fine思路的,主要级联了两个检测器定位目标,再使用分类器对目标区域做是否存在损害的判断。 + +## tips + +fastener: 纽扣 \ No newline at end of file diff --git a/essay/crystal/dcnn.md b/essay/crystal/dcnn.md new file mode 100644 index 0000000..c4c72c2 --- /dev/null +++ b/essay/crystal/dcnn.md @@ -0,0 +1,3 @@ +# multi-objective performance evaluation of the detection of catenary support components using DCNN 西南交通大学 2018 + +作者从prcision, recall, average precision, mean average precision指标上分析了Faster RCNN, R-FCN, SSD, YOLOv2四个目标检测框架的性能,并最终选择了R-FCN做为解决方案。 diff --git a/essay/dataset/coco.md b/essay/dataset/coco.md new file mode 100644 index 0000000..4049c49 --- /dev/null +++ b/essay/dataset/coco.md @@ -0,0 +1,17 @@ +# microsoft coco: common objects in context 2015 + +coco包含train 80k、val 35k、minival 5k、test-std四个子集,训练时一般使用train+val,测试使用minival,线上测试使用test-std。 + +"thing" 类别表示很容易区分的个体,如人、椅子、车辆 +"stuff" 类别表示边界不清楚的物体,如草地、街道、天空 + +coco选出了91个"thing"类别,然后在2014发布的版本中只有80个类,2015的版本会增加11个类别? +> We did not collect segmentations for the +following 11 categories: hat, shoe, eyeglasses (too many +instances), mirror, window, door, street sign (ambiguous +and difficult to label), plate, desk (due to confusion with +bowl and dining table, respectively) and blender, hair +brush (too few instances). + +2017 update +从原来的80k/40k的train/val划分到现在的115k/5k的train/val划分。 \ No newline at end of file diff --git a/essay/densebox.md b/essay/densebox.md deleted file mode 100644 index c80679e..0000000 --- a/essay/densebox.md +++ /dev/null @@ -1,21 +0,0 @@ -# densebox: unifying landmark localization with end to end object detection -## abstract -使用FCN架构做目标检测,贡献有两点 -1. 使用单个FCN网络,检测多个目标 -2. 使用landmark localization 做多任务学习 - -只是单类目标检测 - -## introduction -RCNN系列在检测小目标时会很困难,因为分辨率较低且没有上下文信息。 - -## related work - -## denseBox for Detection -假设输入图像大小$m\times n$,那么输出为$\frac{m}{4}\times\frac{n}{4}$,输出的每一个位置$(x_i,y_i)$是一个$5$维向量,表示一个目标的置信度及位置,$t_i=\{s, dx^t=x_i-x_t, dy^t=y_i-y_t,dx^b=x_i+x_t,dy^b=y_i+y_t\}$,其中$s$表示是否为目标的置信度,$x_t,y_t$表示目标框的左上角点的坐标,$x_b,y_b$表示目标框的右下角点的坐标。即预测的是与当前像素位置的位移。 -### multi-task training -使用VGG19的前$12$层卷积初始化网络,其余层使用xavier初始化。 -作者使用L2 loss来作为是否为目标的损失函数,而没有使用更合理的cross-entropy loss,hinge loss,只是因为性能无差别 -> $$\mathcal{L}_{cls}(\hat y, y^*)=\|\hat y, y^*\|^2$$ -坐标回归损失也是用L2 loss - diff --git a/essay/densenet.md b/essay/densenet.md deleted file mode 100644 index 763b0a2..0000000 --- a/essay/densenet.md +++ /dev/null @@ -1,2 +0,0 @@ -## dense block -input -> Batch Norm -> ReLU -> Convolution -> channel concate \ No newline at end of file diff --git a/essay/detect/200frames.md b/essay/detect/200frames.md new file mode 100644 index 0000000..b23dad7 --- /dev/null +++ b/essay/detect/200frames.md @@ -0,0 +1,25 @@ +# Object detection at 200 Frames Per Second 2018 +作者从三个方面解决检测速度慢的问题。 +1. 网络结构 +2. 损失函数 +3. 训练数据 + +## architecture customizations +选择了一个性能中端,但速度很高的检测框架基线Tiny-Yolo[源自yolo9000?是yolo v2的简化版本]。改进如下 +1. dense feature map with stacking。 +由densenet可知,特征复用是一个很好的方法,由于特征图的尺度网络不一致,而以往的方法max pooling会造成信息损失,所以本文使用feature stacking的方法,也就是将大尺度特征图分配到多个通道的小尺度特征图上。 +当融合特征时使用了大量的bottleneck,但是从图例中只看到1x1卷积,不知何意。同时作者观察到深层的特征往往比浅层的特征更有用处,所以作者对浅层特征采用了更高的压缩比。 +2. deep but narrow +与其它state of art结构相比,本结构的深度还不足,同时为了照顾计算量,所以添加了一些1x1卷积 + +这就在tiny-yolo的基础上提高了5mAP。 + +## distillation loss for training +使用Network distillation来训练网络,也就是在正常的ground truth监督训练下,增加了使用teacher网络的预测做label来辅助训练student网络。然而由于预测时的dense sample,直接将teacher预测结果作为监督信息并不合理。 +由于teacher网络前向传播时对背景也会输出类别与位置,而这一部分其实是不需要指导student网络学习的,因为预测根本就是错的,所以作者将这部分损失都乘以了预测的objectness score。由于teacher网络会对同一个目标输出多个检测框,所以在监督student网络时需要去重复。 + +## effectiveness of data +在模型比较小的情况下,增加训练样本是否有效?增加无标签样本是否有效?训练使用distillation loss,有标签的情况下,损失包含soft label和ground truth label,无标签情况下,只有soft label损失。因为目标函数对soft label和ground truth做了很好的封装,所以训练时它允许同时输入有标签和无标签的数据。 + +## 实验 +训练了120+20+20=160 epoches \ No newline at end of file diff --git a/essay/detect/anchor.md b/essay/detect/anchor.md new file mode 100644 index 0000000..01ee129 --- /dev/null +++ b/essay/detect/anchor.md @@ -0,0 +1,4 @@ +## DeRPN: Taking a further step toward more general object detection 20181116 +anchor变种,将anchor的长和宽分别匹配,独立开来。 +## CornerNet +去anchor \ No newline at end of file diff --git a/essay/cascadercnn.md b/essay/detect/cascadercnn.md similarity index 100% rename from essay/cascadercnn.md rename to essay/detect/cascadercnn.md diff --git a/essay/detect/coordConv.md b/essay/detect/coordConv.md new file mode 100644 index 0000000..508ddc8 --- /dev/null +++ b/essay/detect/coordConv.md @@ -0,0 +1,3 @@ +# An intriguing failing of convolutional neural networksand the CoordConv solution 2018, uber + +在进行卷积之前,为特征图加入了坐标。实验采用的是Faster RCNN,数据集是自造的MINIST目标检测数据集。 \ No newline at end of file diff --git a/essay/detect/cornerNet.md b/essay/detect/cornerNet.md new file mode 100644 index 0000000..0bc966c --- /dev/null +++ b/essay/detect/cornerNet.md @@ -0,0 +1,57 @@ +# CornerNet: Detecting Objects asPaired Keypoints +DSSD中存在40k个anchor box,RetinaNet中存在100k个anchor box。 + +## 3. CornerNet +- corner heatmap +- embedding vector +- offsets + +## 3.2 detecting corners +预测了两个特征图,包括左上角与右下角 + +每一个角点,只对应一个ground-truth positive locations,所有其它位置都是negative的。而负样本中离positive location距离在一定范围内时,会减轻损失,因为虽然不准确,但依然可以得到检测目标。 + +heatmap预测采用了focal loss的变体,但是它趋向于只把一个点的值向1收敛,而所有其它值都向0收敛,虽然靠近groud-truth positive location的损失有衰减,这样正样本太少了。 + +- offset predict + +由于CNN中存在降采样(降低计算量),这样会导致定位不准确,文中引入了offset predict来对预测值做修正,但是验证其有效性的实验不是基于predict heatmap做的。 +> $$o_k=(\frac{x_k}{n}-)$$ +SmoothL1Loss +> 这种方式意味着要解码,是不是计算比较复杂,而直接采用deconvolution到原图大小会比较好 + + +## 3.3 corner groupings +使用pull-push loss,样本只有groud-truth positive locations。 +所以这里训练时,制作的样本只使用向量记录了positive locations,而没有制作Heatmap label。 + +## 3.4 corner pooling +为什么corner pooling就可以代表目标的边缘点呢? +> in such cases a corner cannot be localized based on local evidence. Instead, to determine whether there is a top-left corner at a pixel location, we need to look horizontally towards the right for the topmost boundary of the object, and look vertically towards the bottom for the left most boundary. This motivates our corner pooling layer。 + +为什么corner预测就比bounding box预测更有效呢? +> (1)目标定位框的中心难以确定,和边界框的4条边相关,但是每个顶点只与边界框的两条边相关,所以corner 更容易提取。(2)顶点更有效提供离散的边界空间,使用O(wh)个顶点可以表示O(w2h2) anchor boxes。https://www.zhihu.com/search?type=content&q=cornerNet + +fig7展示了网络结构图 + +## 4. training details +作者没有使用任何预训练模型来初始化参数,而是采用PyTorh默认的初始化方法,采用Adam优化器。 + +## 4.5 hourglass network + + + +## code +NetworkFactory(object) +NetWork(nn.Module) +DummyModule(nn.Module) +training phrase + + +## tips +1. 为什么模型输入是$511\times 511$? + +## ref +20. **PCA** Imagenet classification with deep con-volutional neural networks. +26. **pull, push loss** Pixels to graphs by associative embedding +27. Associative embedding: End-to-end learning forjoint detection and grouping. In: Advances in Neural Information Processing Sys-tems. \ No newline at end of file diff --git a/essay/deformalcnn.md b/essay/detect/deformalcnn.md similarity index 73% rename from essay/deformalcnn.md rename to essay/detect/deformalcnn.md index 8d24875..4138892 100644 --- a/essay/deformalcnn.md +++ b/essay/detect/deformalcnn.md @@ -6,21 +6,26 @@ CNN受限于它自身的固定的几何变换结构,提出以下两个结构 它们都是基于增强空间位置采样的理念,提出的模块可以嵌入到CNN中,使用反向梯度传播优化。实验表明,目标检测、语义分割任务中,在CNN中学习dense spatial transformation,是有效的。 -## introduction -对于语义分割,像FCN,所有的像素使用相同的卷积操作,显然是不合理的,因为每个像素可以对应目标的不同位置。 -对于目标检测领域,所有的方法依然使用预先设定的anchor做检测。 +## introduction +- 问题:如何适应图像中存在的几何形变,或者说如何对object scale, pose, viewpoint and part deformation建模? +- 当前的解决方法:1.数据增强。2.使用变换不变性特征,如SIFT +- 缺点:1.数据增强不能解决未知变换的问题,2.手工设计的特征很难适应复杂变化。 + +对于语义分割,像FCN,同一层的特征有相同大小的感受野,显然是不合理的,因为不同位置的特征可以对应不同大小、形变的目标。 +对于目标检测领域,所有的方法依然使用预先设定的anchor做检测,这是次优的,特别对于非刚性物体。 - deformable convolution 它是在标准2D卷积regular grid sampling locations的基础上加了2D的偏移,偏移量是通过额外的网络学习而来,额外网络的输入就是前一层的特征图。 - deformable Roi pooling -对标准的Roi pooling中的regular bin partition添加偏移量,偏移量是通过额外网络学习得到,额外网络的输入是前一层的特征图及Rois? -由spatial transform network,deformable part models启发得到 +对标准的Roi pooling中的regular bin partition添加偏移量,偏移量是通过额外网络学习得到,额外网络的输入是前一层的特征图及Rois。 + +该工作与spatial transform network,deformable part models有异曲同工之妙 ## defromable convolutional networks 各通道的变形量是相同的 - defomable convolution -偏移量回归网络的卷积核大小与主干网络当前层的卷积核大小相同,用于输出偏移位置信息的网络输出与输入特征图的大小相同,通道数为$2N$,$N$为卷积核的大小。 +偏移量回归网络的卷积核大小与主干网络当前层的卷积核大小相同,用于输出偏移位置信息的网络输出与输入特征图的大小相同,通道数为$2N$,$N$为卷积核的大小。梯度通过双线性插值传回偏移量学习的网络层。 - deformable Roi pooling -偏移量回归网络的输入是标准Roi pooling后的$k\times k$的Roi特征,特征经过fc层,输出归一化的偏移量$\Delta\hat p_{ij}$,然后使用Roi的大小再还原到图像的尺寸$\gamma \cdot \Delta \hat p_{ij}\odot (w,h)=\Delta p_{ij}$,($\odot\text{hadamard积,元素之间乘积}$),$\gamma$是预定义的设置偏移量级的参数。 +偏移量回归网络的输入是标准Roi pooling后的$k\times k$的Roi特征,特征经过fc层,输出归一化的偏移量$\Delta\hat p_{ij}$,然后使用Roi的大小再还原到图像的尺寸,具体计算公式是$\gamma \cdot \Delta \hat p_{ij}\odot (w,h)=\Delta p_{ij}$,($\odot\text{hadamard积,元素之间乘积}$),$\gamma$是预定义的设置偏移量级的参数。 - position-sensitive(PS) Roi pooling 由输入特征图先卷积生成$2\times k^2\times (c+1)$的特征图,$k^2$表示roi pooling后的大小,$c+1$表示类别数加背景,$2$表示$x,y$两个坐标上的偏移量,然后在这个特征图上执行特别层roi pooling,组合输出Roi的$\Delta\hat p_{ij}$。 - deformable convNets diff --git a/essay/detect/densebox.md b/essay/detect/densebox.md new file mode 100644 index 0000000..c12f4bc --- /dev/null +++ b/essay/detect/densebox.md @@ -0,0 +1,52 @@ +# densebox: unifying landmark localization with end to end object detection 2015 baidu +2018-08-28 11:46 + +## abstract +使用FCN架构做目标检测,贡献有两点 +1. 使用单个FCN网络,检测图像中所有尺度、位置上的目标; +2. 当为检测加入landmark localization进行多任务学习时,检测性能可以提升。 + +做了单类目标检测实验,如人脸,车辆 + +是单尺度的设计,测试时,需要multi-scale test。 + +## introduction +RCNN系列在检测小目标时会很困难,因为分辨率较低且没有上下文信息。作者主要解决一个问题,one stage的FCN网络的检测性能能够怎样? +为此提出DenseBox,尽管与YOLO、OverFeat非常相似,它偏向于解决小尺度目标、遮挡目标的检测问题。同时结合关键点预测,做Multi-task learning[1],为此,作者标注了一些KITTI的关键点数据。 + +在MALF(Multi-Attribute Labeld Faces)和KITTI上做实验。 + +## related work +在深度学习之前,检测框架分为3个独立的模块,1.特征提取,sift、hog、fisher vector;2.object models(目标模型),pictorial structure model(PSM)、DPM;3.分类器,boosting、SVM、random forests。 + +## 3. denseBox for Detection +假设输入图像大小$m\times n$,那么输出为$\frac{m}{4}\times\frac{n}{4}$,输出的每一个位置$(x_i,y_i)$是一个$5$维向量,表示一个目标的置信度及位置 +> $$t_i=\{s, dx^t=x_i-x_t, dy^t=y_i-y_t,dx^b=x_i+x_t,dy^b=y_i+y_t\}$$ +其中$s$表示该处是否为目标的置信度,$x_t,y_t$表示目标框的左上角点的坐标,$x_b,y_b$表示目标框的右下角点的坐标。即预测的是与当前像素位置的位移。 + +### 3.1 ground truth generation +按照当时图像分割时做训练集的思想来做数据,样本统一为从图像中crop出的结果,放大到$240\times 240$,人脸大小为$50$。 + +以目标为中心做crop,将目标中心位置一个半径为目标1/3区域的score设置为1,其它值为目标边框到该像素的距离。 + +### 3.2 model design +VGG-19,采用了multi-level feature fusion。 + +### 3.3 multi-task training +使用VGG19的前$12$层卷积初始化网络,其余层使用xavier初始化。 +作者使用L2 loss来作为是否为目标的损失函数,而没有使用更合理的cross-entropy loss,hinge loss,只是因为性能无差别 +> $$\mathcal{L}_{cls}(\hat y, y^*)=\|\hat y, y^*\|^2$$ +坐标回归损失也是用L2 loss + +### 3.4 refine with landmark localization +人脸有72个关键点,它的预测和face类似,直接预测该处像素是否是一类关键点,共输出72个特征图。 +refine分支网络的输入就是landmark网络的输出加上人脸score分支,损失函数依然是L2 loss,但是没有讲refine的标签是如何定义的。 + +## experiments +MALF数据集包含5000幅测试图片,没有训练集。 + +31337幅训练图像。 +multi-scale test。 + +## tips +1. Y. Bengio, A. Courville, and P. Vincent. Representation learning: A review and new perspectives. \ No newline at end of file diff --git a/essay/detectorNet.md b/essay/detect/detectorNet.md similarity index 100% rename from essay/detectorNet.md rename to essay/detect/detectorNet.md diff --git a/essay/detect/detnet.md b/essay/detect/detnet.md new file mode 100644 index 0000000..51d0f70 --- /dev/null +++ b/essay/detect/detnet.md @@ -0,0 +1,27 @@ +# DetNet: A Backbone network for Object Detection 2018.4 face++ lizeming\ pengchao\ yugang +指出当前的sota工作都是基于分类任务来做的,它们有这些共同特点,1.使用下采样来获得更大的感受野,从而获得更好的分类效果;2.使用多个辅助层输出以多尺度分类目标。然而下采样会丢失目标的位置信息。 +所以作者提出了一个能在保持图像分辨率的同时增加感受野的网络。 + +文章主要探索如何设计一个对目标检测友好的backbone网络。 + +## detnet +使用预训练的分类网络存在着三个问题 +1. 检测网络往往与分类网络的stage数目不一致。对于分类网络,输入图像一般都固定为$224\times 224$,所以它的$stage=5$,也就是输出特征图会减小$2^5=32$倍。而目标检测网络会在分类网络的后面继续接其它的stage,那么这些参数是无法得到预训练的。 +2. 对于大目标,在stage靠后的特征图上,特征定位会比较模糊,不利于定位。这是事实。 +3. 小目标需要浅层网络做检测,然而浅层特征不具有较强的语义信息,所以使用FPN结构,但是一旦深层信息丢失(确实有可能),那么小目标也就无法检测了。 +``` +这些问题都是显而易见的事情,但是过去都没有引起重视,真是视而不见。论文中将这些问题指明,并组合了三个小问题一起解决,就形成了一篇较好的文章。 +``` + +## 实验 +使用FPN做baseline,也就是two-stage目标检测。 + +实验证明detnet对大目标的检测精度提高最多,因为detnec在后续stage保持了较高的分辨率,它的特征更能清楚的分辨目标的边缘信息。 + +实验证明resnet中的bottleneck如果是skip连接,而不是1x1的projection连接,那么它产生的特征图只是输入特征图与一个它的变换的组合,这不同于stage之间的区别,而使用1x1projection连接,可以有助于产生更深语义信息的特征。但是对于目标检测,已经是输出阶段,为什么还要分stage,不应该主要解决尺度上的差别吗? + +实验证明使用完全预训练的参数初始化检测模型,即额外stage中的参数也在分类网络中得到训练,会得到更好的结果,可以提高1.2个点。 + +## tips +- stage, this is split by stride,即stride=2时结束一个stage。 + diff --git a/essay/detect/dssd.md b/essay/detect/dssd.md new file mode 100644 index 0000000..86f3762 --- /dev/null +++ b/essay/detect/dssd.md @@ -0,0 +1,21 @@ +# dssd: deconvolutional single shot detector, liuwei 2017 +## abstract +使用resnet-101做backbone的ssd检测网络为baseline,论文的主要贡献为,1.使用deconvolution为baseline添加上下文信息,2.然而直接添加deconvolution作用好像不大,为此又提出一个前向传播的连接方式和一个新的输出模块 + +``` +State-of-the-art detectors rely on the power of transfer learning. +``` + +## experiments +基于ResNet101做backbone网络,与R-FCN相同,为了增加conv5 stage的分辨率,将conv5 stage的stride由$32$改为$16$,具体的将conv5 stage的第一个卷积层的stride降低为$1$,同时,为了保持conv5 stage的感受野保持不变,将conv5 stage中kernel size大于$1$的卷积层的dilated由$1$增加为$2$。 + +- coco +作者先训练SSD,然后使用SSD初始化DSSD的参数,并且训练时freeze了SSD中存在的参数,只训练随机初始化的参数,之后作者尝试了联合SSD一起训练,但是精度降低了。 + +- inference time +为了加速,作者在测试阶段将BN层的参数合并到了Conv层,从而可以移除BN层。 + +## tips +memory footprint? + +single shot:指图像只输入一次,只有一次前向传播,而不是建立图像金字塔,然后将多个尺度顺序输入模型得到结果。 \ No newline at end of file diff --git a/essay/fasterrcnn.md b/essay/detect/fasterrcnn.md similarity index 94% rename from essay/fasterrcnn.md rename to essay/detect/fasterrcnn.md index 0c438c3..1e99b09 100644 --- a/essay/fasterrcnn.md +++ b/essay/detect/fasterrcnn.md @@ -1,4 +1,4 @@ -![rcnn123](../image/essay/rcnn123.jpg) +![rcnn123](../../image/essay/rcnn123.png) [faster rcnn](http://blog.csdn.net/shenxiaolu1984/article/details/51152614) ## faster rcnn: towards real-time object detection with region proposal networks @@ -13,41 +13,47 @@ RPN是一个全卷机网络,用于输出目标框及目标框为目标的概 RPN网络是在与Fast R-CNN的共享特征图上额外接了几层卷积网路输出目标框的位置与类别,所以RPN是FCN网络。RPN网络使用 anchors 来完成多尺度目标框提取,具体就是pyramid of regression references。为了统一RPN与Fast R-CNN,采用了交替训练的方法。 -## related work -object proposals: 基于超像素的方式,基于滑窗的方式。 +## 2. related work +object proposals: 基于超像素的方式,基于滑窗的方式。 dnn for object detection: overfeat,multibox,sppnet -## faster rcnn +## 3. faster rcnn 由两个模块组成,1.RPN 2.Fast R-CNN detector 两个模块组成一个统一的一体,使用流行的术语,注意力机制,RPN告诉Fast R-CNN检测哪里。 -### region proposal networks +### 3.1 region proposal networks 输入为一张图片,输出为框及框中是否包含目标的概率。 作者尝试了5层卷积网络的ZFnet,13层卷积网络的VGGnet16。为了输出框及框包含目标的概率,在共享的卷积层输出特征中,让一个小型网络以$3\times 3$为窗口进行卷积特征图输出低维度特征向量,(256-d for ZF-net, 512-d for VGG),特征向量再用于回归坐标及分类。可以看出,mini-network是以滑窗的形式在特征图上计算,那么也可以看做是一个卷积层。 + - anchors k表示每一个slinding window中要提出的proposal region的数目。 k个proposal box是以k个reference box为参考的参数表达的,这k个reference boxes叫做anchors,一个anchor是一个带有尺度和长宽比的以slinding window的中心为中心的框。 anchor具有平移不变性,这是通过FCN实现的,而MultiBox使用聚类提出的框,是没有平移不变性的。 achors是一种新的解决多尺度问题的方法,因为anchors是multi-scale的。 -![faster](../image/essay/fastermultisize.jpg) +![faster](../../image/essay/fastermultisize.jpg) 图中特征的多尺度实现方式出现了3种,第一种方法是图像是多尺度的,第二种方法是特征图是多尺度的,第三种方法是slinding window多尺度的。 + - loss function 训练时,把两种anchors看做正样本,1.与ground-truth box的IOU最大的anchor,也就是说有多少个ground-truth box就会有多少个anchor被标注为正样本。2.所有的与ground-truth box的IOU大于0.7的anchor。这两种标注策略最终会导致一个ground-truth box对应到多个anchor上,通常使用策略2就可以生成多个正确的正样本,但是有时会是0个,所以增加了策略1。负样本是所有与ground-truth box的IOU少于0.3的框。 一个mini batch的损失的计算函数,这里一个mini-batch就是一张图片 > $$L(\{p_i\}, \{t_i\})=\frac{1}{N_{cls}}\sum_i L_{cls}(p_i,p_i^*)+\lambda \frac{1}{N_{reg}}\sum_i p_i^* L_{reg}(t_i,t_i^*)$$ $p_i$表示预测的一个anchor为目标的概率,$p_i^*$表示表示一个anchor的label为1或0,$t_i$表示预测的4个参数化的bounding box,$t_i^*$表示一个关于正样本anchor的ground truth box,这里regression loss选用了smooth L1损失,分类层与回归层的输出分别为$\{p_i\}$和$\{t_i\}$。 $N_{cls}$表示mini-batch的大小,$N_{reg}$表示一张图像里anchor location的数量,与anchor的数量不同,(对于$1000\times 600$的输入图像,输出的特征图是$60\times 40=2400$,也就是有$2400$个anchor location)。这里不同于以往的bounding box regression,因为以往的用的特征是从不同大小的roi pool到的,并且参数要适用与所有不同大小的roi size,而这里regression是针对固定大小窗口($3\times 3$)的特征的,针对k个不同大小的anchor,学习了k个专用的regressor,用于针对不同的scale与aspect ratio。 + - training rpns 采用了image-centric来训练rpn,image-centric指fast-rcnn中训练样本是从一张图像中**随机**抽取的,针对SPPnet无法训练的问题提出的。每一个mini-batch是由一张图像抽取出的256个正样本、负样本achor组成的。从一张图像中按正、负样本1:1比例抽取256个anchors,如果正样本不够,拿负样本填充。 ### sharing features for rpn and fast r-cnn 尝试了3种方法来训练feature shared的rpn与fast r-cnn -1. 交替训练,先训练rpn,然后使用rpn提出的框训练fast r-cnn,参数初始化的方式没有讲,然后再用fast-rcnn的参数初始化rpn来,接着训练rpn,这篇文章的实验就是这个方法做的。 +1. 交替训练,先训练rpn,然后使用rpn提出的框训练fast r-cnn,参数初始化的方式没有讲,然后再用fast-rcnn的参数初始化rpn来,接着训练rpn,**这篇文章的实验就是这个方法做的。** + 2. 近似联合训练,这里将rpn与fast-rcnn当做一个整体训练,两个损失在shared feature处交汇相加,但是忽略了继承性??,rpn的输出也是fast-rcnn的输入,所以也是网络的响应,实验结果与1相近。 + 3. 联合训练,因为2中rpn的输出同样是fast-rcnn的输入,所以计算梯度时,fast-rcnn的损失也会传导到rpn中, 最后作者采用了4步来训练,第一步,使用ImageNet预训练模型初始化网络,训练RPN,第二步,Fast R-CNN使用ImageNet初始化网络,使用第一步输出的框做训练集训练,第三步,使用第二步训练好的Fast R-CNN网络初始化RPN,训练时,固定共享卷积网络的参数,只训练RPN独有的网络参数,第四步,固定共享卷积网络的参数,训练Fast R-CNN独有的网络参数。 ### implementation detailes +ZFNet与VGG的最后一层stride为16。 训练时忽略boundary crossing outliers的anchor,因为他们会使网络训练不收敛。 ## 实验 @@ -64,8 +70,8 @@ rpn | 300 | 59.9 -------|----|-------|------- VOC07+VOC12| ss | 2000 | 70.0 COCO+07+12 | rpn | 300 | 78.8 -one-stage detection VS two-stage proposal + detection -one-stage模型 Overfeat,使用滑动窗口,直接生成框的位置及类别 +one-stage detection VS two-stage proposal + detection +one-stage模型 Overfeat,使用滑动窗口,直接生成框的位置及类别 two-stage模型 Faster R-CNN,先生成region proposal box,再生成类别及框的准确位置 ## conclusion \ No newline at end of file diff --git a/essay/fastrcnn.md b/essay/detect/fastrcnn.md similarity index 97% rename from essay/fastrcnn.md rename to essay/detect/fastrcnn.md index 99ae3ca..f69dcc9 100644 --- a/essay/fastrcnn.md +++ b/essay/detect/fastrcnn.md @@ -9,7 +9,7 @@ fast-rcnn是基于rcnn上的改进,能够对一张图像的object proposal分 1. 大量的候选框 (Proposal) 需要处理 2. 为了精准定位目标,候选框仍要 refine -以前的方法大都是 multi-stage piplines +以前的方法大都是 multi-stage piplines fast-rcnn 是 single stage training that jointly learns to classify object proposals and refine their spatial locations 改善后的结果就是速度上9倍于R-CNN, 3倍于SPPnet, mAP达到66% @@ -22,7 +22,7 @@ SPPnet使用了空间金字塔最大值池化,为每一个 proposal 在一个 SPPnet的缺点:和R-CNN相同,训练是多阶段的(包括提取特征,使用log loss微调网络,训练svm,训练bounding box regressor) ## Fast R-CNN architecture and training - ![fastrcnnflow](../image/essay/fastrcnnflow.jpg) + ![fastrcnnflow](../../image/essay/fastrcnnflow.jpg) 输入是一张图像与object proposal,输出是类别及bounding box regressor。在图像的卷积特征图上为每一个 proposal box 提取特征的方法 a region of interest(ROI) pooling layer,提取固定维度的特征向量 - roi pooling layer roi pooling layer可以看做是SPPnet中的spatial pyramid pooling layer的一个特例,因为它只使用了一层特征。 @@ -51,7 +51,7 @@ $\lambda$是一个平衡分类误差与坐标回归误差的超参数,论文 ### Mini-batch sampling 每次的SGD使用的mini-batch是从两张图像中抽取的ROI样本,每张图像抽取64个样本,共128个ROI -正样本的选取是as in rcnn,使用 25% (128*25%=32个ROI)的与 ground truth bounding box 的 IOU 大于 0.5 的 proposal +正样本的选取是as in rcnn,使用 25% (128*25%=32个ROI)的与 ground truth bounding box 的 IOU 大于 0.5 的 proposal。 负样本的选取是类似SPPnet,抽取与ground truth bounding box的IOU最大为[0.1,0.5) ### Back-propagation through ROI Pooling Layers diff --git a/essay/fgfa.md b/essay/detect/fgfa.md similarity index 100% rename from essay/fgfa.md rename to essay/detect/fgfa.md diff --git a/essay/fpn.md b/essay/detect/fpn.md similarity index 72% rename from essay/fpn.md rename to essay/detect/fpn.md index fda4d78..e88783a 100644 --- a/essay/fpn.md +++ b/essay/detect/fpn.md @@ -1,6 +1,10 @@ # feature pyramid networks for object detection +2018-09-06 15:29 + +提出FPN框架 + ## abstract -为了能够检测多尺度的目标,特征金字塔是一个很基本的成分,而以往的目标检测算法为了减少计算量,都没有使用金字塔,这篇文章探索了多尺度,在增加了很少额外计算量的情况下使用了特征金字塔,为了建立多尺度的特征图,采用了一个top down的结构,叫做FPN(feature pyramid networks) +为了能够检测多尺度的目标,特征金字塔是一个很基本的成分,而以往的目标检测算法为了减少计算量,都没有使用金字塔,这篇文章探索了多尺度,在增加了很少额外计算量的情况下使用了特征金字塔,为了建立多尺度的特征图,采用了一个top down、lateral connection的结构,叫做FPN(feature pyramid networks) 6fps,因为还是two stage的结构。 ## introduction @@ -9,25 +13,32 @@ hand-engineered features and neural networks deep convnet object detectors: overfeat, rcnn, sppnet methods using multiple layers: -## feature pyramid networks +## 3. feature pyramid networks 主要和ssd一样,使用了多个尺度的特征图,不过各层特征图的构造方式不同,包括bottom-up pathway, top-down pathway, lateral connections。 + ### bottom up -是前向的卷积网络,对于输出相同大小特征图的层,这里定义为在同一stage,feature pyramid就是把每一stage的输出当做一层。$C2,C3,C4,C5$,对应的步长为$4,8,16,32$。由于Conv1的特征图过大,所以没有包括在内。 +是前向的卷积网络,对于输出相同大小特征图的层,这里定义为在同一stage,feature pyramid就是把每一stage最后一层网络的输出当做一层。$C2,C3,C4,C5$,对应的步长为$4,8,16,32$。由于Conv1的特征图过大,所以没有包括在内。 + ## top down and lateral connections -使用最近邻原则进行上采样,每次扩大$2$倍,与相同大小的bottom up特征图相加,为了使两者通道数一致,其中bottom up结构使用$1\times 1$卷积处理。 -因为所有层特征图上的head 网络是共享参数的,所以特征图的通道数要一致,这里设为$d=256$ +使用最近邻原则进行上采样,每次扩大$2$倍,与相同大小的bottom up特征图相加(element-wise add),为了使两者通道数一致,其中bottom up结构使用$1\times 1$卷积降低维度。 +因为所有层特征图上的head网络和传统特征金字塔一样是共享参数的,所以特征图的通道数要一致,这里设为$d=256$,在这些网络层里,没有非线性激活函数。 +作者这样设计是为了保持模型简单,因为文章的重点不在于此,不过设计更复杂的连接层会得到更好的效果。 -## applications +## 4. applications 使用fpn网络作为RPN和Fast R-CNN的基础结构。 + ### fpn for RPN RPN网络本来的设计是只在一层特征图上进行$3\times 3$的卷积操作,每个卷积操作对应不同大小、不同比例的anchor输出。现在是在fpn的基础上做RPN,是在$\{P2,P3,P4,P5,P6\}$特征图上执行$3\times 3$的卷积操作,分别输出$\{32^2,64^2,128^2,256^2,512^2\}$大小的anchor,每个大小对应三种比例$\{1:2,1:1,2:1\}$。 正样本为IOU$>0.7$和与ground-truth box的IOU最大的proposal box,负样本是IOU$<0.3$的proposal box。 作者实验发现,在所有层特征图上的head network共享参数及不共享参数两种情况下的,性能相差不大,说明各层特征图有相似的语义? + ### feature pyramid networks for Fast R-CNN Fast R-CNN是在一个特征图上使用Roi Pool来获取固定长度的特征向量,所以对于Proposal box,需要从FPN的多层特征图选出一层来提取特征图,对于$w,h$的proposal box,应该对应于FPN的第$k$层特征图,(提出框的RPN层,并不是用于提取特征的层): > $$k = \lfloor k_0+\log_2(\sqrt{wh}/224)\rfloor$$ $224$是ImageNet训练网络时惯用的输入图像大小,$k_0$是当Roi为$224\times 224$时,所对应的特征图层,这里$k_0$设为与Faster R-CNN论文中类似的位置,即$4$。 最后在特定层,提取Roi对应的特征向量$7\times 7$,后接$2$层$1024-d$的全连接。 + +## 5. experiments ## conclusion -实验表明,尽管ConvNet具有很强表达能力,一定程度上具有尺度不变性,显示的使用金字塔表示仍然很有必要。 \ No newline at end of file +实验表明,尽管ConvNet具有很强表达能力,一定程度上具有尺度不变性,但是显示的使用金字塔表示仍然很有必要。 \ No newline at end of file diff --git a/essay/detect/ganDetect.md b/essay/detect/ganDetect.md new file mode 100644 index 0000000..4832d8a --- /dev/null +++ b/essay/detect/ganDetect.md @@ -0,0 +1,11 @@ + # A-Fast-RCNN: Hard Positive Generation via Adversary for Object Detection + 目标检测改进的方向有三个 + 1. 改善骨干网络 + 2. 增加上下文信息 + 3. 训练数据增强 + hard example,该论文方法都属于第三种 + +样本是在一个受限的特征空间生成的,遮挡和形变,而不是在像素空间。 + +ASDN:adversarial spatial dropout network +ASTN: adversarial spatial transformer network \ No newline at end of file diff --git a/essay/detect/hypercolumns.md b/essay/detect/hypercolumns.md new file mode 100644 index 0000000..54e0533 --- /dev/null +++ b/essay/detect/hypercolumns.md @@ -0,0 +1,21 @@ +# hypercolumns for object detection segmentation and fine-grained localization 2015 +## abstract +detection, segmentation, keypoint localization + +定义一个pixel位置处的hypercolumns特征为该处所有神经元的激活向量。hypercolumns是从神经科学中引入的一个术语,在神经科学中,它是用来描述一组V1神经元,这些神经元以柱状结构排列,对多个方向、多个频率的边缘敏感 +1. simultaneous detection and segmentation(SDS) / instance segmentation +2. keypoint localization +3. part labling, 检测目标并定位它的组成部分,例如关键点定位或组成部分分割。 + +## introduction +## related work +## pixel classification using hypercolumns +对于segmentation、part labling、keypoint prediction,目标都是输出$50\times 50$大小的概率图 +使用双线性插值来使不同大小的特征图成为希望大小的尺寸。 最后的实现并不是使用双线性插值,因为通道数较大导致计算量过大,所以采用了文中的先计算score,最后上采样score并将多层score相加。 +位置信息对于最后一层全连接输出的特征图的利用也很重要,该特征是对于全图的判断,如果特征图各处都使用同一个分类器,那么该全图特征只能对最后结果起一个偏置的作用 + +## tips +$\text{AP}^\text{r}$ +FT: +T-Net +O-Net \ No newline at end of file diff --git a/essay/inprercnn.md b/essay/detect/inprercnn.md similarity index 100% rename from essay/inprercnn.md rename to essay/detect/inprercnn.md diff --git a/essay/detect/iounet.md b/essay/detect/iounet.md new file mode 100644 index 0000000..95326c6 --- /dev/null +++ b/essay/detect/iounet.md @@ -0,0 +1,3 @@ +# Acquisition of Localization Confidence for Accurate Object Detection ECCV 2018 + +2018-08-27 21:09 diff --git a/essay/lhrcnn.md b/essay/detect/lhrcnn.md similarity index 96% rename from essay/lhrcnn.md rename to essay/detect/lhrcnn.md index 75d0e68..4e7d735 100644 --- a/essay/lhrcnn.md +++ b/essay/detect/lhrcnn.md @@ -23,6 +23,6 @@ light head R-CNN and details > $$\text{basic feature extractor} \rightarrow \text{thin feature maps}\rightarrow \text{R-CNN subnet}$$ thin feature maps的输出是$10\times p \times p$,$p$表示Roi pooling后的尺寸,如$3\times 3=9$?? -![large separable convolution layer](../image/essay/lsc.jpg) +![large separable convolution layer](../../image/essay/lsc.jpg) ## experiments diff --git a/essay/maskrcnn.md b/essay/detect/maskrcnn.md similarity index 99% rename from essay/maskrcnn.md rename to essay/detect/maskrcnn.md index 8121914..2fd5d96 100644 --- a/essay/maskrcnn.md +++ b/essay/detect/maskrcnn.md @@ -22,7 +22,7 @@ Mask R-CNN通过将每一个关键点看做one-hot binary mask,可以识别ins R-CNN,Instance Segmentation(FCIS) ## Mask R-CNN -![maskrcnn](../image/essay/maskrcnn.jpg) +![maskrcnn](../../image/essay/maskrcnn.jpg) 为什么是直接对proposal box直接做mask预测,而不是对修正后的box做预测?这样如果根据proposal box生成的Mask与修正后的box位置、大小不匹配如何做显示???根据inference章节得知,训练时是基于proposal box生成mask,而预测时,是基于修正后的box预测mask。 Mask R-CNN为每一个Roi生成k个binary mask,k表示类别数目,而以往的instance segmentation方法是根据每一个像素的分类结果再判断这个目标是什么。 - Multi-task loss: diff --git a/essay/detect/megdet.md b/essay/detect/megdet.md new file mode 100644 index 0000000..cad5a2a --- /dev/null +++ b/essay/detect/megdet.md @@ -0,0 +1,21 @@ +# MegDet: A Large Mini-Batch Object Detector cvpr2018, arxiv 2017.11, face++ +探讨batch_size对目标检测模型训练结果的影响。作者建议使用warmup learning rate policy和cross-gpu batch normalization,这样采用batch_size=256,128GPUS,在coco数据集上,训练时间能够从33小时减到4小时。并且获得更高的精度,coco2017 challenge获得第一名mmAP=52.5% + +小的batch_size有如下三个问题 +1. 训练时间长 +2. BN参数统计不准确 +3. 正负样本比例相对于大batch_size更不均衡 + +如果简单的增大batch_size会面临如下问题,equivalent learning rate rule,即需要大的learning rate,然而这样不容易收敛,而小的learning rate,会导致结果次优。 + +作者提出一个目标检测上的linear scaling rule解释(基于维持损失方差的理论),warmup learning rate rule,cross-gpu batch normalization(首次在目标检测上对BN层进行训练,过去的模型训练应该都fix住了BN层的参数)。 + +## related work +## approach +训练目标检测网络时,固定BN参数并不好,因为ImageNet与COCO的数据集不同。 +linear scale lr在这里是基于variance equivalence推出的,不过有点让人难以理解的地方是为什么要维持方差不变? + +## CGBN +由于卡间交流非常耗时,所以大部分深度学习框架使用cuDNN来实现BN,而cuDNN只提公了高层的API接口实现卡内的信息整合,作者使用了nvidia collective communication library(NCCL)来实现ALLReduce操作,即卡间均值、方差的计算。这个方法只能实现一台机器内的卡间BN计算。机器间的使用sub-liear memory。 + +## experiance diff --git a/essay/detect/metaAnchor.md b/essay/detect/metaAnchor.md new file mode 100644 index 0000000..1c83735 --- /dev/null +++ b/essay/detect/metaAnchor.md @@ -0,0 +1,7 @@ +# metaAnchor: learning to detect objects with customized anchors face++, 2018.7-arxiv +[metaAnchor](https://www.jianshu.com/p/a24d814613eb) + +作者将anchor机制理解为是分而治之的思想(divide and conquer),即把连续的box空间分解成离散的区别,每个区间有预设的anchor。然后使用每个区间定义的anchor function来完成目标检测。 + +假设x是从输入图像中提取的特征,那么anchor function: +> $$\mathcal{F}_{b_i}(x;\theta_i)=(\mathcal{F}_{b_i}^{cls}(x;\theta_i^{cls}), \mathcal{F}_{b_i}^{reg}(x;\theta_i^{reg}))$$ \ No newline at end of file diff --git a/essay/mscnn.md b/essay/detect/mscnn.md similarity index 79% rename from essay/mscnn.md rename to essay/detect/mscnn.md index 1e9b52a..8c6329c 100644 --- a/essay/mscnn.md +++ b/essay/detect/mscnn.md @@ -1,13 +1,16 @@ # a unified multi-scale deep convolutional neural network for fast object detection ECCV 2016 [blog](https://xzhewei.github.io/2017/10/21/%E8%AE%BA%E6%96%87%E7%AC%94%E8%AE%B0%E3%80%8AA-unified-multi-scale-deep-convolutional-neural-network-for-fast-object-detection%E3%80%8B/) + ## abstract MS-CNN是一个two-stage目标检测网络,由两部分组成,a proposal subnetwork, a detection subnetwork。 + proposal network是在多个特征图上操作的(与FPN,SSD类似),使用特征上采样反卷积(deconvolution)来替代输入上采样,网络整体是端到端训练,使用multi-task损失。 + MS-CNN达到15fps -## introduction -滑动窗口目标检测很难推广到多类目标检测?(特征提取方法不变,而改变分类器的分类数目不就行?) -CNN能够解决多类目标检测的问题,但是对多尺度目标检测的研究还很少。R-CNN的计算效率很低,而Faster R-CNN中RPN依然有问题,它的感受野是固定的,而目标的大小不同,这导致小目标检测很困难(大感受野,小目标)。而现有的解决方法,放大输入图像,牺牲了计算量。 +## 1. introduction +滑动窗口目标检测很难推广到多类目标检测?(特征提取方法不变,而改变分类器的分类数目不就行?分类器往往是二分类前、背景)。 +使用CNN解决多类目标检测的问题的工作已有很多,但是对多尺度目标检测的研究还很少。R-CNN的计算效率很低,而Faster R-CNN中RPN依然有问题,它的感受野是固定的,而目标的大小不同,这导致小目标检测很困难(大感受野,小目标)。而现有的解决方法,上采样输入图像,构造输入图像金字塔,这样牺牲了计算量。 本文提出MS-CNN,贡献点有 1. 多层用于目标检测, @@ -30,6 +33,6 @@ VJ的快速主要有两个方面, ### multi-scale detection ### architecture -## object detection network +## 4. object detection network ## conclusions diff --git a/essay/detect/multibox.md b/essay/detect/multibox.md new file mode 100644 index 0000000..2117e7f --- /dev/null +++ b/essay/detect/multibox.md @@ -0,0 +1,12 @@ +# Scalable Object Detection using Deep Neural Networks 2013 +2018-08-31 17:58 + +ascribe : 归因于,归咎于 + +agnostic: 未知的 + +pertain:属于、关于 + +如果一张图上有M个目标,也就是存在M个bounding boxes label,而预测框假设为K个,K实际上大于M,然后我们从K个预测框中选择M个与label匹配度最好的计入位置损失函数。同时,其它的预测框计入前景、背景的损失函数。 + +回归坐标的方法其实和resnet的思想很相似,因为回归坐标也是回归的误差值,而不是真正的坐标。 \ No newline at end of file diff --git a/essay/nocs.md b/essay/detect/nocs.md similarity index 100% rename from essay/nocs.md rename to essay/detect/nocs.md diff --git a/essay/overfeat.md b/essay/detect/overfeat.md similarity index 100% rename from essay/overfeat.md rename to essay/detect/overfeat.md diff --git a/essay/detect/panoptic.md b/essay/detect/panoptic.md new file mode 100644 index 0000000..5421b33 --- /dev/null +++ b/essay/detect/panoptic.md @@ -0,0 +1,2 @@ +# panoptic feature pyramid networks 2019 FAIR 何凯明 + diff --git a/essay/rcnn.md b/essay/detect/rcnn.md similarity index 91% rename from essay/rcnn.md rename to essay/detect/rcnn.md index 1fa0522..d475ffe 100644 --- a/essay/rcnn.md +++ b/essay/detect/rcnn.md @@ -6,13 +6,13 @@ 卷基层生成的特征图 ## rcnn -- 训练集 - 一个较大的识别库(ImageNet ILSVC 2012):标定每张图片中物体的类别。一千万图像,1000类。 - 一个较小的检测库(PASCAL VOC 2007):标定每张图片中,物体的类别和位置。一万图像,20类。 -- RCNN算法分为4个步骤 - 一张图像生成1K~2K个候选区域 selective search方法 - 对每个候选区域,使用深度网络提取特征 - 特征送入每一类的SVM 分类器,判别是否属于该类 +- 训练集 + 一个较大的识别库(ImageNet ILSVC 2012):标定每张图片中物体的类别。一千万图像,1000类。 + 一个较小的检测库(PASCAL VOC 2007):标定每张图片中,物体的类别和位置。一万图像,20类。 +- RCNN算法分为4个步骤 + 一张图像生成1K~2K个候选区域 selective search方法 + 对每个候选区域,使用深度网络提取特征 + 特征送入每一类的SVM 分类器,判别是否属于该类 使用回归器精细修正候选框位置 ## introduction @@ -33,7 +33,7 @@ 1. 把目标框看做位置回归的问题,但是像DetectorNet一样,效果并不好;另一个方法是sliding window,这种方法已经使用了很长时间,但是为了保持**空间分辨率**,都只是用了2层卷积,1层池化。这篇论文采用了这种方法,不过网络变成了5层卷积,这样感受野为$195\times 195$,stride 为$32\times 32$像素。 recognition using regions paradigm [21] 2. 传统的结局方法是使用无监督学习来进行预训练,然后使用监督微调。而这篇论文是使在另一个较大数据集(ILSVRC)上用监督式预训练,然后再在小数据集上进行domain-specific fine-tuning,这里的domain 是指region proposal box经过warp后的框,与类别也有关系,单关注重点在warp proposal windows。 -![rcnnflow](../image/essay/rcnnflow.jpg) +![rcnnflow](../../image/essay/rcnnflow.jpg) ## Object detection with R-CNN object detection system consists of 3 modules @@ -85,7 +85,7 @@ overFeat要比RCNN快9倍,overFeat没有针对每一个box进行CNN提特征 ## conclusion ## Appendix A 目标框的变换 -![warp](../image/essay/rcnnwarp.jpg) +![warp](../../image/essay/rcnnwarp.jpg) 主要包括两种方法使proposal box成为227x227大小,一是使用 tightest square(最小外接正方形),然后再将其长、宽等比例地 (isotropically) 放大到227x227,图中,B和C都是这个方法,两者的区别在于B使用context填充空缺,如果没有context,则用均值,C直接使用图像均值填充空缺,而A是proposal box,D是直接 warp,即直接进行放大。在每个例子中,上一行是直接对proposal box处理,即 context padding = 0,下一行的 context padding = 16。实验表明使用D方法中的warp with context padding = 16时,效果最好,提高3-5 mAP% ## Appendix B Positive vs negative examples and softmax @@ -104,4 +104,10 @@ overFeat要比RCNN快9倍,overFeat没有针对每一个box进行CNN提特征 在训练过程中,有两个 subtle issues 1. 需要使用较大的规则化系数 -2. training pairs的选择,我们把 proposal box 配对到与所有 bounding box 中 IOU 最大的 bounding box 上,并且 IOU 大于 0.6 时,才配对成功,可以作为训练集,其它的都舍弃。为每一个类别都做这个过程来训练处 class-specific bounding box regressor。作者还考虑了迭代这个过程,就是把纠正过的 bounding box 重新作为输入来训练,但是精度并没有改善。 \ No newline at end of file +2. training pairs的选择,我们把 proposal box 配对到与所有 bounding box 中 IOU 最大的 bounding box 上,并且 IOU 大于 0.6 时,才配对成功,可以作为训练集,其它的都舍弃。为每一个类别都做这个过程来训练处 class-specific bounding box regressor。作者还考虑了迭代这个过程,就是把纠正过的 bounding box 重新作为输入来训练,但是精度并没有改善。 + +> $$\begin{aligned}G_x &= P_w d_x(P) + P_x \\ +G_y &= P_hd_y(P) + P_y \\ +G_w &= P_w \exp(d_w(P)) \\ +G_h &= P_h \exp(d_h(P)) \end{aligned}$$ +其中,$d_x,d_y,d_w,d_h$是网络拟合的函数直接输出,也就是网络需要预测的值, $P_x,P_y,P_w,P_h$是anchor。 \ No newline at end of file diff --git a/essay/refinedet.md b/essay/detect/refinedet.md similarity index 100% rename from essay/refinedet.md rename to essay/detect/refinedet.md diff --git a/essay/detect/regionFeature.md b/essay/detect/regionFeature.md new file mode 100644 index 0000000..fa4a867 --- /dev/null +++ b/essay/detect/regionFeature.md @@ -0,0 +1,9 @@ +# Learning Region Features for Object Detection 2018 msra daijifeng + +2018-08-31 17:53 + +这里提出将Roi-Pooling泛化为可学习模块,但实验结果显示其性能和deformable roi pooling类似或较差一点。 + +## region feature extraction性能排序 + +deformable roi pooling > roi aligned poooling > roi pooling diff --git a/essay/relationrcnn.md b/essay/detect/relationrcnn.md similarity index 100% rename from essay/relationrcnn.md rename to essay/detect/relationrcnn.md diff --git a/essay/retinanet.md b/essay/detect/retinanet.md similarity index 64% rename from essay/retinanet.md rename to essay/detect/retinanet.md index f0bdcfb..e17403e 100644 --- a/essay/retinanet.md +++ b/essay/detect/retinanet.md @@ -1,6 +1,9 @@ # focal loss for dense detector, FAIR, best student paper iccv 2017 +2018-09-06 15:30 + ## abstract -two-stage的目标检测方法对稀疏的proposal box进行分类,one-stage的目标检测方法是对密集采集的possible box做分类,然而虽快但准确率没有two-stage的高。作者认为是one-stage训练时的正、负样本不均衡造成的,所以修改了 cross entropy 的形式,并称作focal loss来结局类别不平衡问题,对应的网络称为retinanet。 +two-stage的目标检测方法是对稀疏的proposal box进行分类,one-stage的目标检测方法是对密集采样的anchor box做分类,然而one stage虽快但准确率没有two-stage的高。 +可以轻易的发现,两者的不同点在于稀疏的box与密集的box。所以作者认为one-stage性能差的主要原因是训练时的正、负样本不均衡造成的,所以修改了cross entropy 的形式。主要是降低了易分样本的损失权重,这样损失函数就是集中精力学习区分稀疏的难例样本(就和two stage相同了),作者将损失函数称为focal loss,文中使用的网络称为retinanet。 ## introduction 作者认为类别不平衡是one-stage检测器性能不好的主要原因。R-CNN使用two-stage cascade(selective search已经将候选框的位置降低了)和启发式采样proposal box(正负样本比例$1:3$,在线难例学习)来解决类别不平衡问题,而one-stage检测器必须处理大量的候选框,遍布各种spatial position、scale、aspect ratio。于是作者提出focal loss来解决类别不平衡问题。 @@ -23,6 +26,8 @@ robust loss function,计算损失时减少outlier(难例)的权重。focal los focal loss主要用于解决one-stage目标检测中极度的样本不均衡问题($1:1000$)。 这里以二分类为例子,但focal loss同样适用于多分类。 二分类cross entropy loss: +> $$\text{CE}(p)=-\frac{1}{n}\sum(y\log(p)+(1-y)\log(1-p))$$ +即: > $$\text{CE}(p) = \begin{cases} -\log(p) &\text{if } y=1 \\ -\log(1-p) &\text{otherwise} \end{cases}$$ 为了符号简介些,定义$p_t$,这样$p_t > 0.5$时,表示样本容易识别: @@ -33,32 +38,42 @@ focal loss主要用于解决one-stage目标检测中极度的样本不均衡问 但是上式只能均衡正负样本的权重,不会考虑到难易样本的权重的均衡,由此提出focal loss: > $$\text{FL}(p_t)=-(1-p_t)^{\gamma} \log(p_t)$$ 其中,$p_t$表示**probability of ground truth class??** ,看定义式即正确分类的概率,$\gamma$叫做focal参数。 -![focal loss](../image/essay/focalloss.jpg) +![focal loss](../../image/essay/focalloss.jpg) 最后作者使用的是$\alpha$-blanced variant focal loss: > $$\text{FL}(p_t)=-\alpha_t (1-p_t)^{\gamma} \log(p_t)$$ 模型初始化时数据不均衡容易导致早期训练的不稳定??,对于平常的二分类问题,模型的输出是以$0.5$的概率输出$1$或$0$,但是对于样本严重不均衡的情景,这会造成早期训练损失的不稳定。 -## retinanet detector +## 4 retinanet detector 网络由一个backbone和两个subnetwork构成。 - feature pyramid network backbone -特征图为$P3-P7$,每个输出特征图的通道数为$256$ +特征图为$P3-P7$,表示stride由$2^3\sim 2^7$,每个输出特征图的通道数为$256$ + - anchors $P3-P7$的特征图上的anchor大小为$32^2-512^2$,每个anchor有三种比例$\{1:2,1:1,2:1\}$,使用了三种相对尺寸$\{2^0,2^{1/3},2^{2/3}\}$,所以一个位置共对应$9$个anchor,每个anchor对应的label有分类标签$K$元素向量的独热编码,$4$元素向量的坐标回归标签。 正样本为IOU$>0.5$的,负样本为IOU$\in [0,0.4)$,对于IOU$\in [0.4,0.5)$的被舍弃。 **突然发现RCNN系列的two-stage目标检测与one-stage的目标检测的正、负样本选择有着本质上的区别,对于RCNN系列中每一个样本都是proposal box与ground truth box的差值,而SSD类的是从预设的anchor box中选出样本,固然,对于一幅图像,anchor都是固定的,也就是正负样本是固定的,而预测值也是固定的anchor与ground truth box的差值。** + - classification subnet -这里好像与SSD不同,分类网络的参数在不同层的特征图上也是共享的,因此用于输出的特征图的通道数都是相同的。**并且这里输出特征图后接sigmoid,直接输出Box是某个类的概率,而这里也就没有了背景类的输出,这也就是为什么网络输出$KA$通道的原因($K$为目标类别),而最后也是根据阈值$0.5$来排除背景的。** -- box regression subnet: +这里与SSD不同,分类网络的参数在不同层的特征图上也是共享的,因此用于输出的特征图的通道数都是相同的。**并且这里输出特征图后接sigmoid,直接输出Box是某个类的概率,而这里也就没有了背景类的输出,这也就是为什么网络输出$KA$通道的原因($K$为目标类别),而最后也是根据阈值$0.5$来排除背景的。** +与RPN不同,这里的class subnet与 loc subnet没有共享参数,作者发现这种相对宏观的连接方式比网络参数更重要。 + +- box regression subnet: +class-agnostic bounding box regressor + +## 4.1 inference and training +- inference +使用conf阈值0.05,从每层FPN的输出中选出至多1000个predicted box,将多层FPN结果融合,最后使用IOU阈值0.5的NMS输出结果。 -inference and training -- inference: - focal loss -作者使用$\gamma=2,\gamma \in [0.5,5]$,$\alpha =0.25$,计算损失时包括了带有标签的所有anchor的损失。 +共$\sim 100k$ anchors? +作者使用$\gamma=2$,$\alpha =0.25$,$\gamma, \alpha$需要联调,计算损失时包括了带有标签的所有anchor的损失。 > $$total\_focal\_loss = \frac{1}{num\_pos\_anchor}\sum_i focal\_loss _i$$ + - initialization -使用ResNet-50-FPN和ResNet-101-FPN作为backbone网络,网络使用ImageNet预训练以初始化参数。 +使用ResNet-50-FPN和ResNet-101-FPN作为backbone网络,网络使用ImageNet预训练以初始化参数。其它FPN参数参照FPN论文中的初始化方法。 所有新的conv层的bias初始化为$0$,weight初始化为$\sigma=0.01$的高斯随机数, 特别改变了分类层偏置系数$b$的初始化,$b=-\log((1-\pi)/ \pi)$,这样初始化后,默认的一个anchor为目标的概率为$\pi$,作者采用$\pi =0.01$,PS:$\pi$与$3.1415$无关,这里只是个符号。 + - optimization: > $$loss = focal\_loss + smooth\_l1\_loss$$ ``` @@ -68,12 +83,27 @@ learning_rate = 0.01, 0.001(60k), 0.0001(80k) SGD weight_decay = 0.0001 momentum = 0.9 -only horizontal_flipping +data augmentation: only horizontal_flipping 10-35 hours ``` -## experiments +## 5. experiments coco trainval35k +### 5.1 training dense detection +input_size = 600 +- bias参数初始化为概率值0.01,会有利于网络收敛,概率具体值波动不会影响结果。 + +- **analysis of the focal loss** +作者详细分析了$\gamma=2$时的一个已训练好模型的输出结果。 +culmulnative distribution function: 累积分布直方图。 +$\gamma=2$时,负样本损失函数的大部分由少数负样本构成。 + +- OHEM: 尝试了各种配置 + +- Hinge Loss: 大于一定值时,不输出损失,效果不好。 + +### 5.2 model architecture design + ## conclusion diff --git a/essay/detect/rfcn-3000.md b/essay/detect/rfcn-3000.md new file mode 100644 index 0000000..5395629 --- /dev/null +++ b/essay/detect/rfcn-3000.md @@ -0,0 +1,12 @@ +# R-FCN-3000 at 30fps: Decoupling Detection and Classification +将Objectness score与Classification score解耦,就像YOLO中做的一样,最后的预测时confidence score(IOU)与类别的乘积。 +它和yolo9000一样,瞄向的是large scale detection systems。 + +## introduction +rfcn的检测策略使它每多检测一类物体就需要增加$49$个特定滤波器,由此,它不可能应用于large scale detection system。 +提出了先使用position sensitive filters分出super class,再在super class内细分每一类。 +super-class是使用了ResNet-101的2048维特征,然后使用K-均值聚类得到的,。 +最终的分类概率为细分类概率与super-class概率的乘积。 +作者通过改变super-class的数目来探究super-class是否真的起作用,实验表明即使只有一个super-class,效果也很明显,这说明这个super-class起到了判别objectness的作用。那么对于目标检测,per-class position sensitive filter就不再是必须的了。 +但是mAP会下降,在PASCAL VOC的20类目标检测中,这种方法会下降1.5%。 + diff --git a/essay/rfcn.md b/essay/detect/rfcn.md similarity index 100% rename from essay/rfcn.md rename to essay/detect/rfcn.md diff --git a/essay/satradeoff.md b/essay/detect/satradeoff.md similarity index 100% rename from essay/satradeoff.md rename to essay/detect/satradeoff.md diff --git a/essay/segmenteverthing.md b/essay/detect/segmenteverthing.md similarity index 100% rename from essay/segmenteverthing.md rename to essay/detect/segmenteverthing.md diff --git a/essay/snip.md b/essay/detect/snip.md old mode 100644 new mode 100755 similarity index 99% rename from essay/snip.md rename to essay/detect/snip.md index 1c3be2b..862cca8 --- a/essay/snip.md +++ b/essay/detect/snip.md @@ -1,8 +1,11 @@ # an analysis of scale invariance in object detection---snip + ## abstract + snip: scale normalization image pyramids ## introduction + 为解决多尺度及小目标检测的问题: - 浅层网络特征与深层网络特征结合 FPN - dilated/deformable 卷积,用于增大感受野检测大目标 @@ -14,7 +17,9 @@ snip: scale normalization image pyramids ## related work ## image classification at multiple scales + domain shift,即训练与测试时的输入图片大小不同,引入的输入分布变化。 典型的训练时输入$800\times 1200$,测试时$1400\times 2000$ + - CNN-B-FT 使用上采样低分辨率的图像上微调CNN-B \ No newline at end of file diff --git a/essay/detect/softnms.md b/essay/detect/softnms.md new file mode 100644 index 0000000..578e8b6 --- /dev/null +++ b/essay/detect/softnms.md @@ -0,0 +1,26 @@ +# improving object detection with one line of code +根据NMS算法的设计,如果一个目标与候选的检测框的IOU大于一定阈值,那么这个目标就会被抹掉,从而造成一个miss。softNMS只是抑制目标框的score,而不是直接抹去,所以不会造成object的丢失。这个作用从图1中可以比较清楚的显示出来。 +softNMS在以coco-style mAP metric的计算标准的PASCAL VOC和mscoco上都取得了改进。 + +## introduction +## related work +这里的NMS是greedy NMS,that is to say,每一次循环是从所有候选框中选出score最高的一个box。 +## softnms +小$N_t=0.3$时,会造成大量的目标框被抑制,对于大的$O_t=0.7$,从而造成较多的miss-rate。 +大$N_t=0.7$时,会保留大量的目标框,对于小的$O_t$,越小造成越多的false positive。 +因此大$N_t$或者小$N_t$都不合适, + +## 算法 +算法复杂度$O(N^2)$ + +## dataset and evaluation +在coco数据集、pascal voc上做实验,使用已经公开的训练好的模型,Faster RCNN、R-FCN、Deformable-RFCN,使用NMS阈值0.3。 + +## 实验 +softNMS对ssd的提高量相对于基于proposal detectors较少,是因为基于proposal detector的召回率更高,因此soft-NMS有更大的潜力去改善召回率。 + +## tips +$O_t$:detection **evaluation** overlap threshold +$N_t$: nms overlap threshold + + diff --git a/essay/detect/spn.md b/essay/detect/spn.md new file mode 100644 index 0000000..5635c36 --- /dev/null +++ b/essay/detect/spn.md @@ -0,0 +1,28 @@ +# spatial memory for context reasoning in object detection + +## Faster RCNN +使用VGG16构建Faster RCNN(文中简写为FRCNN)的骨干网络。 +conv5_3输出特征图通道数为512。 + +## spatial memory network +### memory +记忆呈2D的形式,维度为256,记忆的初始值为各目标在图像各处位置的概率,例如太阳更可能出现在图片的上方。并且概率的初始值不应随着图像的大小改变,所以初始记忆为$20\times 20\times 256$再以双线性插值得到conv5_3的特征图大小,分辨率为$1/16$。 + +### indexing +构建可微分的外部记忆时,最大困难是index,类似Roi Pooling(如何求微分)。 +what and how + +### input features +写入记忆的特征。使用的是conv5_3的Roi pooling,但没有采取max而是resize到$14\times 14$?conv5_3包括空间位置信息,但还不足以表示哪些目标已被检测到,所以记忆特征还包括fc8层softmax输出的目标类别概率。之后接两层$1x1$的卷积,用于从$512+C$维特征到$512$维特征的映射。 + +### writing +给定目标区域位置及输入特征$x_n$,使用GRU(gated recurrent unit)更新记忆单元,$S_{n-1}$为该位置已有记忆的内容,使用同样的操作从记忆特征图获得$14\times 14$大小的特征。最后使用Roi pooling的反操作,插入回记忆。 + +### context model +在记忆特征图之上,再接入$5$层$3\times 3\times 256$全卷积网络,使用padding操作以保持m-conv5与conv5_3的特征图大小保持一致。 + +### output +如同conv5_3,使用同样的方法在m-conv5之上。最后将基于记忆的预测放在FRCNN之上。 + +## training the spatial memory +这里解决了一个冲突的问题,即要抑制已检测出的目标。 \ No newline at end of file diff --git a/essay/sppnet.md b/essay/detect/sppnet.md similarity index 100% rename from essay/sppnet.md rename to essay/detect/sppnet.md diff --git a/essay/squeezedet.md b/essay/detect/squeezedet.md similarity index 100% rename from essay/squeezedet.md rename to essay/detect/squeezedet.md diff --git a/essay/ssd.md b/essay/detect/ssd.md similarity index 54% rename from essay/ssd.md rename to essay/detect/ssd.md index 5683e5a..d87ef60 100644 --- a/essay/ssd.md +++ b/essay/detect/ssd.md @@ -1,3 +1,8 @@ -# ssd:single shot multibox detector +# ssd:single shot multibox detector ECCV 2016 + ## abstract + +骨干网络使用VGG16 在PASCAL VOC 2007数据集上,输入$300\times 300$ ssd300 59fps 74.3%mAP,输入$512\times 512$ ssd512 76.9%mAP + +l2 normalization技术用于缩放 diff --git a/essay/detect/stdn.md b/essay/detect/stdn.md new file mode 100644 index 0000000..8a34355 --- /dev/null +++ b/essay/detect/stdn.md @@ -0,0 +1,24 @@ +# Scale-Transferrable Object Detection cvpr 2018是评审中泄露出的,匿名 +本篇文章主要为了解决多尺度目标检测问题。 + +## introduction +这部分对目标检测在尺度问题上的解决方案的演化上给出了比较清晰的线路。首先,传统手工特征上,基于图像金字塔;后来深度学习上,RCNN是使用同一个特征图做多尺度的检测,最后使用Roi pooling;SSD、MS-CNN使用多个特征图来做多尺度目标检测;FPN、ZIP、DSSD使用skip connection做特征上的融合,再使用多层特征图做目标检测。 + +本篇文章使用scale transfer module来做多尺度目标检测,这个方法是特别针对DenseNet中的Dense Block结构提出来的,也就不适用别的骨干网络。 + +## scale-transferrable detection network +- densenet +使用DenseNet-169做为特征提取网络,并在ILSVRC CLS LOC数据集上做分类网络预训练,densenet使用了deep supervision。将原denseNet-169的7x7 conv替换为了3x3conv。 +- scale transfer module +低分辨率使用mean pool获取(average pool?),高分辨率使用scale transfer layer(其实就是罗师兄做超分辨率时的pixel shuffle层,在pytorch中也有对应的实现)获取。 +- object localization module +anchor boxes: 采用和DSSD相同的设置[1.6, 2.0, 3.0] aspect ratio。 +classification subnet: 使用pre-activation +box regression subnet:smooth l1 loss + +## 实验 +醉了!在pacal voc 上训练了700 epochs + +## tip +- ZIP: zoom out-and-in network with recursive training for object proposal +- 前面的achor大还是后面的anchor大? \ No newline at end of file diff --git a/essay/detect/summaryModel.md b/essay/detect/summaryModel.md new file mode 100644 index 0000000..d3fe13b --- /dev/null +++ b/essay/detect/summaryModel.md @@ -0,0 +1,43 @@ +# YOLO + +三要素:模型,损失函数,优化方法 + +## yolo V1 + +- 7x7 feature map output, for VOC $7\times 7 \times(2\times 5 + 20)$ +- IOU predict +- 仿照GoogLeNet,24层卷积, conv7x7-s2, conv3x3, conv1x1, MaxPool2d(5层),fully connected layer(2层) +- 448x448 input,stride=64 +- dropout 减轻co-adaptation +- 最后一层使用linear activation,所有其它层使用leaky ReLU +- 损失函数都采用MSE +> $$\phi(x)=\begin{cases} x &\text{if } x > 0 \\0.1x &\text{otherwise }\end{cases}$$ + +## yolo V2 + +- *采用darknet-19 +- *采用anchor机制,kmeans聚类得到5个anchor +- *预训练模型技巧,在ImageNet上使用224x224训练后,又使用448x448训练10个epoch。 +- *增加pass through layer,from space to depth。 +- *采用batch normalization +- *采用multiscale training +- IOU predict +- 416x416 input,stride=32, 13x13 feature map output, $S\times S \times (B\times(5+C))$ + +## yolo V3 + +- *采用darknet-53,主要由darknet-19融合residual block而成。 +- *将maxpool替换为stride=2的conv3x3。 +- *三层FPN结构,每层预测3个anchor,共9个anchor。 +- 采用batch normalization。 +- 采用multiscale training. +- 使用IOU距离kmeans聚类获得anchor的长和宽。 +- 采用binary cross entropy,效果和softmax相同。 + +## RCNN + +![rcnn123](../../image/essay/rcnn123.jpg) + +## Fast RCNN + +## Faster RCNN \ No newline at end of file diff --git a/essay/detect/summarymAP.md b/essay/detect/summarymAP.md new file mode 100644 index 0000000..0eeb541 --- /dev/null +++ b/essay/detect/summarymAP.md @@ -0,0 +1,36 @@ +# mAP + +## metric + +coco, voc07, voc12 +model|backbone|Resolution|coco-testdev(%)|AP50|AP75|voc07|voc12| time (ms-GPU)|time (ms-CPU)|remark +---|---|---|---|---|---|---|---|---|---|--- +ssd|vgg16|512x512|28.8|48.5|30.3|||||with new data augmentation +ssd|resnet-101|513x513|31.2|50.4|33.3| +dssd|resnet-101|513x513|33.2|53.3| 35.2| +R-FCN|resnet-101|-|29.9|51.9|- +deformable|Aligned-Inception-ResNet|multi-scale test|37.5|58.0|-| +cornerNet|Hourglass-104 |511x511| 40.5|56.5|-|||244(Titan X) +cornerNet|Hourglass-104 |multi-scale test| 42.1|57.8|-|||244(Titan X) +RetinaNet|ResNet-101-FPN|800x800| 39.1|59.1|42.3|-||focal loss +RetinaNet|ResNeXt-101-FPN|-| 40.8|61.1|44.1|-|- +yolo-V2| darknet-19|-| 21.6|44.0|19.2|-| +yolo-V3| darknet-53| 608x608| 33.0| 57.9| 34.4|||51(Titan X, M40) +PVANet||1056x640|-|-|-|82.5|83.8|46-Titan-X|740-i7-6700k-CPU|| + +## voc2012 + +model|backbone|Resolution|time (ms-GPU)|time (ms-CPU)|mAP|remark +---|---|---|---|---|---|---|--- +PVANet||1056x640|46-Titan-X|740-i7-6700k-CPU|82.5| + +## voc2007 + +model|backbone|Resolution|time (ms-GPU)|time (ms-CPU)|mAP|remark +---|---|---|---|---|---|---|--- +PVANet||1056x640|46-Titan-X| 740-i7-6700k-CPU|83.8| + +## tips + +- 数据增强中,应该特别注意坐标xywh与xyxy的转换,w=max-min,公式成不成立,还要不要+1 +- 要转成浮点型,避免取整造成精度损失 diff --git a/essay/yolo.md b/essay/detect/yolo.md similarity index 60% rename from essay/yolo.md rename to essay/detect/yolo.md index 341ba96..f49da4e 100644 --- a/essay/yolo.md +++ b/essay/detect/yolo.md @@ -3,43 +3,57 @@ [有深度的yolo博客](http://blog.csdn.net/tangwei2014/article/details/50915317) ## abstract -以往的目标检测都是把检测当做分类器做的,这篇文章是看做回归做的,直接回归bounding boxes和class probabilities。 +以往的目标检测都是把检测当做分类器做的,这篇文章是看做回归做的,直接为划分的格子回归bounding boxes和class probabilities。 base yolo model 45fps PASCAL VOC 2007 mAP 63.4% Fast yolo model 155fps, PASCAL VOC 2007 mAP 52.7% -yolo的错误更多的是在定位上,很少出现把背景误认为目标的错误。 +yolo的错误更多的是在定位上,很少出现把背景误认为目标的错误。这是因为全连接的作用,能够利用大的感受野从而集成context信息。 -## introduction +## 1. introduction yolo 输入$448\times 448$ yolo的优点: 1. 快速,因为是把检测看做回归,输入一幅图像,直接对输出做阈值处理就得到结果,而不需要像RCNN一样复杂的流水线 2. 输出的时候,利用了全图的信息。不像slinding window和区域CNN的方法,yolo结合了全图的信息,也包含目标的周围图像,由此yolo相对于Fast RCNN产生更少的将背景看做目标的错误。 -3. yolo有更好的泛化能力,与其它目标检测网络做对比试验得出的结论。 +3. yolo有更好的泛化能力,与其它目标检测网络做对比试验得出的结论。 + +缺点:小目标定位较差。 + +## 2 unified detection +首先把整幅图像均分成$S*S$的格子,然后把目标检测的任务分到图像中物体中心所在图像中的小格子上。每一个小格子的输出信息是B个Bounding boxes,包括x,y,w,h及confidence scores for those boxes。confidence score包含两层意思,第一模型认为这个格子包含目标的概率,第二这个格子输出目标的准确能有多高。然后输出C个该格子的分类概率。 -## unified detection -首先把整幅图像均分成$7*7$的格子,然后把目标检测的任务分到图像中物体中心所在图像中的小格子内。每一个小格子的输出信息是B个Bounding boxes加上confidence scores for those boxes,confidence score包含两层意思,第一模型认为这个格子包含目标的概率,第二这个格子输出目标的准确能有多高。 confidence score 的定义: > $$Pr(Object)*IOU_{pred}^{truth}$$ + 如果一个小格子不包含目标的中心,那么它的confidence score为0,否则confidence score就等于$IOU_{pred}^{truth}$ -Bounding box(每一个小格子输出B个Bounding box,每一个Bounding box包含物体的矩形区域及confidence score,注意,不是划分的小格子) -- x,y:是物体即目标框的中心,相对于划分的小格子中心(bounds of the grid cell?)的偏移,使用小格子的长和宽??归一化; + +每一个小格子输出B个Bounding box,每一个Bounding box是预测的矩形区域及confidence score +- x,y:目标框的中心相对于划分的小格子中心(bounds of the grid cell?相对于grid cell的中心或左上角好像是没有区别的)的偏移,使用小格子的长和宽归一化,范围也在0-1; - width,height:bounding box的长和宽,使用图像的长和宽归一化; -- confidence:是由两个数字乘积得到的,第一个是该小格子内是否有目标$Pr(object)$,有是1,无是0;第二个是3预测的物体框与标记数据的框的重合面积(intersection over union)$IOU^{truth}_{pred}$(是否归一化??是),这个是输出数据,训练的时候由标记数据与预测框一起计算误差做truth-label,测试的时候没有标记数据时怎么计算??由网络直接输出预测重合面积; +- confidence:是由两个数字乘积得到的,第一个是该小格子内是否有目标$Pr(object)$,有是1,无是0;第二个是预测的目标框与ground truth box的IOU,即$IOU^{truth}_{pred}$,这个是输出数据,训练的时候由标记数据与预测框一起计算误差做truth-label,测试的时候没有标记数据时怎么计算??由网络直接输出预测的IOU,即代表了预测box的置信度。 -每一个小格子的输出还包括C个conditional class probability: +每一个小格子还输出一组C类conditional class probability: > $$Pr(Class_i|Object)$$ 是条件概率,即只有小格子内有目标时,这个概率才会被定义。这里C的大小与B的大小无关。 测试时,输出每个bounding box的class specific confidence score: > $$Pr(Class_i|Object) * Pr(Object) * IOU_{pred}^{truth}=Pr(Class_i) * IOU_{pred}^{truth}$$ 第一项是每个网格预测的类别信息,第二、三项一起组成每个bounding box输出的confidence。 -这样就把问题转换为回归问题,而不再是分类器。具体地网络输出层包括:$7*7*(B*5+C)$维度向量,相当于每个格子输出$B*5+C$维向量。 -### network design -yolo 高仿GoogLeNet的图像分类结构,使用24层卷积,2层全连接, -Fast yolo使用9层卷积 +这样就把问题转换为回归问题,而不再是分类器。具体地网络输出层包括:$7*7*(B*5+C)$维度向量,相当于每个格子输出$B*5+C$维向量。 + +对于输出C如何做标签?由于每个格子输出一组分类信息,所以只有小格子内存在目标框的才有类别标签。 + + +## 2.1 network design +- yolo +高仿GoogLeNet的图像分类结构,使用24层卷积,2层全连接,不过YOLO没有使用Inception结构,而是$1\times 1$卷积和$3\times 3$卷积。 +- Fast yolo +使用9层卷积 + 采用$B=2,C=20$即$7*7*30$维的输出,那么其中每个格子回归坐标的有$2*4=8$维,用于分类的有$20$维 -### training +## 2.2 training 在ImageNet 1000class数据集上进行预训练,预训练网络为yolo的前20层卷积接平均池化、全连接,a single crop top-5 accuracy 88% on ImageNet 2012。 -预训练网络输入为$224\times 224$,修改为目标检测网络时,输入修改为$448\times 448$,bounding box的w、h使用图像的长和宽归一化,bounding box的x、y是offsets of a particular grid cell location,取值范围为$0-1$。 + +预训练网络输入为$224\times 224$,修改为目标检测网络时,输入修改为$448\times 448$,bounding box的w、h使用图像的长和宽归一化,bounding box的x、y是offsets of a particular grid cell location,取值范围为$0\sim 1$。 + 网络最后一层的激活函数是linear activation,其它层的激活函数都是leaky rectified linear activation: > $$\phi(x)=\begin{cases} x &\text{if }{x>0}\\ 0.1x &\text{otherwise}\end{cases}$$ @@ -49,17 +63,30 @@ Fast yolo使用9层卷积 +& \sum_{i=0}^{S^2}\sum_{j=0}^{B} \mathbb{1}_{ij}^{obj}(C_i-\hat{C}_i)^2 \\ +& \lambda_{noobj}\sum_{i=0}^{S^2}\sum_{j=0}^{B} \mathbb{1}_{ij}^{noobj}(C_i-\hat{C}_i)^2 \\ +& \sum_{i=0}^{S^2}\mathbb{1}_{i}^{obj} \sum_{c\in classes}(p_i(c)-\hat{p}_i(c))\end{aligned}$$ -$S^2$表示格子的数目,$B$表示每个格子预测的Bounding box数目,$\mathbb{1}_{i}^{obj}$表示目标是否出现在第$i$个小格子内,$\mathbb{1}_{ij}^{obj}$表示第$i$个小格子需要预测第$j$个Bounding box,即要计入损失, -- $\lambda_{coord}=5$,损失函数中,将8维的定位损失与20维的分类损失的权重看做相等是不合理的,至于为什么是$5$,可以这样理解,每一个小格子预测的$2$个bounding box中只有一个y与ground truth box的IOU最大的那个计入loss,也就是一个格子只有一个$\mathbb{1}_{ij}^{obj}$为$1$,也就是有$4$维的损失,那么$4*5=20$就等于$20$维的分类损失 -- $\lambda_{noobj}=0.5$,一张图像中,只有小部分小格子包含目标,将不包含目标与包含目标的格子的confidence loss权重设置相同,会导致输出趋向于0???。 -- 对不同大小的box预测,相比于大box的长、宽预测偏一点,小box预测长、宽的偏差是更不能忍受的,而sum-squared error loss中对同样的偏差loss是一样的,所以要采取一种方式来增大小box的预测偏差损失的权重,由此产生了对$\sqrt{w},\sqrt{h}$的预测,通过看图可以理解它的作用,这和RCNN中的bounding box regression中的$\log w, \log h$的效果是一样的。 -![sqrt](../image/essay/sqrt.png) ![log](../image/essay/log.png) -- yolo为每个小格子预测多个bounding box,但是训练阶段,作者只让一个bounding box也就是与ground truth box的IOU最大的那个匹配ground truth box。这个称作box predictor的specialization + +$S^2$表示格子的数目,$B$表示每个格子预测的Bounding box数目,$\mathbb{1}_{i}^{obj}$表示目标是否出现在第$i$个小格子内,$\mathbb{1}_{ij}^{obj}$表示在第$i$个小格子的第$j$个Bounding box需要预测,即要计入损失。 +- $\lambda_{coord}=5$,损失函数中,将8维的定位损失与20维的分类损失的权重看做相等是不合理的,至于为什么是$5$,可以这样理解,每一个小格子预测的$2$个bounding box中只有一个y与ground truth box的IOU最大的那个计入loss,也就是一个格子只有一个$\mathbb{1}_{ij}^{obj}$为$1$,也就是有$4$维的损失,那么$4*5=20$就等于$20$维的分类损失。有问题,20维的分类损失是只计算一个的$\log(p_i)$,但是这里使用的是MSE,所以没问题。 +- $\lambda_{noobj}=0.5$,一张图像中,只有小部分小格子包含目标,将不包含目标与包含目标的格子的confidence loss权重设置相同,会导致输出趋向于不包含目标。 +- 对不同大小的box预测,相比于大box的长、宽预测偏一点,小box预测长、宽的偏差是更不能忍受的,而sum-squared error loss中对同样的偏差loss是一样的,所以要采取一种方式来增大小box的预测偏差损失的权重,由此产生了对$\sqrt{w},\sqrt{h}$的预测,通过看图可以理解它的作用,这和RCNN中的bounding box regression中的$\log w, \log h$的效果是一样的。 + +![sqrt](../../image/essay/sqrt.png) +![log](../../image/essay/log.png) +- yolo为每个小格子预测多个bounding box,但是训练阶段,作者只让一个bounding box也就是与ground truth box的IOU最大的那个匹配ground truth box。这个称作box predictor的specialization。 + 训练数据集PASCAL VOC 2007和2012,batch_size为64,动量为0.9,权重衰减项(权重规则化)0.0005,学习率第一个epoch是$10^{-3}$逐渐升到$10^{-2}$,因为开始学习率较大会震荡到发散状态。作者使用了dropout和大量的数据增强操作。 -### inference -### limitation of yolo -## comparsion to other detection systems -## experiments +为了防止过拟合在第一层全连接后采用了dropout层,co-adaption,使用大量的数据增强。 + +## 2.3 inference +NMS + +## 2.4 limitation of yolo +- 严格的空间约束; +- stride=64,导致特征的空间位置粗糙; +- 损失函数将小目标与大目标上的error造成的损失相同看待,但是mAP的计算不是这样的,对于同样的误差大小,小目标的IOU明显会大幅度下降。 + +## 3. comparsion to other detection systems +## 4. experiments + ## tips - 输出层是全连接层,所以输入层的图像大小需要一致。 -- 每个小格子可以输出B个Bounding Box,但是只保留一个$IOU$最大的框为物体检测输出。这意味着每个格子最多只能检测出一个物体。 \ No newline at end of file +- 每个小格子可以输出B个Bounding Box,训练时,保留$IOU^{truth}_{pred}$最大的,预测时,使用阈值和NMS \ No newline at end of file diff --git a/essay/detect/yolo9000.md b/essay/detect/yolo9000.md new file mode 100644 index 0000000..dbda866 --- /dev/null +++ b/essay/detect/yolo9000.md @@ -0,0 +1,83 @@ +# YOLO9000: Better, Faster, Stronger + +[kmeans](https://blog.csdn.net/hrsstudy/article/details/71173305) + +## abstract + +67fps yolov2 76.8mAP on VOC2007 +40fps yolov2 78.6mAP on VOC2007 + +yolov2与yolo9000是两个独立的模型,yolov2是基于yolo改进而得到的。 +yolo9000是由目标检测数据集COCO与图像分类数据集ImageNet联合训练出的,使用联合训练能够使网络检测那些只有分类标签的目标。 + +## introduction + +目标检测数据集 ImageNet, coco, PASCAL VOC +图像分类数据集 Yfcc100m, …… +提出了一种联合数据集(hierarchical view),还有一种联合训练的方法。 + +## better + +yolo-V1相对于其它region proposal的方法,召回率更低,并且通过error analysis,yolo的localization errors较大,所以yolov2着重于改善定位精度与recall,而维持分类精度 +- batch normalization + +在所有卷基层的后面添加BN层,提高mAP **2%**,BN能够起到规则化的作用,所以dropout可以省略; +- high resolution classifier + +大部分检测网络都是使用ImageNet上的预训练好的网络,从AlexNet开始,输入图像的尺寸就小于$256\times 256$,原始的yolo预训练时使用分辨率为$224\times 224$,检测时将图像扩大到$448\times 448$,这意味着预训练的网络需要同时调整适应目标检测任务与适应扩大的输入图像。所以,作者使用$224\times 224$预训练好后,又在ImageNet上使用$448\times 448$进行了10 epoch的分类训练,再拿来训练目标检测任务,这项工作提高了**4%mAP**。 +- convolutional with anchor boxes + +yolo使用卷积特征接全连接直接预测目标bounding box,faster rcnn使用hand-picked priors来预测目标bounding box。这里作者首先移除了一层MaxPool2d,来保证输出特征图更大,同时让输入由$448\times 448$降低为$416\times 416$,这样最后输出的格子是一个奇数$13$,是为了保证当目标较大时,有一个中心格子可以针对这种目标。 + +当使用anchor box时,mAP由69.5下降到了69.2,但recall由81%提高到88%,这样就有了改进的空间。 +使用anchor box会遇到两个问题,1.要人工选择prior box,2.model instability,分别对应以下两点。 +**dimension clusters (dimension指图像的长和宽)** +使用k-means聚类来预定义anchor的尺度,而不是如ssd看做超参数,聚类使用IOU距离,而不是SSE(sum of squared error),这样可以让anchor与ground truth box的IOU最大化; +**direct location prediction** +RPN中的预测方法是 +> $$x=t_x*w_a+x_a;\quad y=t_y*h_a+y_a$$ (1) +由于$t_x,t_y$的预测值是没有限制的,那么预测框可以到达图像的任意位置,导致模型很难收敛。 +所以作者采用了和yolo同样的方法,直接预测相对于grid cell左上角的坐标,这会约束label到$0\sim1$范围内。同时,使用logistic来约束预测到$0\sim 1$范围内。 +网络为每个grid cell预测$5$个bounding box,每个bounding box包含$t_x,t_y,t_w,t_h,t_o$ +> $$\begin{aligned} +b_x &= \sigma(t_x)+c_x \\ +b_y &= \sigma(t_y)+c_y \\ +b_w &= p_w e^{t_w} \\ +b_h &= p_h e^{t_h} \\ +Pr(object)*IOU(b,object) &= \sigma(t_o) +\end{aligned}$$ +其中$p_w,p_h$是bounding box prior(即anchor box)的宽和高。 +使用dimension clusters和location prediction相对于直接使用anchor预测可以改善**5%mAP** +- fine-grained features + +将$26\times 26$的特征图相邻的像素重组到通道上,从而改为$13\times 13$的特征图,通道数变为原来的4倍。通过passthrough layer后,直接concatate到了后面的特征图上,这与ResNet比较相似。改善**1%mAP** +- multi-scale training + +yolov2仅使用了卷积和池化,所以训练时,可以任意改变输入图像的大小,而不需要更改模型。具体是每隔10个batch随机选取一个输入图像尺寸,然后以这个尺寸训练,因为youloV2的输出缩小了$32$倍,所以预设的输入图像大小以$32$为间隔,即$320,352...,608$。 + +## faster + +yoloV1是基于GoogLeNet的结构。 +- darknet-19 +作者提出的分类网络,用于yolov2,yolov2是完全作者设计的19层卷积,主要参照VGG做网络结构设计,大部分采用$3\times 3$卷积,使用$1\times1$做降维,MaxPool2d后扩充通道数为2倍,采用BN。 +- training for classification +学习率初始为0.1,以多项式衰减 power of 4,数据增强,random crops, rotations, hue, saturation, exposure shifts +先在$224\times 224$上训练,再以$448\times 448$为输入做分类微调 +- training for detection +移除最后一层卷积,替换为3层$3\times 3$的卷积,最后使用$1\times 1$的卷积,输出$5*(5+20)=125$维数据(对应125 filters) + +## stronger + +提出了一种在分类、检测数据集上一起进行训练的方法 。 +检测数据集上进行全损失的计算,分类数据集的只进行分类损失的计算。 +当输入带有bounding box标签时,损失函数与YOLOV1一致。? +- hierarchical classification + +## conclusion + +yolov2 a state of the art 更快的目标检测系统, +yolo9000使用ImageNet和COCO联合训练的检测超过9000类目标的检测系统,使用WordTree。 + +## question + +正样本的判断是基于IOU还是基于物体中心所在格子? \ No newline at end of file diff --git a/essay/detect/yolov3.md b/essay/detect/yolov3.md new file mode 100644 index 0000000..c5c4baa --- /dev/null +++ b/essay/detect/yolov3.md @@ -0,0 +1,65 @@ +# YOLO v3: an incremental improvement + +使用FPN解决了小目标检测的问题。 +输入320x320 28.2mAP 在titan X上22ms +AP50: 57.9mAP +[网络结构图](https://blog.csdn.net/qq_14845119/article/details/80335225) +416x416的输入,输出特征图52*52,26\*26,13\*13分别对应stride=8,16,32,对应的anchor大小为kmeans聚类所得的9个anchor(10× 13); (16× 30); (33× 23); (30× 61); (62× 45); (59×119); (116 × 90); (156 × 198); (373 × 326) + +## 2. the deal + +## 2.1 bounding box prediction + +使用均方误差。预测bounding box的x,y,w,h,objectness score + +- x,y: +- w,h: +- 使用逻辑回归预测objectness score(好像只有0,1之分,而没有预测IOU) +> 一个ground truth box只有一个与之IOU最大的anchor box作为正样本,而那些IOU大于0.5的被忽略,其它全部为负样本。 + +## 2.2 class prediction + +不再使用softmax,而使用binary cross-entropy,这样可以很好的处理一个样本多个标签的问题。 + +## 2.3 predictions across scales + +FPN的结构,在3个尺度上做预测,依旧使用K-means对预测框聚类。 +每一个尺度上的预测向量为($80$个类别): +> $$N\times N\times [3\times (4+1+80)]$$ + +## 2.4 feature extractors + +darknet-53 + +在coco数据集上训练了266?。77个epoch,batch_size=64,max_iters=500200 + +yolov2论文上写的是在coco数据集上训练了160epoch,但是github配置文件是266epoch。 + +## work + +- 类似fpn,在三个尺度上进行预测(stride=8\16\32),使用kmeans聚类得到9个聚类中心,每个尺度上预测3种大小的anchor。 +- 替换yolov2中的maxpool(s2)为3x3卷积(s2),使用1x1->3x3添加残差结构,3x3卷积个数往往是1x1卷积个数2倍。 +- 采用残差结构 +- darknet-19->darknet-53 +- multi-scale training +- lots of data-augmentation +- batch normalization +- 分类使用logistic而不是softmax,对应的损失函数是binary cross-entropy loss。 + +## 4. things doesn't work + +- 对x,y使用box宽和高归一化后的的anchor box预测,导致训练不稳定 +- 直接使用线性模型预测x,y而不使用logistic激活函数会导致mAP下降 +- focal loss导致降低2 points。这可能是由于yolo已经存在objectness预测, +- DUAL threshold,像Faster RCNN那样双阈值选取正、负样本,并不能改善训练结果,这里使用单阈值0.5。 + +## assessment + +- yolov3同样存在定位不精准的问题,随着计算mAP时设置的IOU阈值增大,mAP下降幅度比ssd之类大。相对定位不精准,召回率和误检率更重要,大概是工业应用更常用yolo的原因。 +- multi-scale prediction是说使用了三层特征图来做预测输出,而不是使用多个尺度的输入图像,$AP_S$效果较好,$AP_M$和$AP_L$都较差。 + +## tips + +1. dimension clusters + +尺度聚类,即对ground true box 的w和h进行聚类。 diff --git a/essay/essayLIst.md b/essay/essayLIst.md index f81a526..4708da2 100644 --- a/essay/essayLIst.md +++ b/essay/essayLIst.md @@ -1,2 +1,3 @@ [经典论文 deep learning roadmap](https://github.com/songrotek/Deep-Learning-Papers-Reading-Roadmap) -[老师推荐 compuer vision eccv 2016 workshop](http://www.eccv2016.org/workshops/) \ No newline at end of file +[老师推荐 compuer vision eccv 2016 workshop](http://www.eccv2016.org/workshops/) +[模型压缩](https://blog.csdn.net/u014380165/article/details/79811779) \ No newline at end of file diff --git a/essay/face/cmsrcnn.md b/essay/face/cmsrcnn.md new file mode 100644 index 0000000..062c32c --- /dev/null +++ b/essay/face/cmsrcnn.md @@ -0,0 +1,15 @@ +# CMS-RCNN: Contextual Multi-Scale Region-based CNN for Unconstrained Face Detection 2016 + +2018-09-03 20:42 + +人脸检测之后的应用及检测面临的困难 + +``` +unconstrained face recognition, facial periocular recognition, facial landmarking and pose estimation, facial expression recognition, 3D facial model construction + +heavy facial occlusions, extremely low resolutions, strong illumination, exceptionally pose variations, image or video compression artifacts, +``` + +与RCNN系列类似,CMS-RCNN同样包含了RPN与ROI detection分支,不过有两点不同,第一点,两个部分都包含了多尺度信息;第二点,提出的网络结构允许基于人体的背景信息进行人脸的判断。 + +使用VGG-16骨干网络,和Pyramid Box类似,但是性能较差? \ No newline at end of file diff --git a/essay/face/emo.md b/essay/face/emo.md new file mode 100644 index 0000000..4becab7 --- /dev/null +++ b/essay/face/emo.md @@ -0,0 +1,20 @@ +# seeing small faces from robust anchor's prespective + +人脸检测中存在的困难: + +``` + heavy occlusion, extreme pose and low illumination, very small faces +``` + +widerface数据集 + +``` +scale pose occlussion expression makeup illumination +``` + +实验采用ResNet-101做骨干网络,R-FCN作为baseline detector。R-FCN还属于two-stage目标检测。 + +提出了 + +1. Face shift jittering,每一个iteration,图像随机移动 +2. Hard Face Compensation。实验表明使用dilated convolution比upsampling或'skip'结构更能提高AP。 \ No newline at end of file diff --git a/essay/facebox.md b/essay/face/facebox.md similarity index 99% rename from essay/facebox.md rename to essay/face/facebox.md index d0d2d78..941614e 100644 --- a/essay/facebox.md +++ b/essay/face/facebox.md @@ -1,18 +1,30 @@ # faceBoxes: a cpu real-time face detector with hight accuracy + [github](https://github.com/zeusees/FaceBoxes) ## abstract + ## introduction + ## related work + ## FaceBoxes + - anchor 密度定义式 + > $$A_{density} = A_{scale} / A_{interval}$$ 其中,$A_{interval}$就是步长。 + - 损失函数 + 与Faster R-CNN中的RPN损失相同,是2-class softmax与smooth L1损失 + - 训练参数 + SGD,0.0005 权重衰减,batch-size 32,学习率0.001迭代80k次,0.0001迭代20k,0.00001迭代20k次 + ## experiment + ## conclusion num | layer name | kernel size | padding | receptive field | image size | diff --git a/essay/fan.md b/essay/face/fan.md similarity index 88% rename from essay/fan.md rename to essay/face/fan.md index f25946c..817981d 100644 --- a/essay/fan.md +++ b/essay/face/fan.md @@ -1,29 +1,39 @@ # face attention network: an efficient face detector for the occluded faces 2017 + ## abstract + 人脸检测在发生遮挡时依然存在问题,而提高召回率的同时往往会增加误检率。本文提出的FAN,在不牺牲速度的情况下,提高了遮挡情况下的人脸检测。具体的提出新的anchor-level attention(highlight 人脸区域周围的特征),和特定的anchor匹配机制及数据增强方法。 ## introduction + one-shot detection pipeline called face attention network. 使用了RetinaNet中的feature pyramid network提取不同层的特征,来解决尺度问题。对于anchor-level attention,不同特征层使用不同的attention region。 包括三贡献: + 1. 提出anchor-level attention机制来解决遮挡问题 2. 基于RetinaNet提出实际可用的baseline 3. 结合anchor-level attention与RetinaNet的FAN 论文工作可以总结为两个方面: + 1. anchor asign strategy 2. attention ## related work ## face attention network + ssh解决不同层特征融合的问题? S3FD改变anchor匹配策略,来增加召回率 + ### base framework + 将通用目标检测的RetinaNet用在这里检测人脸,RetinaNet的backbone网络是ResNet(有吗?)及FPN。 最后接$KA$个滤波器的卷积输出,$K$表示目标类别数目,这里$K=1$,因为输出是sigmoid激活函数。$A$表示每一个位置的anchor数目,这里$A=6$即一个anchor是一个长宽位置都确定的框。 + ### attention network + - 5层特征用于输出 - aspect ratio是$1$和$1.5$,因为正脸比例是$1:1$,而侧脸比例看做$1:1.5$。 - 作者对widerFace做出统计,$80\%$的人脸在$16\sim 406$,所以设置anchor大小在$16^2\sim 406^2$,过于小的人脸不包含在训练集内。 @@ -31,30 +41,35 @@ S3FD改变anchor匹配策略,来增加召回率 - 正样本$iou>0.5$ - 负样本$iou<0.4$ -attention:使用supervised heatmaps训练一个segmentation分支,预测时使用eponential操作将其与特征图相乘作为目标检测head-network的输入。**有新意**。 +attention:使用supervised heatmaps训练一个segmentation分支,预测时使用eponential操作将其与特征图相乘作为目标检测head-network的输入。**有新意**。 + 在斗鱼上的讲解视频里,作者提到这种segmentation attention并不是他们首创,而是从行人检测领域借鉴过来的,但是在原文中并没有发现相关文献的引用。从视频中获知,作者制作的branch layer wise分割标签是在该层anchor匹配到的groud truth bounding box内填充为$1$,或使用高斯填充,作者发现这两种填充方式对结果影响不大。 数据增强 + - random crop: crop square patch,边长范围在原图短边的$0.3\sim1$之间,保留ground truth box中心在图内的label。 - random flip -- color jitter,仿照S3FD -对于小于$8$像素的人脸,由于在第一层输出上$8$被降采样下只有一个像素,所以训练时略去了这些标签。 +- color jitter,仿照S3FD。对于小于$8$像素的人脸,由于在第一层输出上$8$被降采样下只有一个像素,所以训练时略去了这些标签。 ### loss function + > $$\begin{aligned} L= &\sum_k\frac{1}{N_k^c}\sum_{i\in A_k}L_c(p_i,p_i^*)+ \\ &\lambda_1\sum_k\frac{1}{N_k^r}\sum_{i\in A_k}I(p_i^*=1)L_r(t_i,t_i^*)+\\ &\lambda_2\sum_k L_a(m_k,m_k^*) \end{aligned}$$ 其中, -- $L_c$是focal loss,代表分类损失, -这里$N_k^c$是计入分类损失的anchor数目,包括正、负样本,而focal loss原文中是只计入正样本的数目。 + +- $L_c$是focal loss,代表分类损失,这里$N_k^c$是计入分类损失的anchor数目,包括正、负样本,而focal loss原文中是只计入正样本的数目。 - $L_r$是smooth L1,代表位置回归损失, - $L_a$是pixel-wise sigmoid cross entropy(相当于pytorch中的binary cross entropy loss),代表attention loss。 ## experiment + 使用ResNet50做backbone网络。 ## conclusion + 使用anchor-level attention能够有效降低误检率。 ## tips + 很有创意,很实用,解决问题的方式也很直接,很厉害。不过给的例子里没有出现手的照片,不知道容不容易误检。 \ No newline at end of file diff --git a/essay/face/fddb.md b/essay/face/fddb.md new file mode 100644 index 0000000..4965884 --- /dev/null +++ b/essay/face/fddb.md @@ -0,0 +1,8 @@ +# FDDB + +face detection data set and benchmark ,椭圆标记 +[fddb](http://vis-www.cs.umass.edu/fddb/results.html) + +在2845图像中取了5171张人脸图像,已经读取验证了,图像数目是正确的 + +## 离散ROC、连续ROC有什么异同? diff --git a/essay/face/fdnet.md b/essay/face/fdnet.md new file mode 100644 index 0000000..9c0422c --- /dev/null +++ b/essay/face/fdnet.md @@ -0,0 +1,44 @@ +# face detection using improved Faster RCNN 华为云 2018.02 + +2018-08-27 11:40 +[face detection](https://zhuanlan.zhihu.com/p/35856453) + +Faster RCNN在VOC、COCO数据集上表现良好,本篇文章将其应用于人脸检测,用到了 + +- multi-scale training +- multi-scale testing +- lighted-designed RCNN +- tricks for inference +- a voted-based ensemble method + +取名为FDNet1.0 + +## introduction + +Faster RCNN中,RPN之后,用于refine的特征与输出RPN采用的特征来自同一层特征图。 + +## 3. proposed method + +Faster RCNN性能好,但是two-stage计算量大;RFCN计算量小,但是性能差。 + +### 3.1 light-head Faster RCNN + +提出了一个专为人脸检测设计的light-head Faster RCNN. + +backbone为ResNet-V1-101,步长固定为16,但是这不利于检测尺度变换范围很大的人脸,所以作者在backbone后接了一层**a large kernel-based deformable layer**,同时用于减小特征图的通道数目,最后使用ROI Pooling得到$512\times 7\times 7$的特征图大小,输入到全连接层$2048$。 + +其中deformable layer就是deformable convolution,卷积大小为$512\times 5\times 5$。 + +- anchor 数目$3\times 6=18$及分布 + +aspect ratio: $0.5, 1, 2$ +scale: $16^2, ...., 512^2$,共6个。 + +### 3.2 Multi-scale Training and Testing + +仅仅使用了random flip数据增强。 +没有采用Hard example mining。 +首先删除了没有与任何其它box的IOU大于0.3的proposal box。 + +## 4. experiment + diff --git a/essay/fdwbw.md b/essay/face/fdwbw.md similarity index 99% rename from essay/fdwbw.md rename to essay/face/fdwbw.md index 3d0cfca..dfbee8f 100644 --- a/essay/fdwbw.md +++ b/essay/face/fdwbw.md @@ -1,11 +1,14 @@ # face detection without bells and whistles 2014 ## abstract + 提出了两个优秀的人脸检测方法,1.vanilla DPM,2.与VJ检测框架类似的rigid templates。同时讨论了现有的检测算法评测标准的缺点,并做出改善。 ## introduction + 正因为人脸检测的成熟,作者认为这是一个很好的应用来研究目标检测的核心内容。 贡献: + - 指出现有数据集的评测方法的问题,作者提出一种改善的人脸标记方法,有效的改善了问题。 - 展示了人脸检测依然有很多问题值得探讨。 - 提出vanilla DPM,一个优秀的检测方法 @@ -14,6 +17,7 @@ - 为提出的评测方法及检测算法提供了源代码 相关工作 + - VJ系列 - DPM系列,tree-structured DPM - 使用CNN检测 @@ -23,32 +27,45 @@ ## datasets ## ICF detector + VJ方法的积分图只是作用在灰度通道上,ICF将其推广到图像梯度幅值、方向通道,颜色通道,线性滤波器的输出通道等。 结合多个templates来检测人脸,测试时,所有的templates都被使用,最后使用NMS来把结果融合到一起 + ### Baseline detector + SquaresChnFtrs-5[3],使用了5个模型来检测不同角度的人脸,包括正脸、侧脸 $80\times 80$ 大小 使用了4 rounds of bootstrapping?? + ### detection speed + $640\times 480$图像,在GPU或多核CPU上达到$50Hz$,时间主要耗费在弱分类器的计算上。 ## dpm baseline + DPM5[9] 有$6$个component??比ICF多一个的是正脸的镜像对称的检测器,每一个compoent由一个root template与$8$个part template组成。测试使最后使用NMS,并且阈值选用$0.3$ ## experiments + 已经有论文对ICF检测器的各参数的作用进行了探讨,这个章节讨论检测器的其它部分对性能的影响。 ### how many multi-view components + 当数目达到$5$时,再添加新的component,已经不再改善检测率 ### how much training data + 数量越多,ICF与DPM的性能越好,使用全部数据集,SquaresChnFtrs-5的训练需要$6h$,DPM的训练需要$1$周 ### which color channels + ### how many weak classifiers + 因为Adaboost没有很好的规则化机制,添加更多的弱分类器会导致过拟合。 ### building a strong face detector ## conclusion + VJ与HOG+SVM是两种经典的方法,本篇提出的ICF方法HeadHunter与DPM方法都达到了很好的效果,其中DPM使用很少的数据就能有较好的效果,泛化能力很强。 ## tips + templates、components: 最终的检测器是由多个components组成的,一个components叫一个模型,比如一个专门检测正脸的模型。 \ No newline at end of file diff --git a/essay/gridloss.md b/essay/face/gridloss.md similarity index 99% rename from essay/gridloss.md rename to essay/face/gridloss.md index fc7c75c..bda399b 100644 --- a/essay/gridloss.md +++ b/essay/face/gridloss.md @@ -1,26 +1,33 @@ # grid loss: detecting occluded face 2016 + ## abstract + 遮挡物体的目标检测是一个难题,因为有些只包含部分物体的窗口对于标准CNN网络并没有可区分性。本篇文章为此提出grid loss,它是在特征图的sub-block上降低错误率而不是整幅特征图一起计算损失,能够使检测器对部分遮挡目标有更好的区分度。 通过将损失反向传播回全连接层,计算量并没有增加? ## introduction + boosting, DPM, CNN 被遮挡物体检测是一个难题,因为遮挡后物体可以有更多的变化,也就是更大的类内方差。 grid loss层将卷积分成spatial block,并且在每个spatial block内使用hinge loss进行优化。这导致会学习出大量的不同检测器。 ## related work + - VJ(cascade, decision stump) - boosting(SURF, linear classifier) - DPM() - domain adaption techniques - CNN - ## grid loss for CNNs + 使用滑动窗口的形式进行检测 + ### neural network architecture + 滑动窗口上的分类器是一个卷积网络,结构如下 > $$conv \rightarrow relu \rightarrow LCN \rightarrow conv \rightarrow relu \rightarrow dropout$$ 其中,LCN是local contrast normalization, 为了快速,使用ACF特征作为输入,降采样$4$倍。最后使用非极大值抑制。 + ### grid loss layer \ No newline at end of file diff --git a/essay/face/mtcnn.md b/essay/face/mtcnn.md new file mode 100644 index 0000000..0d3f8d0 --- /dev/null +++ b/essay/face/mtcnn.md @@ -0,0 +1,11 @@ +# Joint Face Detection and Alignment using Multi-task Cascaded Convolutional Networks 2016 kaipeng zhang + +人脸面临着姿势、照明、遮挡等的挑战。本文提出了三阶段的级联结构来检测人脸、预测关键点,同时提出了一个新的难例学习方式。 + +- P-Net(proposal) +- R-Net(refine) +- O-Net(output) + +## architecture + +![network](../../image/essay/mtcnn.jpg) \ No newline at end of file diff --git a/essay/face/pcn.md b/essay/face/pcn.md new file mode 100644 index 0000000..ee68917 --- /dev/null +++ b/essay/face/pcn.md @@ -0,0 +1,16 @@ +# Real-Time Rotation-Invariant Face Detection with Progressive Calibration Networks 2018 + +PCN: progressive calibration networks, PCN由3个stage组成,每个stage都有分类和角度矫正。 + +- data augmentation +- divide and conquer +- rotaion router,先计算人脸候选框的角度,旋转矫正后再做判断。 + +本文作者应该是基于rotation router做的改进,但是考虑到一步计算人脸候选框的角度会异常困难,所以作者采用了progressive的分阶段旋转人脸的方法。 + +第一阶段是180度的旋转,即直接上下翻转,第二阶段是90度的旋转,第三阶段才是角度的精确旋转。 + +每一个阶段后都有分类和位置回归,并且使用NMS。 + + +使用滑动窗口及图像金字塔的方法,使用3个级联的独立网络对每一个窗口做判断,同是带有位置回归及角度修正。 \ No newline at end of file diff --git a/essay/face/pyramidBox.md b/essay/face/pyramidBox.md new file mode 100644 index 0000000..47b1591 --- /dev/null +++ b/essay/face/pyramidBox.md @@ -0,0 +1,56 @@ +# pyramidBox: A context-assisted single shot face detector + +[github官方复现](https://github.com/PaddlePaddle/models/blob/f49ec1d7df259d7498be1b636fdfac17a175af80/fluid/PaddleCV/face_detection/widerface_eval.py) + +## abstract + +意识到context的重要性后,作者在以下三个方面进行改进: + +1. PyramidAnchors. 以半监督的形式,设计新的contextual anchor来学习高层contextual信息? +2. LFPN(Low-level Feature Pyramid Network),使用element-wise product来融合高层网络信息。 +3. 使用context-sensitive结构做人脸的分类 + +使用data-anchor-sampling做数据增强。 + +## 3. pyramidbox + +single shot + +## 3.1 network architecture + +VGG16 和类似S3FD的anchor设计 + +保留conv1-1 -> pool5,将fc6、fc7转成卷积层。 + +- LFPN +观察网络结构和LFPN的名字可以发现,PyramidBox并没有完全采用FPN的结构,而是放弃了最高几层的特征,原因有二:第一,小人脸、模糊人脸、遮挡人脸具有的context特征与大的、清晰的、完整的人脸context特征不同。 第二,高层特征的提取仅有很少的context信息,也有可能引入噪声,比如高层神经元的感受野大于了全图。 + +## 3.2 CPM: Context-sensitive Predict Module + +每个anchor输出20通道,其中$3\times 4=12$通道分别表示face、head、body的定位信息,$2\times 2=4$通道表示head、body的分类信息,剩余$4=cp_l+cn_l$通道表示人脸的分类信息(即channel positive\ channel negative),因为采用了max-in-out,所以并不是$2$。 +> $$cp_l=\begin{cases} 1, \quad \text{if } l=0 \\ +3, \quad \text{otherwise}\end{cases}$$ + +Max-In-Out + +## 3.3 Context-reinforced PyramidAnchors + +head、body的监督信息是由人脸框生成的,而不是人工标注的。并且前向预测时并没有预测head、body,所以不会引入额外的计算量。 + +## 3.4 training + +- widerFace: color distort, random crop, horizontal flip + +- Data-Anchor-Sampling +是一种图像增强的策略,按照anchor大小计算出图像resize的比例。 + +- pyramidBox loss +分了三个类别face、head、body +softmax分类,smoothL1 回归位置 。 + +- optimization +conv_fc6、conv_fc7的初始化参数由VGG16的fc6、fc7降采样得到。 + +![architecture](../../image/essay/pyramid.jpg) + +## tips diff --git a/essay/face/rsa.md b/essay/face/rsa.md new file mode 100644 index 0000000..64c475a --- /dev/null +++ b/essay/face/rsa.md @@ -0,0 +1 @@ +# Recurrent Scale Approximation for Object Detection in CNN 2017 ICCV 商汤科技 diff --git a/essay/face/s2ap.md b/essay/face/s2ap.md new file mode 100644 index 0000000..4ab2c92 --- /dev/null +++ b/essay/face/s2ap.md @@ -0,0 +1,27 @@ +# Beyond Trade-off: Accelerate FCN-based Face Detector with Higher Accuracy 2018 + +当前的人脸检测方法大都是基于FCN结构的,那么如果有一种方法可以加速FCN,那么人脸检测的速度也就相应得到了提高,本论文就提出了S2AP(scale estimation and spatianl attention proposal)和masked-FCN来实现加速。 + +输入图像448x448 + +## S2AP +模型是一个简化的ResNet18,后接scale estimation和spatial attention proposal。 + +- bounding box definition +手工标注的人脸框会有一些主观因素、噪声在里面,而scale estimation对ground truth box的要求又很高,所以作者采用了一种方法,将人脸框同质化了。 +- scale attention +S2AP输出m(=60)个特征图,每个特征图上面只响应一个尺度范围内的人脸。 +- spatial attention +一个人脸首先计算它所属的特征图index,然后在这个特征图上设置标签1,同时,相邻特征图上的标签相融合。 +- unified global supervision +sigmoid cross entropy。 + +## scale-spatial computation unit +根据S2AP输出的m个特征图计算出目标所在的尺度$S_v^b$,人脸中心点的位置$C_b$。 + +## experiments +训练集是从网络上收集的190k张图像,带有人脸bounding box和5个关键点的标注信息。 +S2AP采用简化的ResNet18,而RPN的骨干网络是从输入到res3b3截取的ResNet,由于网络较轻量,采用了图像金字塔的方式作为网络输入。 +> $$1414*2^k(k=0,-1,-2,-3,-4,-5)$$ + +## location guided mask-FCN diff --git a/essay/s3fd.md b/essay/face/s3fd.md similarity index 95% rename from essay/s3fd.md rename to essay/face/s3fd.md index b282e5d..87bff26 100644 --- a/essay/s3fd.md +++ b/essay/face/s3fd.md @@ -1,39 +1,53 @@ # S3FD: single shot scale-invariant face detector 2017 iccv + [论文实验部分写得细致,测试部分有公开代码,很值得学习](https://github.com/lxg2015/SFD) ## abstract + 为解决基于anchor机制的目标检测,对于小目标检测的缺陷 + - 基于感受野大小设计anchor的大小,还有equal proportion interval principle - 通过scale compensation anchor matching策略弥补小目标的召回率 - 通过max-out background label降低小目标的虚警率(false positive) + TiTan X上 36fps for VGA分辨率 ## introduction + 作者分析了anchor based detectors对于小目标检测性能低下的原因: + - biased framework - anchor matching strategy - background from small anchors ## related work + VJ,DPM等传统技术的人脸检测 CascadeCNN,Faceness等基于CNN的人脸检测 Faster R-CNN等将广泛意义目标检测用于人脸检测 ## single shot scale-invariant face detector + ### scale-equitable framework + 选用更多的层做anchor,步长成倍增长包括$4-128$像素,基于有效感受野和等比例间隔原则设计的anchor大小是$16-512$,保证各层的anchor密度是一致的。 基于VGG16设计的网络。 其中normalization layer是什么? -anchor大小的设计考虑到了两个因素,1.步长的大小,2.有效感受野的大小。 -anchor密度归一化后,任何一个anchor内所包含的anchor中心点数量一致。 +anchor大小的设计考虑到了两个因素,1.步长的大小,2.有效感受野的大小。 +anchor密度归一化后,任何一个anchor内所包含的anchor中心点数量一致。 + ### scale compensation anchor matching strategy + 包括两步,1.降低IOU阈值,从$0.5$降到$0.35$,2.以IOU阈值$0.1$,排序选出top-N个anchor + ### max-out background label + 由于增加的小anchor特别多,对应的背景anchor也占大多数,所以模型为background增加了类别输出来稳定模型。 max-out结构: -![maxout](../image/essay/maxout.jpg) +![maxout](../../image/essay/maxout.jpg) ### training + 数据集: 12880 WIDER FACE 数据增强:1.color distort,2.random crop,3.水平翻转,对一张图片三个步骤是连续做的。 损失函数:与Fast RCNN相同,是Multi-task loss,其中分类损失使用正、负样本总数目归一化,坐标回归损失使用正样本数目归一化,同时有$\lambda$来平衡两个损失。 @@ -41,6 +55,7 @@ max-out结构: 训练参数:使用预训练模型初始化参数,使用SGD,动量$0.9$,权重衰减$0.0005$,batch size $32$,学习率前$80k 0.001$,然后$20k 0.0001$,$20k 0.00001$ ## experiment + ## conclusion diff --git a/essay/safd.md b/essay/face/safd.md similarity index 99% rename from essay/safd.md rename to essay/face/safd.md index 4299400..dbf60f7 100644 --- a/essay/safd.md +++ b/essay/face/safd.md @@ -16,7 +16,7 @@ 包括两个stage, 1. global scale proposal,估计图像内存在的所有人脸的尺度,并估计各尺度存在人脸的置信度 2. single scale detection,为每一个判定为有人脸的尺度,做单尺度人脸检测。 -![safd](../image/essay/safd.jpg) +![safd](../../image/essay/safd.jpg) ### scale proposal network CNN接global max pooling的结构,不受输入图像大小、人脸位置的影响,输出固定长度的尺度直方图。 RPN自身包含了一个假设,就是里物体的中心点越近,那个特征图的像素就更应该检测出对应的物体,而SPN没有这个约束,并且通过池化,移除了位置信息,从而对尺度预测更加准确。?? diff --git a/essay/face/scaleFace.md b/essay/face/scaleFace.md new file mode 100644 index 0000000..57428c6 --- /dev/null +++ b/essay/face/scaleFace.md @@ -0,0 +1,27 @@ +# Face Detection through Scale-Friendly Deep Convolutional Networks 商汤科技 唐晓鸥 + +## 三个问题 +1. 给定一个网络的结构(stride确定),该网络最适合的检测目标尺度范围是什么? +图像经过网络降采样后,得到的人脸区域的特征图与roi pooling特征图的尺寸大小匹配时,检测效果最好。 + +2. 给定待检测目标的尺度范围,需要几个网络来完成这个检测? +将待检测目标尺度范围做非均等化分。 + +3. 多个网络最适合的整合方式是什么? + 实验表明,使用共享特征的方式比多个完全独立的检测器的检测效果要好(table 5) + +## training and implementation details + 训练阶段,每个分支有自己独立的训练集。因为是RCNN系列的检测方法,所以每个分支的正负样本也要选择为对应尺度的目标。特定分支特定训练数据的方式可能会造成训练数据不足,所以作者做了数据均衡的操作,但是细节未给出。 + +## model compression +ImageNet上训练分类网络,滤波器剪枝,WiderFace数据集训练检测器 + +## results +widerFace数据集中20%的图像包含的人脸个数大于25,人脸数目比较大,所以作者对这些图像都做了5次copy,同时还做了水平翻转数据增强。 + + +frcnn误检 +> projected ROIs for small faces at the deep layer quickly shrink to 1 x 1, which is much smaller than the ROI pooling size. This projection maps backgrounds and objects to a small region on the feature map and therefore introduces ambiguity to the classifier; + +## tips +如果roi pooling时,proposal box对应的特征小于pooling后的特征,那么roi pooling就相当于上采样的操作,即插值。 \ No newline at end of file diff --git a/essay/face/sface.md b/essay/face/sface.md new file mode 100644 index 0000000..f385f9e --- /dev/null +++ b/essay/face/sface.md @@ -0,0 +1,33 @@ +# SFace: An Efficient Network for Face Detection in Large Scale Variations 2018 ECCV +2018-08-28 10:01 +解决高清图片、视频中存在的人脸检测问题,因为图像分辨率较高,导致图像中的人脸尺度变化范围更大些。作者提出了结合anchor-based 与anchor-free 方法的SFace算法,并收集了一个4K-Face的数据集来衡量算法性能。该算法在WiderFace上性能一般AP大于80%,但速度较快大于50FPS。 + +## introduction +随着手机等高清摄像设备的流行,图像分辨率达到了$3840\times 2160$,人脸尺度在$10\times 10\sim 2000\times 2000$。所以也不能直接把图像缩小再检测,这样小人脸就消失了。 +当前有两种解决尺度问题的方案, +1. 图像金字塔,计算量大,需要对检测结果融合后处理 +2. 特征金字塔,anchor设计,anchor-free方法,如DenseBox,UnitBox。 + +模型基于RetinaNet的结构,使用anchor-based方法检测$32\times 32\sim 512\times 512$的人脸,anchor-free方法检测更大的人脸,并提出一种基于IOU预测结果的rescore方法来融合两路检测结果。 + + +## 3. SFace architecture + +### 3.2 anchor-based branch +共3层输出,每层的基础anchor为16,32,64。 +也使用了IOU-loss,做位置回归。 + +### 3.3 anchor free branch +用于检测anchor不能覆盖的尺度范围。这个分支只有一路接在了stride=16的一层上。 + +使用IOU-loss而不是SmoothL1-loss来回归bounding box。 +IOU-loss出自UniteBox。 + +### 3.4 classification with IOU +因为anchor-based与anchor-free两个分支预测的confidence与location含义并不一致,导致预测结果的融合困难。 + +所以作者调整了两个分支的分类策略,回归prediction box与ground truth box之间的IOU而不是0、1分类,IOU大于0.5的anchor或pixel被看做正样本,但是作者发现直接采用回归效果较差,所以最后还是采用了cross-entropy损失。 + +只对满足IOU大于0.5的正样本做位置回归,两路分支都采用IOU-loss。 + +分类的损失函数还采用了focal loss来平衡正、负样本。 \ No newline at end of file diff --git a/essay/face/srn.md b/essay/face/srn.md new file mode 100644 index 0000000..fa6612d --- /dev/null +++ b/essay/face/srn.md @@ -0,0 +1,13 @@ +# Selective Refinement Network for High Performance Face Detection 2018 ECCV zhangshifeng + +2018-09-26 14:52 + +## receptive field enhancement + +```yaml +RFE modules replaces the middle two convolution layers in the class subnet and the box subnet of RetinaNet。 +``` + +## inference + +输出top-conf-2000高置信度人脸框,使用iou_thresh=0.5进行非极大值抑制,最后每张图片保留top-conf-750个人脸。 \ No newline at end of file diff --git a/essay/face/ssh.md b/essay/face/ssh.md new file mode 100644 index 0000000..6280c6f --- /dev/null +++ b/essay/face/ssh.md @@ -0,0 +1,24 @@ +# SSH: single stage headless face detector 2017 马里兰州大学Maryland +文章题目中的Headless指,使用VGG-16做backbone时,移除VGG的全连接层后,SSH依然达到SOTA水平。这样做的目的是不增加模型计算量、参数量。 + +## introduction + +## related work + +## proposed method +共使用了3层做输出,每层anchor的aspect ratio为1,并且当增加aspect ratio范围时,检测效果并没有变好。 + +### context module +detection module包括context module以增大感受野。 + +> In two-stage detectors, it is common to incorporate context by enlarging the window around the candidate proposals. + +在one-stage目标检测里,增大卷积核大小就相当于增加了two-stage目标检测proposal box的大小,所以这里使用5x5或7x7卷积,而大卷积核是可以通过多层3x3卷积等价替代的。 +实验发现这样mAP可以提高半个点 + +### training +训练阶段,不同层用于检测不同大小范围的人脸。 + +## ablation study(消融实验) +- anchor number +使用较大的anchor数目时,导致运算时间延长,AP下降(主要原因是False Positive number增大) \ No newline at end of file diff --git a/essay/face/stnfd.md b/essay/face/stnfd.md new file mode 100644 index 0000000..f302eb5 --- /dev/null +++ b/essay/face/stnfd.md @@ -0,0 +1,6 @@ +# supervised transformer network for efficient face detection 2016 msra 孙剑 +2018-09-03 19:37 + +## abstract +本文主要解决人脸检测中图像存在严重姿态形变的问题。为此提出了一个cascade CNN的方法,叫做supervised transformer network,第一阶段是RPN网络,做人脸分类的同时预测人脸5个关键点,候选区域之后通过映射将人脸关键点映射到固定位置;第二阶段是一个RCNN网络,判断该区域是否为人脸。 +该网络是完全端到端学习的。为了加速算法,提出ROI convolution。 \ No newline at end of file diff --git a/essay/face/summary.md b/essay/face/summary.md new file mode 100644 index 0000000..36c6f13 --- /dev/null +++ b/essay/face/summary.md @@ -0,0 +1,33 @@ +## widerFace(test-set) + +Model|Backbone | Resolution| easy |medium |hard |Time(ms)| description +---|---|---|---|---|--|---|---|---| +SSH|VGG-16(exclude FC layer) | 400x800 | 92.7|91.5|84.4| 48 +FDNet1.0|ResNet-101|multi-scale| +CMS-RCNN|VGG-16||90.2|87.4|64.3| +PyramidBox|VGG-16||95.6|94.6|88.7| | +SRNfd|ResNet-50||95.9|94.9|89.7|| SRNfd + +## widerFace(val-set) + +Model|Backbone | Resolution| easy |medium |hard |Time(ms)| description +---|---|---|---|---|--|---|---|--| +SSH|VGG-16(exclude FC layer) | 400x800 | +FDNet1.0|ResNet-101|multi-scale|95.9|94.5|87.9 +HR-VGG16 |VGG-16|0.5,1.0,2.0|86.2 |84.4 |74.9 +HR(tinyface)|ResNet-50||90.7|89.0|80.2 +HR(tinyface)|ResNet-101||91.9|90.8|82.3 +PyramidBox|VGG-16||96.1|95.0|88.9| | +SRNfd|ResNet-50|1024x1024?|96.4|95.3|90.2|| SRNfd +DSFD|VGG-16||96.6|95.7|90.4 + +## fddb + +Model|Backbone | Resolution|Time(ms)| description +---|---|---|---|---|--|---|---|--| +facebox||1024x1024 + +[Approaching human level facial landmark localization by deep learning](https://github.com/BobLiu20/FacialLandmark_Caffe) +[TCNN: Facial Landmark Detection with Tweaked Convolutional Neural Networks](https://github.com/BobLiu20/FacialLandmark_Caffe) + +## 人脸检测与通用目标检测的区别 \ No newline at end of file diff --git a/essay/tinyface.md b/essay/face/tinyface.md similarity index 65% rename from essay/tinyface.md rename to essay/face/tinyface.md index 37afc4a..4f657cc 100644 --- a/essay/tinyface.md +++ b/essay/face/tinyface.md @@ -1,33 +1,32 @@ # finding tiny faces 2017 CVPR [比你写的好得多的笔记blog](http://blog.csdn.net/shuzfan/article/details/66971130) - ## abstract 小目标检测依然是个难题,这篇文章从三个方面分析了小人脸检测的问题: - 尺度不变性 - 图像分辨率 - 上下文信息(contextual reason) -对于尺度不变性,作者认为检测3px与检测300px的人脸使用的特征是不同的,所以针对不同大小人脸,训练了不同的检测器。为了保持效率,检测器结合使用同一个网络不同层的特征,是一个Multi-task。 -对于小目标的检测,作者发现上下文信息至关重要,所以提高了templates的大小。最后,作者分析了预训练网络的尺度的影响,并提出一种推断方法来提高它的检测范围的方法。 +对于大部分的工作的目的都是使检测算法具有尺度不变性,而作者认为检测3px与检测300px的人脸使用的特征是不同的,所以针对不同大小人脸,训练了不同的检测器。为了保持效率,检测器结合使用同一个网络不同层的特征(foveal feature),是一个Multi-task。 +对于小目标的检测,作者发现上下文信息至关重要,所以提高了templates的大小。最后,作者分析了预训练网络时的图像尺度的影响,并提出一种推断方式来提高它的检测范围。 AP 82% Wider Face数据集(小目标,且被遮挡目标较多) ## introduction -从客观上讲,依据尺度不变性设计的算法是没有办法解决小目标检测的问题的。 +从客观上讲,依据尺度不变性设计的算法是没有办法解决小目标检测的问题的,按尺度不变性、分辨率、上下文信息三部分展开叙述。 - multi-task modeling of scales -大部分目标检测中使用的分类器的输入都是统一尺寸的,像建立图像金字塔然后滑动窗口的方法,Faster R-CNN中使用Roi pooling来得到统一大小的。那么这个检测模板的大小要如何定呢?往往要顾此失彼,one-size-fits-all的方法并不适用,所以作者想到分别训练检测器来检测大、小目标。然而训练大量的检测器,也会有缺点,如缺失固定目标尺度训练数据,测试时效率低。为此,作者采用了一种multi-task的形式,充分利用不同层的特征。 +大部分目标检测中使用的分类器的输入都是统一尺寸的,像建立图像金字塔然后滑动窗口的方法,Faster R-CNN中使用Roi pooling来得到统一大小的特征。那么这个检测模板的大小要如何定呢?往往要顾此失彼,one-size-fits-all的方法并不适用,所以作者想到分别训练检测器来检测大、小目标。然而训练大量的检测器,也会有缺点,如缺失固定目标尺度训练数据,测试时效率低。为此,作者采用了一种multi-task的形式,充分利用不同层的特征。然而,这样的策略可以提高大目标的检测精度,依然无法解决小目标检测问题。 - how to generalize pre-trained networks -作者验证了预训练好的模型是针对个别大小目标检测的,那么如何从预训练好的模型中获取尺度不变的特征?作者采用了测试时,使用图像金字塔 +作者验证了预训练好的模型是针对个别大小目标的,那么如何从预训练好的模型中获取尺度不变的特征?作者采用了测试时,使用原图像、降采样图像、上采样图像进行多尺度预测。最终,作者的方法是scale-specific detectors应用到了scale invariant(图像金字塔)方式。 - how best to encode context -作者实验表明,人眼对于小目标的识别也是严重依赖于context信息的。并且验证使用来自多层的卷积特征(hypercolumn feature)可以有效捕捉高分辨率的细节与低分辨率的线索信息的(使用大的感受野),这个特征叫做'foveal' feature +作者实验表明,人眼对于小目标的识别也是严重依赖于context信息的。并且验证使用来自多层的卷积特征(hypercolumn feature)可以有效捕捉高分辨率的细节与低分辨率的线索信息(使用大的感受野),这个特征叫做'foveal' feature - 主要贡献 深度分析了图像分辨率、目标大小、上下文信息在检测小人脸时的作用。 ## related work - scale-invariance -大量的工作聚焦于图像的尺度不变特征表达,如SIFT,R-CNN,Faster R-CNN(使用Roi Pool,不同大小的区域使用相同大小的特征向量表示)。作者对scale-variant templates方法进行了深入探讨,SSD就是一种scale-variant templates的方法(但是特征图上的卷积核大小是一样的,这里的variant是指不同的特征图??),templates是啥??这篇文章与SSD不同于使用了上下文信息 +大量的工作聚焦于图像的尺度不变特征表达,如SIFT,R-CNN,Faster R-CNN(使用Roi Pool,不同大小的区域使用相同大小的特征向量表示)。作者对scale-variant templates方法进行了深入探讨,SSD就是一种scale-variant templates的方法(但是特征图上的卷积核大小是一样的,这里的variant是指不同的特征图??),这篇文章与SSD不同于使用了上下文信息 - context -使用大的local context in a scale-variant way +使用大的local context in a **scale-variant** way - multi-scale representation 使用hypercolumns特征,即来自不同层的卷积特征一起构成描述符 - RPN @@ -40,11 +39,11 @@ AP 82% Wider Face数据集(小目标,且被遮挡目标较多) ### context 提出foveal structure feature ### resolution -使用wider face训练的检测器对大目标检测效果很差的原因是,wider face数据集中大目标的数量很少,也就是缺乏大目标训练样本。 +不同大小的人脸检测效果不同,原因不在于训练人脸时,人脸尺寸的分布范围。而是在于预训练网络时,图像中目标的大小。 ## approach: scale specific detection 有没有一种策略能够为特定大小的目标设计特定的检测模板?作者使用的方法是训练不同大小的检测模板,然后在检测结果中选择最好的一个尺度。 -定义一个检测器$t(h,w,\sigma)$,其专门检测$(h/ \sigma,w/ \sigma)$大小的目标,$\sigma =1$表示在原图上做检测,$\sigma=0.5$表示将原图缩小为原来的$\frac{1}{2}$做检测 +定义一个检测器$t(h,w,\sigma)$,其专门检测$\sigma$分辨率图像中$(h/ \sigma,w/ \sigma)$大小的目标,$\sigma =1$表示在原图上做检测,$\sigma=0.5$表示将原图缩小为原来的$\frac{1}{2}$做检测 对于一个给定的数据集,作者使用聚类来选择预设框的尺寸(这里不能这么选的,目标框的大小应该符合高斯分布),聚类使用的Jaccard距离,公式如下 > $$d(s_i,s_j)=1-J(s_i,s_j)$$ 其中$s_i$表示大小为$(w_i,h_i)$的目标框,$J(s_i,s_j)$是jaccard similarity也叫IOU、jaccard index。 @@ -52,11 +51,11 @@ AP 82% Wider Face数据集(小目标,且被遮挡目标较多) - prunning 因为原来的配置对于检测会有重复,所以剪切重复的功能。 ### architecture -![tinyFace](../image/essay/tinyface.jpg) +![tinyFace](../../image/essay/tinyface.jpg) A-type templates用于检测$40-140$px,B-type templates用于检测less than $20$px。虚线部分是可以进行端到端的训练的。 CMS-RCNN同样使用了上下文信息,但是采用的是比例的形式,文中探索了这种方法,但性能有限。 ### details - +正负样本的选择,目标框位置、大小的精修(回归) ## experiments - wider face数据集 使用25个模板,模型HR-ResNet101(A+B),HR表示hybrid resolution。 @@ -80,4 +79,5 @@ CMS-RCNN同样使用了上下文信息,但是采用的是比例的形式,文 - bounding box regression ## tips -template: 模板,相当于滑动窗口方法中的窗口大小;也相当于Faster R-CNN中,将proposal box经Roi Pooling后得到的统一尺寸的大小。 \ No newline at end of file +- template: 模板,相当于滑动窗口方法中的窗口大小;也相当于Faster R-CNN中,将proposal box经Roi Pooling后得到的统一尺寸的大小。 +- multi-task: 好像就是检测不同大小的目标 \ No newline at end of file diff --git a/essay/face/unitebox.md b/essay/face/unitebox.md new file mode 100644 index 0000000..f8aeccf --- /dev/null +++ b/essay/face/unitebox.md @@ -0,0 +1,23 @@ +# UnitBox: An Advanced Object Detection Network 2016 +2018-08-28 11:46 + +## abtract +作者的Insight是,当前目标检测的位置回归网络大都将x,y,w,h单独看待,使用L2 loss回归,但是它们其实是相互关联的,而不是独立的。为此作者提出了IOU loss,可以将这四个参数看做一个整体来做优化。UniteBox也就使用了IOU loss并在当时的FDDB上达到领先水平。 + +## 2. IOU loss layer +这里假设是预测结果类似DenseBox的形式,也就是四条边到预测像素的距离。 + +### 2.1 L2 loss +主要存着两个缺点: +1. 四个预测值完全独立,只要一个预测有问题,就会导致检测结果很差,并且是线性回归。 +2. 定位损失函数受目标大小影响较大,在一个大的ground-truth bounding box内,像素预测时的损失会更大。这种损失不平衡会导致网络倾向于学习大目标的定位,而忽略小目标的定位,所以DenseBox只能采用单个尺度训练,多个尺度预测的方法。 + +### 2.2 IOU loss forward +> $$\mathcal{L}=-\ln(IoU)$$ +IOU loss将四个坐标看做了一个整体,同时自然的忽略目标大小而将IOU归一化到了$0\sim 1$,这样保证了网络可以进行多尺度训练。 + +### 2.3 IOU loss backward + + +## 3. unitbox network +基于VGG-16做的 \ No newline at end of file diff --git a/essay/face/widerface.md b/essay/face/widerface.md new file mode 100644 index 0000000..91e1ebc --- /dev/null +++ b/essay/face/widerface.md @@ -0,0 +1,16 @@ +# widerface + +12880 images +依据edgeBox的检测结果将数据集分为easy, medium, hard,论文中是按场景划分? +评测代码中是按图像中每个人脸的难易检测程度划分的,不过medium包含了easy的所有人脸,对应的,hard包括了medium中的所有人脸。 + +## 评测代码 + +```matlab +error: save: Unrecognized option '-v7.3' +``` + +数据集共有32,203 images, 393,703 labeld faces +40%, 10%, 50%分别作为training, validation, testing sets + +数据集里所有图片宽度已经归一化为1024 \ No newline at end of file diff --git a/essay/facial/aflw.md b/essay/facial/aflw.md new file mode 100644 index 0000000..a8c8f4b --- /dev/null +++ b/essay/facial/aflw.md @@ -0,0 +1,6 @@ +# annotated facial landmarks in the wild(下载需申请,链接中有其他数据库,百度网盘) + +[aflw](https://www.tugraz.at/institute/icg/research/team-bischof/lrs/downloads/aflw/) +[aflw解压工具](http://blog.csdn.net/andeyeluguo/article/details/72875308) +25k幅人脸,每个有21处标记,用于人脸关键点预测(人脸对齐) +most are color, some are gray \ No newline at end of file diff --git a/essay/facial/allinone.md b/essay/facial/allinone.md new file mode 100644 index 0000000..ea98105 --- /dev/null +++ b/essay/facial/allinone.md @@ -0,0 +1,5 @@ +# An All-In-One Convolutional Neural Network for Face Analysis 2016 + +2018-09-26 09:17 + +使用selective search获取候选框,之后crop,resize到$227\times 227$,最后送入到一个MTL(multi-task learning)网络内。 \ No newline at end of file diff --git a/essay/facial/cnninit.md b/essay/facial/cnninit.md new file mode 100644 index 0000000..177f25d --- /dev/null +++ b/essay/facial/cnninit.md @@ -0,0 +1,8 @@ +# A fast Cascade Shape Regression Method based on CNN-based Initialization, 2018, (ICPR) + +1. 使用dlib携带的检测器检测人脸, +2. 使用一个小网络初步预测5个关键点的位置, +3. 使用Radial basis function interpolation在这5个关键点的位置的基础上初始化68个关键点位置, +4. 基于IDF(intimacy definition feature)特征的cascade regresssion + + diff --git a/essay/facial/dcfe.md b/essay/facial/dcfe.md new file mode 100644 index 0000000..1415534 --- /dev/null +++ b/essay/facial/dcfe.md @@ -0,0 +1,19 @@ +# A Deeply-initialized Coarse-to-fine Ensemble of Regression Trees for Face Alignment 2018 (ECCV) + +## introduction + +对于人脸识别、人脸属性分析,人脸关键点检测是一项重要的前驱任务,当下大量的关键点数据集已经大大的促进了关键点检测的研究,但是对于大的姿态变换和脸部存在遮挡的样本,算法仍然有问题。 +在以300W数据集为评测标准的算法中,首当其冲的是一系列以神经网络为基础的算法,这些算法由于每个特征点都有较大的感受野,所以更加鲁棒。但是这些模型很难施加强人脸形状一致性的约束,或者预测存在自身遮挡的情况?。 +基于ERT的方法容易并行化和隐含的施加形状约束,并且更加高效,作者通过实验证明,当具有一个较好的初始化位置时,这些算法的预测依然准确。 + +## related work + +最近二十年,人脸对齐一直是研究热点。最初比较成功的算法是AAM(Active Appearance Model)、3D Morphable Model等生成模型?算法。更新的判别式算法有两个关键点,1.使用shape-indexed featrure,2.级联式回归误差。 + +## Deeply initialized coarse-to-fine ensemble + +feature selection:在输出的热度图上选用FREAK描述子作为特征,构建回归树,每一个关键点都有对应的一张特征图,那么FREAK特征的提取也是在对应的特征图上。 + +## 4.experiment + +160x160->1x1 \ No newline at end of file diff --git a/essay/facial/dlpcnn.md b/essay/facial/dlpcnn.md new file mode 100644 index 0000000..6916aae --- /dev/null +++ b/essay/facial/dlpcnn.md @@ -0,0 +1,7 @@ +# Reliable Crowdsourcing and Deep Locality-Preserving Learning for Expression Recognition in the Wild 2017 CVPR 北京邮电大学 + +DLP-CNN(deep locality-preserving) + +loss: +> $$L = L_s + \lambda L_{lp}$$ +$L_s$表示softmax loss,$L_lp$表示相似损失? \ No newline at end of file diff --git a/essay/facial/dsrn.md b/essay/facial/dsrn.md new file mode 100644 index 0000000..faec2bd --- /dev/null +++ b/essay/facial/dsrn.md @@ -0,0 +1 @@ +# direct shape regression networks for end-to-end face alignment 2018北航 \ No newline at end of file diff --git a/essay/facial/e2e.md b/essay/facial/e2e.md new file mode 100644 index 0000000..437912a --- /dev/null +++ b/essay/facial/e2e.md @@ -0,0 +1,14 @@ +# e2e face alignment + +[e2e](https://github.com/KaleidoZhouYN/e2e-joint-face-detection-and-alignment) + +预测步骤: + +1. 构建图像金字塔; +2. 使用Pnet预测获取检测框、置信度,PNet只有最后一层特征图用于输出; +3. 对金字塔检测结果做非极大值抑制; +4. 获取$64\times 64$的图像块做Onet关键点预测,但是比较奇怪的是没有resize,这里同样使用了anchor来归一化关键点的位置, + +onet中这句源码比较奇怪,卷积生成的特征图为$N\times 16 \times 10$,但是这里只取了第10个预测值,也就取了中间四个中的右下角那个位置的输出。 +t_ldmks = onet(crop_imgs).detach().cpu()[:,10,:].squeeze(1) +[onet](https://github.com/KaleidoZhouYN/e2e-joint-face-detection-and-alignment/blob/f2c29b2e2429ae58d212e9fff38440fa1da5e44e/predict_m.py#L184) diff --git a/essay/facial/emotion.md b/essay/facial/emotion.md new file mode 100644 index 0000000..6ec8baa --- /dev/null +++ b/essay/facial/emotion.md @@ -0,0 +1,25 @@ +# deep facial expression recognition: a survey + +2018-11-30 15:19 + +## 2.facial expression dataset + +dataset|samples|link| +---|----|----|---- +CK+ video| +MMI| |实验室环境下序列图像 +AFEW| +RAF-DB|29672|[link](http://www.whdeng.cn/RAF/model1.html) +ExpW| 91793|使用谷歌搜索下载的91793个人脸,人工标注了7种表情。 + +## 3. deep facial expression recognition + +## 3.1 pre-processing + +- face alignment +- data augmentation +- face normalization(illumination and pose) + +## 3.2 deep networks for feature learning + +## 3.3 facial expression classification diff --git a/essay/facial/esr.md b/essay/facial/esr.md new file mode 100644 index 0000000..bf2c930 --- /dev/null +++ b/essay/facial/esr.md @@ -0,0 +1,46 @@ +# face alignment by explicit shape regression 2012 + +## 2. face alignment by shape regression + +## 2.1 the shape regression framework + +形状回归可以看做gradient boosting regression问题。 + +- mean shape: 平均脸 +- normalized shape: 训练样本通过一个仿射变换矩阵映射到平均脸时,得到的shape + +$M_S$表示由状态$S$到平均脸$\bar S$的变换矩阵,$\hat S$表示样本的真实形状标签。 +求解由normalized shape到mean shape的仿射变换矩阵: +> $$M_S = \arg\min_S{\|\bar{S}-M\cdot S\|_2}$$ +回归器的求解: +> $$R^t=\arg\min_S \sum_{i=1}^{N}\|y_i-R(I_i,S_i^{t-1})\|_2$$ +其中,$y_i=M_{S_i^{t-1}}\cdot(\hat S - S_i^{t-1})=M_{S_i^{t-1}}\cdot\hat S - M_{S_i^{t-1}}\cdot S_i^{t-1}$,即回归的是形状映射到平均脸后的误差。 +那么,测试阶段: +> $$S^t=S^{t-1} + M_{S_i^{t-1}}^{-1}\cdot R^t(I_i,S_i^{t-1})$$ + +作者着重分析了将gradient booting framework应用到人脸关键点检测上的三个问题。 + +1. shape-indexed feature + +2. **regressing the normalized target, 当以normalized shape当做回归目标时(也就是除去了相似变换的作用),任务会简单许多。** + +3. data augmentation and multiple initilizations + +## 2.4 shape-indexed features + +为了减少计算量,我们使用了pixel-difference feature,这种特征非常简单高效。同时为了让这种特征具有两种几何不变性,1.相似变换,缩放、旋转、平移不变性;2.normalized shape,表情、个体差异、3D变换。 + +## 2.5 correlation-based feature selection + +要从$P^2$个候选特征中选出F个,一种做法是minimum regression error,但是由于组合特征数据巨大, + +## 2.6 fast correlation computation + +## 2.7 internal-level boosted regression + +使用random fern。 + +## tips + +[random fern](https://zhuanlan.zhihu.com/p/26461560) +将相似变换改为投射变换会不会更好? \ No newline at end of file diff --git a/essay/facial/falbf.md b/essay/facial/falbf.md new file mode 100644 index 0000000..1f03961 --- /dev/null +++ b/essay/facial/falbf.md @@ -0,0 +1,112 @@ +# Face Alignment at 3000 FPS via Regressing Local Binary Features cvpr 2014 ren shao qing + +[github](https://github.com/luoyetx/face-alignment-at-3000fps.git) +[falbf2](./falbf2.md) + +## 1. introduction + +discriminative shape regression 判别式形状回归? + +这种方法趋于流行,是因为第一,纯粹的判别式方法?,第二,能够自适应的强制形状约束,第三,能够高效的利用大量训练数据。 +形状回归方法以一种cascade的方式预测人脸形状,从$S^0$开始,stage-by-stage的对形状进行调整。 +> $$\Delta S^t=W^t \Phi^t(I, S^{t-1})$$ +其中, + +- I是输入图像 +- $\Phi^t$是特征映射函数,它的输入包括I和$S^{t-1}$,这样提取的特征称为**shape-indexed feature**。 +- $W^t$是一个线性回归矩阵。 + +本文提出了一个更好的特征学习方法,它使用特征的局部约束来规则化学习,进而减弱过拟合。局部约束主要基于两个出发点,对于要定位一个阶段中特定的关键点,1.最具判别性的特征是在上一阶段待估计位置关键点位置的周围,2.人脸的形状(其它关键点位置)和局部关键点特征提供了足够的信息来预测关键点的位置。 +总体的学习过程分为两步: + +1. 为每个landmark学习特有的$\Phi^t$,对于所有stage,各个landmark的$\Phi^t$是不同的的。 +2. 将第一步的各landmark特征拼接到一起,再学习$W^t$。 + +algorithm1 + +```python +for i in landmark_n, landmark loop: + for j in tree_n, tree loop: + select subset of train data + splite_node +``` + +algorithm2: splite_node + +```python +splite_node: + generate feature pair pool, feats_m + for each sample compute feats_m pixel_difference_feature + sort samples along each pixel_difference_feature + for each pixel_difference_feature: + random select a feature as split value + compute variace reduction + save the most reduction feature and feature_value +``` + +## 2. related work + +## 3. Regressing local binary features + +## 3.1 learning local binary features $\Phi^t$ + +使用标准的随机森林回归算法来学习$\Phi^t$,树的分裂点使用**pixel-difference feature[1]** + +关键点特征提取的最优半径是通过交叉验证(cross validation)得到的 + +## 3.2 learning global linear regression $W^t$ + +在3.1中学习到的局部$w^t$被舍弃,只用特征,在这一步学习全局的$W^t$。 + +## 3.3 局部约束原则 + +为什么使用局部区域? + +为什么要用单个关键点回归? + +## 4. experiments + +datasets: + +- LFPW +- Helen +- 300-W + +trainset由AFW,LFPW的训练集,Helen的训练集组成,共3148张图片。 +testset由IBUG,LFPW的测试集,Helen的测试集促成,共689张图片。testset又分为chanllenge和common,common由Helen、LFPW两者的测试集组成,chanllenge由IBUG构成。 + +evaluation metric: +使用瞳孔归一化距离误差来评估性能。 + +stage的数目是超参数,所以各个stage的$\Phi^t, W^t$是不同的。 + +## 4.1 comparison with state-of-the-art methods + +在测试阶段使用**mean shape**作为初始化位置 + +论文中有两种配置: + +1. more accurate, stage_n=5, Depth=7, the number of trees in each stage=1200 +2. faster, stage_n=5, Depth=5, the number of trees in each stage=300? 不同关键点的树数目不同? + +准确度比较,速度比较 + +## 4.2 validation of proposed approach + +全局学习与局部学习的比较? + +树二值特征与局部森林回归特征比较? + +## tips + +[1][face alignment by explicit shape regression](./esr.md) + +## improvement + +[A fast Cascade Shape Regression Method based on CNN-based Initialization, 2018, (ICPR)](./cnninit.md) +[A Deeply-initialized Coarse-to-fine Ensemble of Regression Trees for Face Alignment 2018 (ECCV)](./dcef.md) +[Cascaded Face Alignment via Intimacy Definition Feature](./idf.md) + +## code annotation + +相似变换的求解? \ No newline at end of file diff --git a/essay/facial/falbf2.md b/essay/facial/falbf2.md new file mode 100644 index 0000000..0ffa5f0 --- /dev/null +++ b/essay/facial/falbf2.md @@ -0,0 +1,9 @@ +# Face Alignment via Regressing Local Binary Features 2016 RenShaoQing + +这篇文章和2014年的[lbf3000fps](./falbf.md)相比多了人脸检测框准确度对关键点检测影响的分析,然后多了一些细节。 + +## normalizing regression target + +将$\hat S-S_{t-1}$当做回归目标虽然比较直接,但其中掺杂着仿射变换的自由度,所以作者认为应该先使用$S_{t-1}$的归一化仿射变换矩阵的逆矩阵将$\Delta_{shape}$变换下,会降低任务的复杂度。而在测试阶段,每次都使用$S_{t-1}$的仿射变换矩阵将预测的$\Delta_{shape}$变换后再加到$S_{t-1}$上。 + +这里作者只使用了尺度和旋转变换,而没有平移是为了什么? diff --git a/essay/facial/fan.md b/essay/facial/fan.md new file mode 100644 index 0000000..65667e9 --- /dev/null +++ b/essay/facial/fan.md @@ -0,0 +1,9 @@ +# how far are we from solving the 2D&3D face alignment problem 2017 + +[code](https://github.com/1adrianb/face-alignment) + +HourGlass模型,预测heatmap方式 + +## 4. method + +FAN(face alignment network) \ No newline at end of file diff --git a/essay/facial/hyperface.md b/essay/facial/hyperface.md new file mode 100644 index 0000000..19c605f --- /dev/null +++ b/essay/facial/hyperface.md @@ -0,0 +1,19 @@ +# HyperFace: A Deep Multi-task Learning Framework for Face Detection, Landmark Localization, Pose Estimation, and Gender Recognition + +2018-10-15 15:54 + +一个集检测、关键点定位、头部姿态估计(raw\pitch\yaw)、性别识别功能为一体的网络。包含两个变体,1.HyperFace-ResNet,2.Fast-HyperFace + +## 3. hyperface + +### 3.2 training + +face detection: 使用selective search获取人脸box。 + +## 4. Network architecture + +作者首先验证如果不采用Multitask的形式训练,结果会较差。及五个独立的模型RCNN_face、RCNN_Fiducial ……,并没有Multitask的好。 + +## tips + +使用 \ No newline at end of file diff --git a/essay/facial/idf.md b/essay/facial/idf.md new file mode 100644 index 0000000..3e307be --- /dev/null +++ b/essay/facial/idf.md @@ -0,0 +1,5 @@ +# Cascaded Face Alignment via Intimacy Definition Feature 2017 + +## intimacy definition feature 基于亲近度的特征 + +此处随机森林的构建与lbf3000fps类似,基于信息增益选择最优的树分裂值,在森林构建完成后,特征的编码不再是01的形式,而是基于树节点的距离来编码的。 diff --git a/essay/facial/jointly.md b/essay/facial/jointly.md new file mode 100644 index 0000000..403601e --- /dev/null +++ b/essay/facial/jointly.md @@ -0,0 +1,6 @@ +# A Jointly Learned Deep Architecture for Facial Attribute Analysis and Face Detection in the Wild 2017 fudan + +2018-09-26 09:31 + +在野外场景中的人脸属性分析是异常困难的,因为环境更为混乱。已有的人脸属性分析工作大都是基于已经检测好的人脸,那么它的结果就非常依赖于人脸检测的结果,本篇文章将属性与检测结合到同一个框架,达到了STOA的水平。 +CelebA, LFWA \ No newline at end of file diff --git a/essay/facial/lab.md b/essay/facial/lab.md new file mode 100644 index 0000000..28a5bf6 --- /dev/null +++ b/essay/facial/lab.md @@ -0,0 +1,5 @@ +# Look at Boundary: A Boundary-Aware Face Alignment Algorithm 清华、商汤、亚马逊 CVPR 2018 + +- 为什么应用边缘? +- 如何应用边缘? +- 边缘估计与关键点定位什么关系? \ No newline at end of file diff --git a/essay/facial/summary.md b/essay/facial/summary.md new file mode 100644 index 0000000..862aef5 --- /dev/null +++ b/essay/facial/summary.md @@ -0,0 +1,5 @@ +# summary + +- 表情识别综述-2018 + +[A Survey to Deep Facial Attribute Analysis](https://arxiv.org/abs/1812.10265) \ No newline at end of file diff --git a/essay/facial/survey.md b/essay/facial/survey.md new file mode 100644 index 0000000..b03e0b1 --- /dev/null +++ b/essay/facial/survey.md @@ -0,0 +1,39 @@ +# facial landmark detection a literature survey 2018 + +2018-11-30 14:38 + +## 2 holistic methods + +### 2.1 active appearance model(AAM) + +AAM是一个概率模型,使用几个参数表示整个人脸的面部特征和轮廓形状。 + +### 2.2 active shape mdoel(ASM) + +## 3 constrained local methods + +cascaded pose regression(CPR) +explicit shape regression(ESR) + +## 4 regression-based method + +### 4.1 direct regression methods + +- local approaches +- global approaches + +### 4.2 cascaded regression methods + +- [esr](./esr.md) +- [falbf](./falbf.md) + +### 4.3 deep-learning based methods + +- pure-learning methods +- hybrid methods + +- FAN,预测heatmap方式 + +### 4.4 discussion + +cascaded regression一般优于direct regression,次于cascaded regression with deep learning。 diff --git a/essay/facial/wing.md b/essay/facial/wing.md new file mode 100644 index 0000000..9f75a9f --- /dev/null +++ b/essay/facial/wing.md @@ -0,0 +1,5 @@ +# wing loss for robust facial landmark localizations 2018 + +## 7.2.2 300w + +数据集的组成成份讲解详细。 \ No newline at end of file diff --git a/essay/bnn.md b/essay/faster/bnn.md similarity index 100% rename from essay/bnn.md rename to essay/faster/bnn.md diff --git a/essay/faster/faster.md b/essay/faster/faster.md new file mode 100644 index 0000000..aadecd7 --- /dev/null +++ b/essay/faster/faster.md @@ -0,0 +1,32 @@ +# cell phone cpu + +腾讯优图开源的 ncnn +百度开源的 +微软开源的c++并行计算库 ppl + +英特尔开源的c++并行计算库tbb +[英特尔开源的neno](https://github.com/NervanaSystems/neon) + +## facebook flashlight + +[github](https://github.com/facebookresearch/flashlight) +[tutorial](https://fl.readthedocs.io/en/latest/) +[arrayfire](http://arrayfire.org/docs/gettingstarted.htm) + +## prune + +归一化 +排序 +剪枝 +参数如何保存?每一次前向传播都置为0? + +## net summary + +net| trainset| classify(acc top-1 224x224) | detect(coco mAP 0.5:0.95) | classify(Multi-adds) | detect(coco Multi-adds) | inference time() +---------|---------|--------|-----------|--------------|-------|----- +peleeNet |train+val| 71.3% |22.4(test-dev2015)、24.3(minival) (304x304) epoch=106| 1.018B | 2.58B | +mobileNetV1-ssd||70.6% | 19.3(minival) (300x300)| 1.138B| 2.4B +mobileNetV1+SSDLite|trainval35k| -| 22.2(test-dev) (320x320) | -| 2.6B| +mobileNetV2+SSDLite|trainval35k|71.7% | 22.1(test-dev) (320x320) | 0.6B | 1.6B|600x600 titanx 27ms +shift-Net| || | 1.21B| +shift-Net| |71.76%|(300x300)|0.74B|1.9B diff --git a/essay/faster/mobileNetV1.md b/essay/faster/mobileNetV1.md new file mode 100644 index 0000000..0925229 --- /dev/null +++ b/essay/faster/mobileNetV1.md @@ -0,0 +1,57 @@ +# mobileNets: efficient convolutional neural networks for mobile vision applications 2017 +## abstract +提出了depth-wise separable convolutions来减少计算量,并引入两个超参数来平衡速度、准确率。 + +第一输出层接到了stride=16后的层(conv5_5, conv5_6的stride=2) + +## introduction +一个有效的网络架构,和两个超参数(width multiplier,resolution multiplier) + +## prior work +以前做小而有效的网络工作可以分为两类,1.压缩已经训练好的模型,2.设计更小的网络来训练。这篇文章主要为了提高速度,模型大小是次要的。 + +## mobileNet architecture +共有$28$层, 有$13$层depthwise separable convolution,depthwise与pointwise分开计算就是$26$层,再加上第一层(普通卷积层),最后一个全连接输出层,就得到$28$层。 +有$5$个$\text{stride}=2$ depthwise卷积层,将$224\times 224$的输入变为$7\times 7$的输出($1024\text{ channel}$),最后使用全局均值池化。 + +### depthwise separable convolution +也就是对于输入特征图$W_i\times H_i\times C$,有$C$个卷积,分别一一对特征图的通道做卷积,最后输出$W_o\times H_o \times C$ +之后又做pointwise convolution,即$1\times 1$大小的标准卷积。 + +### network structure and training +除了输出全连接层,所有的层后都有Batchnorm和ReLU。 +把depthwise和pointwise convolution分开计算,MobileNet共有$28$层。 +标准卷积块|MobileNet卷积块 +-------|-------- +$3\times 3$ Conv | $3\times 3$ Depthwise Conv +BN | BN +ReLU | ReLU + - | $1\times 1$ Pointwise Conv + - | BN + - | ReLU +因为小模型,更不容易过拟合,所以这里训练时, 采用较少的数据增强,**没有或者采用很弱的规则化(L2 regularization)**。 +使用RMSProp优化算法,采用异步梯度下降? +### width multiplier: thinner models +使用参数$\alpha$表示,表示输入、输出特征图的通道数乘以系数$\alpha\leqslant 1$,是在baseline MobileNet的基础之上计算的。计算量和参数量会降到原来的$\alpha^2$ +### resolution multiplier: reduced representation +改变输入图像及中间计算过程计算图的大小,乘以参数$\rho\leqslant 1$,降低计算量为原来的$\rho^2$ + +## experiments +作者实验发现 +1. 窄的网络比浅的网络效果更好,这说明深度很重要。 +2. ImageNet分类准确率效果与计算量和参数两者都呈现了$\log$函数的关系。 + +- object detection +输入图像为$300\times 300$,在coco的train+val上进行训练,使用8k minival做测试 +- face embeddings +FaceNet + +## conclusion +- less regularization +- less data augmentation: 因为模型比较小,所以不容易过拟合,也就采用了更少的数据增强。 +- less or no weight decay on depthwise filters + +## tips +label smoothing ? used in inceptionV3 + +预测输出特征图尺度是$19,10,5,3,2,1$ diff --git a/essay/faster/mobileNetV2.md b/essay/faster/mobileNetV2.md new file mode 100644 index 0000000..29b1816 --- /dev/null +++ b/essay/faster/mobileNetV2.md @@ -0,0 +1,61 @@ +# inverted residuals and linear bottlenecks: mobile networks for classification, detection and segmentation + +## abstract +目标检测应用:SSDLite,网络结构与V1中的一致,只是内部所有3x3卷积全部换成了depth-wise separable convolution。 + +shift头网络能提高性能,是因为使用depth-wise convolution可以在保证计算量与V1中的一致的情况下,提高通道数,从而提升性能。 + +语义分割应用:Mobile DeepLabV3 +MobileNetV2的inverted residual structure是指与residual network中的bottleNet相反的结构,它的中间层通道数更大,而输入输出层的通道数更少。 + +MobileNetV2结构在narrow layers(通道数较大的输入和通道数较少的输出)移除了非线性激活函数,因为作者发现这会使信息发生损失,造成性能下降。 + +允许从transformation的特征表达(expressiveness)中解耦出输入输出(capacity)? + +衡量accuracy、multiply-adds(计算量)、parameter number(model size) + +## introduction +提出了inverted residual with linear bottleneck(线性瓶颈的反向残差结构?) + +## related work + +## preliminaries(预赛), discussion and intuition +### depthwise separable convolutions +### linear bottlenecks +激活函数的输出张量可以看做是$w\times h$的$d$维像素的容器,本节讨论这些张量的基本属性。激活函数的输出张量形成了"manifold of interest"。 + +[manifold,流形学习](https://www.zhihu.com/question/24015486) + +expansion ratio: ratio between the size of input bottleneck and the inner size +### inverted residuals + +### information flow interpretation +一个有趣的特性是这个结构将building block的输入输出与layer transformation做了一个自然的分离。 + +## experiments +- ImageNet +decay=0.9, momentum=0.9, weight_decay=0.00004, initial_lr=0.045, lr_decay_rate=0.98 per epoch +- Object Detection +SSDLite: 在predict layer替换所有的规则卷积为depthwise separable卷积 +mobileNet V1 + SSDLite 22.2 效果优于 mobileNet V1 + SSD 19.3 为什么?输入图像由300x300变为了320x320。 + +- segmentation +使用MobileNet做为DeepLabv3的feature extractors,该网络使用atrous convolution控制输出特征图的分辨率,atrous结构与普通卷积中的dilation选项的结构不同? + +$17$个BottleNeck, 3个普通卷积 + +## official code +> + anchor_generator { + ssd_anchor_generator { + num_layers: 6 + min_scale: 0.2 + max_scale: 0.95 + aspect_ratios: 1.0 + aspect_ratios: 2.0 + aspect_ratios: 0.5 + aspect_ratios: 3.0 + aspect_ratios: 0.3333 + } + } +https://github.com/tensorflow/models/blob/9057a3a13bfea909e1b94d051e9fa47436f82f20/research/object_detection/samples/configs/ssdlite_mobilenet_v2_coco.config#L32 \ No newline at end of file diff --git a/essay/mobilenet.md b/essay/faster/mobilenet.md similarity index 100% rename from essay/mobilenet.md rename to essay/faster/mobilenet.md diff --git a/essay/faster/odmobile.md b/essay/faster/odmobile.md new file mode 100644 index 0000000..06ef0d8 --- /dev/null +++ b/essay/faster/odmobile.md @@ -0,0 +1,25 @@ +# +提出了light flow, a flow-guided GRU module。 + +## video object detection baseline +静态图像中的目标检测分为两个步骤 +1. 为全图提取特征, +> $$\mathcal{N}_{feat} (I)=F$$ +2. 基于特征进行检测,分为sparse object proposals和dense sliding windows两种检测方式 +> $$\mathcal{N}_{det} (F)=y$$ + +视频目标检测 +1. sparse feature propagation implied by feature flow +> $$\mathcal{N}_{flow}(I_k,I_i)=M_{i\rightarrow k}$$ +关键帧只是普通的第几帧,并没有一个具体的判断算法 +2. flow-guided feature aggreation(FGFA) +> $$\hat{F}_i=\sum_{k\in[i-r,i+r]} W_{k\rightarrow i} \odot F_{k\rightarrow i}$$ +要用到当前帧的前面几帧和后面几帧? +为了减少计算量,这个也是稀疏的。 + +设计原则 +1. sparse feature propagation +2. multi-frame feature aggreation + +## in context of previous work on mobile +结合使用了light-head RCNN diff --git a/essay/faster/peleeNet.md b/essay/faster/peleeNet.md new file mode 100644 index 0000000..82988b1 --- /dev/null +++ b/essay/faster/peleeNet.md @@ -0,0 +1,18 @@ +# peLee: A real-time object detection system on mobile devices +## abstract +当前没有depthWise卷积的高效实现,所以作者提出了一个基于普通卷积的高效模型peLeeNet。 +17.1fps on iPhone6s +23.6fps on iphone8 + +## introduction +PeleeNet是DenseNet的一种变体。 +$304\times 304$做输入,选用$19,10,5,3,1$共$5$个特征图做预测输出,但是其中$19x19$后接了两个预测输出。 + +什么是transition layer?又为$1\times 1$卷积起了个新名字 + +对于论文中目标检测的优化,提到使用$5$层特征图输出(MobileNet-ssd中采用6层做输出,不过多出的一层是$2\times 2$的,影响应该不大),预测前接一个Residual Block,使用$1\times 1$卷积核做预测(已经在MobileNet-ssd中采用)。 + +## tips +什么是pre-activation、post-activation?分别是BN前激活和BN后激活? + +$21$个denseBlock,1个stemBlock,1个全连接。 \ No newline at end of file diff --git a/essay/faster/pvanet.md b/essay/faster/pvanet.md new file mode 100644 index 0000000..387014f --- /dev/null +++ b/essay/faster/pvanet.md @@ -0,0 +1,14 @@ +# PVANET: Deep but Lightweight Neural Networks forReal-time Object Detection 2016 Korea +基于"less channels with more layers"的理念设计Backbone网络。 + +网络设计借鉴了 +- C.ReLU +- Inception +- HyperNet + +训练时使用 +- batch normalization +- residual connection +- learning rate scheduling-based on plateau detection + +C.ReLU的设计是基于早期阶段的网络参数大都是互相补充的事实。 \ No newline at end of file diff --git a/essay/faster/run.md b/essay/faster/run.md new file mode 100644 index 0000000..64f32e9 --- /dev/null +++ b/essay/faster/run.md @@ -0,0 +1,10 @@ +# [residual features and unified prediction network for single stage detection](https://github.com/kmlee-snu/run) + +fpn虽然可以改善检测精度,但同时影响了one stage检测速度快的优势 + +存在deconvolution操作 + +## residual feature and unified prediction network(RUN) +SSD中的conv4_3层加入L2-normalization的原因是ParseNet中提到的。normalization会对反向传播时的梯度做抑制? + +没看到unified prediction network的具体结构。 \ No newline at end of file diff --git a/essay/faster/shiftNet.md b/essay/faster/shiftNet.md new file mode 100644 index 0000000..12edd17 --- /dev/null +++ b/essay/faster/shiftNet.md @@ -0,0 +1,27 @@ +# shift: A zero FLOP, zero parameter alternative to spatial convolutions +zero FLOP: 没有浮点计算,因为只是位置偏移。 +zero parameters: 位置偏移量是初始化时生成的,不是可学习参数。 + +- 参数量减少, +- 计算量减少,计算时间减少 + + +external memory访问一次耗费energy是一次数学运算的几千倍 + +有$5$个$stride=2$,第一个是第一层普通卷积,其余四个是通过pooling层来操作的。 + +shift描述,将$3\times3$卷积分解为两个步骤 +1. shift操作,滤波器矩阵$K(3,3,c,n)$,每$K(3,3,c/9,n)$分配一个偏移量。 +2. $1\times1$卷积 + +## discussion +理想的channel分配是: +1. shift group内不应该存在重复的特征,可以通过分析相关矩阵来估量。 +2. 每一个shift后的特征对输出都应该有较大的贡献 + +## question +1. CNN里怎么样算一次memory access?对于CPU & GPU有没有区别? +完全就是数据,比如参数量、输入特征图大小、输出特征图大小 +2. 4K image segmentation + + diff --git a/essay/faster/shiftNetV2.md b/essay/faster/shiftNetV2.md new file mode 100644 index 0000000..252463b --- /dev/null +++ b/essay/faster/shiftNetV2.md @@ -0,0 +1,6 @@ +# Constructing Fast Network through Deconstruction of Convolution +2018-09-13 23:27 + +对上篇文章的改进,使用了可学习的偏移量,而不是参数初始化时就决定的偏移量。 + +如果偏移量是浮点数,那么通过双线性插值得到的特征是可以反向传播的。但是如果是整数,那么是如何取整的? diff --git a/essay/faster/shuffleNet.md b/essay/faster/shuffleNet.md new file mode 100644 index 0000000..a6bc9d0 --- /dev/null +++ b/essay/faster/shuffleNet.md @@ -0,0 +1,13 @@ +# ShuffleNet: An Extremely Efficient Convolutional Neural Network for Mobile Devices cvpr 2018 旷世科技 +为计算资源有限的设备设计了一个新的高效CNN结构,这个结构使用了pointwise group convolution和channel shuffle来降低计算量。 + +借鉴了ResNet、Xception-like、ResNeXt。 + +## approach +channel shuffle也是可以微分的? +主要是对1x1卷积也使用了group操作,为了让通道之间有交互,又加入了channel shuffle操作。 +> $$(g*n,h,w) \rightarrow (g,n,h,w) \rightarrow (n,g,h,w) \rightarrow (n*g,h,w) $$ + +## hyper parameters +- scale factor:通道数改变因子,相对于列表中的设置。 +- group: 1x1卷积中分的组数 \ No newline at end of file diff --git a/essay/faster/srn.md b/essay/faster/srn.md new file mode 100644 index 0000000..a041ce6 --- /dev/null +++ b/essay/faster/srn.md @@ -0,0 +1 @@ +# Selective Refinement Network for High Performance Face Detection 2018.9.7 ECCV zhangShiFeng,ChengChi,中科院 diff --git a/essay/faster/summary.md b/essay/faster/summary.md new file mode 100644 index 0000000..eb780db --- /dev/null +++ b/essay/faster/summary.md @@ -0,0 +1,8 @@ +Model|Backbone|resolution|MAdds|Params|ImageNet-|coco| +----|----|----|----|----|----|-----|----|-----|----|--- +MobileNet-V1| +MobileNet-V2| +shuffleNet-V1| +shuffleNet-V2| +peleeNet| +shiftNet| diff --git a/essay/faster/survey.md b/essay/faster/survey.md new file mode 100644 index 0000000..7b239f2 --- /dev/null +++ b/essay/faster/survey.md @@ -0,0 +1,26 @@ +# Recent Advances in Efficient Computations of Deep Convolutional Neural Networks 2018 +有存储量大和计算量大两个缺点,解决方法有 +1. network pruning +该方法在深度学习流行以前就有研究,不过它有个假设就是神经网络的大部分参数不重要或不是必须的。根据修剪的粒度,该方法可以分为fine-grained pruning,vector-level pruning,kernel-level pruning,filter-level pruning。修剪后,参数tensor会变得稀疏。 +2. low-rank approximation +使用SVD分解,将大权重矩阵分解为两个小矩阵 +Block Term Decomposition +CP Decomposition +3. network quantization +分为标量或矢量量化、固定点量化 +4. teacher-student network +知识蒸馏(knowledge distillation) +5. compact network design +mobileNet、shuffleNet、squeezeNet + +参数量主要分布于全连接层,计算量主要分布在卷积层 + + +## trends +1. 无监督压缩 +当前存在的压缩方法如网络剪枝、低秩压缩、网路量化,在压缩后,往往需要重新训练以保持原网络的性能。这样面临两个问题,带标签数据、训练模型的专业技能。 +2. 自适应压缩 +当前的压缩方法有很多超参数,如网络剪枝的稀疏度、低秩压缩的秩、fixed-point量化的位数,这些超参数的选择会很困难,那么需要退火方法或增强学习来决定这些超参数。 +3. 专用于目标检测的模型压缩 +当前的方法大都是对分类网络展开的压缩,然而这些方法可能并不适用于目标检测、语义分割。 +4. 软硬结合的压缩方案。 diff --git a/essay/gan.md b/essay/gan.md deleted file mode 100644 index 769995b..0000000 --- a/essay/gan.md +++ /dev/null @@ -1,12 +0,0 @@ -[gan集合](https://deephunt.in/the-gan-zoo-79597dc8c347) -[gan超分辨率](https://yq.aliyun.com/articles/277845) - -# generative adversarial nets -## abstract -为估计generative model提出了一个新的框架,它包括两个模型,一个捕获数据分布的生成模型G,一个判别样本是来自于训练数据还是模型G的判别式模型D。模型G训练的目标是让D识别不出样本的来源。当G和D是多层感知机时,可以通过SGD来训练。 - -## introduction -深度学习的希望在于发现实际产品在应用过程中,遇到的数据的概率分布,如图像、语言。但是到目前为止,重要突破只在于判别式模型,将高维数据映射到低维的标签变量上。深度生成模型的受到的影响很小,关键在于,很难近似极大似然估计和相关策略中的概率计算,也很难使用分段线性激活函数的优点。本篇的GAN能够避开这些缺陷。 -本文中,G和D都是多层感知机。 叫做adversarial nets。 - -## related work \ No newline at end of file diff --git a/essay/gan/cgan.md b/essay/gan/cgan.md new file mode 100644 index 0000000..1696baa --- /dev/null +++ b/essay/gan/cgan.md @@ -0,0 +1,10 @@ +# conditional generative adversarial nets + +## abstract +将data和label同时输入进生成器和判别器。 + +## introduction +在unconditioned版本的GAN中,对生成数据的模式是没有要求的。但是,通过添加附属信息,可能可以引导生成器的生成过程,附属信息可以是类标签。 + +## 模型 +生成器、判别器的输入都存在额外的信息。 \ No newline at end of file diff --git a/essay/gan/cyclegan.md b/essay/gan/cyclegan.md new file mode 100644 index 0000000..a275fe7 --- /dev/null +++ b/essay/gan/cyclegan.md @@ -0,0 +1,4 @@ +# Unpaired Image-to-Image Translation using Cycle-Consistent Adversarial Networks + +## idea +pix2pix那篇文章训练时,需要成对的图片输入到判别器,然而现实世界中这种成对的图片很少,所以本文提出使用unpaired image-to-image的方法。 \ No newline at end of file diff --git a/essay/gan/dcgan.md b/essay/gan/dcgan.md new file mode 100644 index 0000000..20128ca --- /dev/null +++ b/essay/gan/dcgan.md @@ -0,0 +1,25 @@ +# DCGAN:Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks +## abstract +基于CNN的有监督学习已经取得了很大的成功,相对的,基于CNN的无监督学习受到了很少的关注,本篇文章希望弥补其中的差距,提出了DCGAN,并且提供了证据证实生成器与判别器都学习到了目标局部及场景的层次表达。 + +## approach and model architecture +作者也是在尝试了大量的模型结构后,才总结出规律。 +1. 在生成器、判别器使用全卷积网络,主要是替换池化操作为stride卷积。这样可以让网络学习自己的采样方式。fractionally-strided convolution。 +2. 取消卷积层后的全连接层,作者发现全局池化虽然增加了图像分类任务的模型稳定性,同时也延缓了模型的收敛。 +3. 使用BN层,但在生成器输出层和判别器输入层没有使用,说是会导致模型不稳定。 +4. 除了输出层使用tanh,生成器都使用relu。判别器使用leaky relu。 + +## 训练细节 +图像像素值范围映射到tanh值域内$[-1,1]$ +mini-batch SGD +Adam优化器 + +判别器损失函数, binary cross entropy +为了防止生成器只是仅仅记录输入样本,生成器是一个变分编码器(VAE),mean squared error + KLD(相对熵,KL散度) + +## vae-dcgan训练过程 +1. 输入一个Batch的正样本到判别器,正向传播计算BCE损失,并保留梯度;再输入一个Batch的假样本到判别器,正向传播计算BCE损失并保留梯度,最后一起更新判别器参数。最大化 +> $$\max_D \quad \log(D(x))+\log(1-D(G(z)))$$ +2. 生成器是一个变分编码器(VAE),输入正样本,计算输出与输入样本的MSE(mean squared error)和KLD(相对熵,KL散度),更新生成器参数。 +3. 从生成器输入一个正样本,并将生成器的输出输入到判别器,计算BCE,只更新生成器的参数。 +> $$\max_G \quad \log(D(G(x)))\quad \text{为了让生成器生成的样本更像正样本}$$ diff --git a/essay/gan/gan.md b/essay/gan/gan.md new file mode 100644 index 0000000..4a956b5 --- /dev/null +++ b/essay/gan/gan.md @@ -0,0 +1,45 @@ +# generative adversarial nets +[gan](https://www.jiqizhixin.com/articles/2017-10-1-1) + +## abstract +为估计generative model提出了一个新的框架,它包括两个模型,一个捕获数据分布的生成模型G,一个判别样本是来自于训练数据还是模型G的判别式模型D。模型G训练的目标是让D识别不出样本的来源。当G和D是多层感知机时,可以通过SGD来训练。 + +## introduction +深度学习的希望在于发现实际产品在应用过程中,遇到的数据的概率分布,如图像、语言。但是到目前为止,重要突破只在于判别式模型,将高维数据映射到低维的标签变量上。深度生成模型的受到的影响很小,关键在于,很难近似极大似然估计和相关策略中的概率计算,也很难使用分段线性激活函数的优点。本篇的GAN能够避开这些缺陷。 + +本文中,G和D都是多层感知机。 叫做adversarial nets。 + +## related work +RBMs(小s表示复数,即各种变种), DBMs, DBNs + +## adversarial networks +定义一个先验噪声分布$p_z(z)$,定义生成器为$G(z;\theta_g)$,$\theta_g$为生成器模型的参数,那么就得到生成器的数据分布$p_g$(因为生成器的输出是由输入$z$与参数$\theta_g$决定的)。 + +定义判别器$D(x;\theta_d)$,$\theta_d$为判别器模型的参数,$D(x)$表示样本$x$来自真实数据而不是生成器的概率, + +value function。 +> $$V(D,G)$$ + +## 目标函数 +> $$\min_G\max_DV(D,G)=\mathbb{E}_{x\sim p_{data}}[\log D(x)]+\mathbb{E}_{z\sim p_z(z)}[\log(1-D(G(z)))]$$ +其中,$\max(D)$指最大化判别器的分类正确率。 + +## 训练 +训练$k$次判别模型,再训练一次生成模型。 + + +## tips +- ndf: number of discriminator filters in first layers? +- ngf: number of generator filters in first layers? +- nz: size of the latent z vector + +## GAN summation +- GAN:Generative Adversarial Nets +- CGAN:Conditional Generative Adversarial Nets +- DCGAN:Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks +- WGAN:Wasserstein GAN +- InfoGAN:Interpretable Representation Learning by Information Maximizing Generative Adversarial Nets +- pixGAN: image-to-image translation with conditional adversarial network + +[gan集合](https://deephunt.in/the-gan-zoo-79597dc8c347) +[gan超分辨率](https://yq.aliyun.com/articles/277845) diff --git a/essay/gan/infogan.md b/essay/gan/infogan.md new file mode 100644 index 0000000..564eeb0 --- /dev/null +++ b/essay/gan/infogan.md @@ -0,0 +1,19 @@ +# InfoGAN:Interpretable Representation Learning by Information Maximizing Generative Adversarial Nets + +## abstract +基于信息理论对GAN的扩展,使其能够以完全无监督的方式学习disentangled(分开、解开)独立变量的表达。 +InfoGAN是以最大化互信息为目标函数。 + +## introduction +作者在digits(MINIST)、faces(CelebA)、house numbers(SVHN)上进行实验。 + +## related work + +## background: GAN +目标是学习一个生成分布$P_G(x)$来近似真实数据分布$P_{data}(x)$。 + +## mutual information +首先将GAN的输入向量分成两部分,1.普通噪声$z$,2.能够表示图像属性的信息$c$,比如笔画粗细,字体角度。 +在损失函数中引入互信息,最大化生成器输出与$c$的互信息。 + +但是直接计算互信息需要后验分布$P(c|x)$, \ No newline at end of file diff --git a/essay/gan/pixpixgan.md b/essay/gan/pixpixgan.md new file mode 100644 index 0000000..f0408f4 --- /dev/null +++ b/essay/gan/pixpixgan.md @@ -0,0 +1,16 @@ +# image-to-image translation with conditional adversarial network +``` +It would be highly desirable if we could instead specify only a high-level goal, like “make the output indistinguishable from reality”, and then automatically learn a loss function appropriate for satisfying this goal. +``` +## abstract +使用cGAN网络,不仅学习了一种从一种图像到另一种图像的变换,还学习到了其中的损失函数。 + +## introduction +图像的L2损失会使生成图像趋于模糊。 + +## related work +cGAN可以自动学习pix2pix的损失函数,并且是一种structured loss。 + +## method +目标函数 +> $$G^*=\arg\min_G\max_D\mathcal{L}cGAN(G,D)+\lambda\mathcal{L}_{L1}(G)$$ \ No newline at end of file diff --git a/essay/scdae.md b/essay/gan/scdae.md similarity index 100% rename from essay/scdae.md rename to essay/gan/scdae.md diff --git a/essay/srgan.md b/essay/gan/srgan.md similarity index 97% rename from essay/srgan.md rename to essay/gan/srgan.md index 2b3578f..016a95b 100644 --- a/essay/srgan.md +++ b/essay/gan/srgan.md @@ -33,4 +33,4 @@ pixelShuffler? ## tips - SISR: single image super-resolution - PSNR: peak signal-to-noise ratio,峰值信噪比(单位为dB) -- SSIM: structural similarity \ No newline at end of file +- SSIM: structural similarity diff --git a/essay/variationalae.md b/essay/gan/variationalae.md similarity index 100% rename from essay/variationalae.md rename to essay/gan/variationalae.md diff --git a/essay/gan/wgan.md b/essay/gan/wgan.md new file mode 100644 index 0000000..df05c7b --- /dev/null +++ b/essay/gan/wgan.md @@ -0,0 +1,6 @@ +# wgan +[令人拍案叫绝的Wasserstein GAN](https://zhuanlan.zhihu.com/p/25071913) +1. 判别器最后一层去掉sigmoid +2. 生成器和判别器的loss不取log +3. 每次更新判别器的参数之后把它们的绝对值截断到不超过一个固定常数c +4. 不要用基于动量的优化算法(包括momentum和Adam),推荐RMSProp,SGD也行 \ No newline at end of file diff --git a/essay/gnn/intro.md b/essay/gnn/intro.md new file mode 100644 index 0000000..2f55e41 --- /dev/null +++ b/essay/gnn/intro.md @@ -0,0 +1,4 @@ +# introduction to gnn + +[GRAPH CONVOLUTIONAL NETWORKS simple introduction and pytorch example](http://tkipf.github.io/graph-convolutional-networks/) +[图神经网络综述:模型与应用](https://mp.weixin.qq.com/s?__biz=MzIwMTc4ODE0Mw==&mid=2247493906&idx=1&sn=15c9f18a1ce6baa15dc85ecb52e799f6&chksm=96ea3692a19dbf847c1711e6e194ad60d80d11138daf0938f90489a054d77cfd523bee2dc1d2&scene=0#rd) \ No newline at end of file diff --git a/essay/head/san.md b/essay/head/san.md new file mode 100644 index 0000000..f8886cf --- /dev/null +++ b/essay/head/san.md @@ -0,0 +1,4 @@ +# Spatial Attention Network for Head Detection 2018 国防科技大学 +2018-09-26 11:16 + +使用注意力机制检测人头,以消除误检。 \ No newline at end of file diff --git a/essay/match/gms.md b/essay/match/gms.md new file mode 100644 index 0000000..912821c --- /dev/null +++ b/essay/match/gms.md @@ -0,0 +1,7 @@ +# GMS: Grid-based Motion Statistics for Fast, Ultra-robust Feature Correspondence + +2019-04-16 10:35 + +> Thus true and false matches can be differentiated simply counting the number of matches in their neighborhood. + +特征: SIFT -> LIFT -> A-LIFT \ No newline at end of file diff --git a/essay/match/line2mod.md b/essay/match/line2mod.md new file mode 100644 index 0000000..271677b --- /dev/null +++ b/essay/match/line2mod.md @@ -0,0 +1,25 @@ +# Gradient Response Maps for Real-Time Detection of Texture-Less Objects 2012 PAMI + +[github](https://github.com/meiqua/shape_based_matching) + +O 模板图像, +r 模板图像中所有特征所处的位置, + +I 输入待匹配图像, +c 输入图像的c位置 + +作者对目标函数进行改进后,对小的平移和形变鲁棒。 + +## 2.2 computing the gradient orientations + +3x3邻域 + +## 2.3 spreading the orientations + +spread是对输入待测试图像的操作,得到J + +## 2.4 precomputing response maps + +response map与模板无关,所以当有多个模板时,response map也只计算一次 + +## 2.5 linearizing the memory for paralleization diff --git a/essay/match/summary.md b/essay/match/summary.md new file mode 100644 index 0000000..828eaf6 --- /dev/null +++ b/essay/match/summary.md @@ -0,0 +1,19 @@ +# math + +![match](../../image/essay/match.png) + +图像配准 + +模板匹配 + +形状匹配 + +## match + +暴力匹配 brute force +FlannBasedMatcher + +## 消除误匹配 + +[GMS](./gms.md) +RANSAC diff --git a/essay/multitask/mtan.md b/essay/multitask/mtan.md new file mode 100644 index 0000000..2334288 --- /dev/null +++ b/essay/multitask/mtan.md @@ -0,0 +1,8 @@ +# end-to-end multitask-learning with attention liu shi kun CVPR 2019 + +## 1. introduction + +## 3.1 network architecture + +多任务学习网络一般包括两种参数,1.共享层,2.任务独有层。这篇论文提出在这两种层之间加入注意力机制,来过渡特征从共享层流入到任务独有层。 +想法比较直接,实验效果改善不多,损失曲线到是很好看。 diff --git a/essay/attention.md b/essay/nlp/attention.md similarity index 55% rename from essay/attention.md rename to essay/nlp/attention.md index 0d7cead..04592be 100644 --- a/essay/attention.md +++ b/essay/nlp/attention.md @@ -1,20 +1,25 @@ # attention is all you need 2017 ## abstract -主流的序列翻译模型都是利用了编码器与解码器结构的RNN或CNN,作者使用了编码、解码结构,未使用RNN与CNN,提出了一个完全基于注意力机制的简单模型,叫做Transformer。这个模型易于并行化、训练,并且在两个机器翻译数据库上取得了好的结果,在WMT 2014 English-to-German上取得28.4BLEU,在WMT 2014 English-to-French上取得41.8BLEU。 +主流的序列翻译模型都是利用了由RNN或CNN构成的编码器与解码器,本文作者虽同样使用了编码、解码结构,但并未使用RNN与CNN,而是提出了一个完全基于注意力机制的简单模型,Transformer。这个模型易于并行化、训练,并且在两个机器翻译数据库上取得了好的结果,在WMT 2014 English-to-German上取得28.4BLEU,在WMT 2014 English-to-French上取得41.8BLEU。 ## introduction -在以往的研究中,RNN、LSTM、GTN是效果最好的处理序列数据的模型。RNN通过factorization tricks[21]和conditional computation[32]能够改善计算效率,但是本质的序列化计算依然没有改变。注意力机制已经称为了序列化模型中不可或缺的部分,但它依然是结合在RNN中。 +在以往的研究中,RNN、LSTM、GRU是效果最好的处理序列数据的模型。RNN通过factorization tricks[21]和conditional computation[32]能够改善计算效率,但是本质的序列化计算依然没有改变。注意力机制已经成为了序列化模型中不可或缺的部分,但它依然是结合在RNN中。 + +在8块p100的机子上,训练需要12小时。 ## background multi-head attention self-attention(intra-attention) ## model architecture -编码器是将符号表示的序列$(x_1,……,x_n)$映射到连续数字表示的序列$\bold z=(z_1,……,z_n)$,解码器是将$\bold z$转换为输出符号序列$(y_1,……,y_n)$,解码器一次只输出一个符号,并且前面输出的符号会被用于求解剩下的符号。 -Transformer也是基于编码、解码的结构。 +编码器是将符号表示的序列$(x_1,……,x_n)$映射到连续数字表示的序列$\bold z=(z_1,……,z_n)$,解码器是将$\bold z$转换为输出符号序列$(y_1,……,y_m)$,解码器一次只输出一个符号,并且前面输出的符号会被用于求解剩下的符号。 +Transformer也是基于编码、解码的结构,不过使用的是全连接层。 + ### 编码器、解码器 编码器由$6$个相同的结构堆叠而成,每一个结构内部包含两个部分,第一个是multi-head self-attention,第二个是position-wise前向全连接网络,这两个组成部分都使用了layer normalization及residual connection。 -解码器由$6$个相同的结构堆叠而成,每一个结构内部包含三个部分,比解码器多的一个是用于输入编码器的输出部分。 + +解码器由$6$个相同的结构堆叠而成,每一个结构内部包含三个部分,比解码器多的一个是用于接收编码器输出的部分。 + ### attention ```python # google的attention实现代码注释 @@ -29,8 +34,9 @@ Transformer也是基于编码、解码的结构。 # typically the sequence of encoder outputs. # A tensor of shape `[B, T, input_dim]`. ``` -attention其实就是一个函数,将query、keys计算出一个权重,然后加权求和values得到输出。 +attention其实就是一个计算权重然后求和的函数,通过query和各个keys计算权重,然后应用各个权重对values加权求和,就得到了这个query的attention结果,这里的keys-values是成对的。 - scaled dot-product attention -- multi-head attention +有两种常用的注意力机制,分别是additive attention和dot-product(multiplicate) attention。multiplicate attention往往更快、更节省空间,因为矩阵相乘的运算都得到了很强的优化。 +- multi-head attention diff --git a/essay/nlp/localAttention.md b/essay/nlp/localAttention.md new file mode 100644 index 0000000..742c668 --- /dev/null +++ b/essay/nlp/localAttention.md @@ -0,0 +1,8 @@ +# Effective Approaches to Attention-based Neural Machine Translation 2015 斯坦福 +探索了attention-based neural machine translation,包括global attention和local attention两种,并且都得到了较好的结果。 + +attention机制允许两个不同的模态(modalities)进行对齐操作(alignment)。[neural machine translation by jointly learning to align and translate]。 + + +## NMT +每个句子数据以EOS(end of sentence)结尾。 \ No newline at end of file diff --git a/essay/nlp/nmtAlign.md b/essay/nlp/nmtAlign.md new file mode 100644 index 0000000..e1e35fa --- /dev/null +++ b/essay/nlp/nmtAlign.md @@ -0,0 +1,10 @@ +# neural machine translation by jointly learning to align and translate 2016 +原NMT的形式基本是encoder-decoder的形式,但是encoder生成的是一个固定长度的向量,而本文作者认为这会限制模型的性能,所以提出一种可以自动选择性的基于一些词来输出一个特定词。 +具体的,这里编码器生成一个vector sequence,而解码器在解码会自动的选择一些词。 + + +这里的编码器采用了双向RNN。 + +## tips +- 这里的align 应该理解为translated from。 +- 看了phraseRepresentation再看这篇比较容易理解。 \ No newline at end of file diff --git a/essay/nlp/phraseRepresentation.md b/essay/nlp/phraseRepresentation.md new file mode 100644 index 0000000..bc8cd99 --- /dev/null +++ b/essay/nlp/phraseRepresentation.md @@ -0,0 +1,19 @@ +# Learning Phrase Representations using RNN Encoder–Decoder for Statistical Machine Translation 2014 +提出了一个叫做RNN Encoder-Decoder的模型,编码器是一个RNN网络,用于将输入符号序列转换成固定长度的向量;解码器也是一个RNN网络,用于将这个向量转换成另一种符号序列。这个模型用于学习序列转换,论文中将其应用于phrase-based statistical machine translation(SMT)。 log-linear model? + +## RNN Encoder-Decoder +目标函数:对数似然,其中,$x_n,y_n$是训练样本与标签,$\theta$是参数模型。 +> $$\max \limits_ \theta \frac{1}{N}\sum_{n=1}^{N}\log p_\theta(y_n|x_n)$$ + +有时,只有编码器的最后一个输出被用于解码器,这个输出包含了整个输入句子的信息,叫做context vector。 + +## SMT +给定一个句子$e$,SMT模型时最大化下式 +> $$p(f|e)\varpropto p(e|f)p(f)$$(1) +其中$p(e|f)$是translation model,$p(f)$是language model。 + +log linear model就是将$(1)$式两侧去对数。 + + +## conclusion +该模型可以用于score a pair of sequences(used here with SMT),given a source sequence generate a target sequence。 \ No newline at end of file diff --git a/essay/nlp/relation.md b/essay/nlp/relation.md new file mode 100644 index 0000000..3389515 --- /dev/null +++ b/essay/nlp/relation.md @@ -0,0 +1,15 @@ +# relation networks for object detection 2018 cvpr msra +本工作提出了object relation module,它在预测每个目标时会考虑其它物体的appearance feature和geometry,从而对object relation建模,它很轻量并且是in-place操作,可以改善object detection和duplicate removal。 + +将原attention weight扩充为两个部分,1.original weight,2.geometric weight(对目标之间的空间位置关系进行建模,相对位置使其具有平移不变性)。注意力机制可以并行化,可微分,并且是in-place的(输入输出特征图维度保持不变)。 + +## related work +## object relation module +实验表明geometric weight是很重要的。 + +## relation networks for object detection + + +## tips +- attention is all you need中的query、key-value pair、output分别具体代表什么? +- 如何做的编码(embedding)?cosine、sine \ No newline at end of file diff --git a/essay/nlp/sumary.md b/essay/nlp/sumary.md new file mode 100644 index 0000000..be69ccf --- /dev/null +++ b/essay/nlp/sumary.md @@ -0,0 +1,3 @@ +[THUnlp](https://github.com/thunlp) +[attention](https://lilianweng.github.io/lil-log/2018/06/24/attention-attention.html) +[lstm](http://colah.github.io/posts/2015-08-Understanding-LSTMs/) \ No newline at end of file diff --git a/essay/ocr/anchorFree.md b/essay/ocr/anchorFree.md new file mode 100644 index 0000000..9a7ea3d --- /dev/null +++ b/essay/ocr/anchorFree.md @@ -0,0 +1,19 @@ +# An Anchor-Free Region Proposal Network for Faster R-CNN based Text Detection Approaches msra + +将DenseBox中的anchor-free思想应用于Faster R-CNN,就是基于特征图直接回归目标框,而没有使用预设anchor。之后使用roi pooling,继续做分类和位置回归。而制作标签时,仅仅将位于text核心区域的特征点作为正样本。 + +虽然说是anchor-free,但这是针对two-stage检测框架中RPN的,而proposal box就相当于后面detector的anchor。 + +## related work +1. bottom-up,由三部分组成 +candidate text connected components extraction, +2. top-down,也就是CNN方法 + +## anchor-free region proposal network +使用了3个特征图做预测,它们的stride分别是$4,8,16$,每个特征图有自己的text size匹配范围。 +正样本是text的最小外接矩形的中心部分,回归的坐标是经过归一化的。 + + +## light head faster R-CNN with AF-RPN +从RPN的proposal box选出score最高的$N_1=2000$个box,送入NMS,再选出score最高的$N_2=300$个box。 +为3个特征图的proposal box参数不共享的检测器,使用了Ps roi pooling。 \ No newline at end of file diff --git a/essay/ocr/ctpn.md b/essay/ocr/ctpn.md new file mode 100644 index 0000000..e29e156 --- /dev/null +++ b/essay/ocr/ctpn.md @@ -0,0 +1,7 @@ +# Detecting Text in Natural Image withConnectionist Text Proposal Network 2016 + +### vertical anchor +anchor的宽度固定,水平方向上的偏移量固定 + +### side-refinement +字符串在水平方向上的两端很容易被遗漏,因为标签有时并不准确。 \ No newline at end of file diff --git a/essay/ocr/spcnet.md b/essay/ocr/spcnet.md new file mode 100644 index 0000000..2b0cad0 --- /dev/null +++ b/essay/ocr/spcnet.md @@ -0,0 +1,22 @@ +# scene text detection with supervised pyramid context network AAAI 2018 xieEnZe + +2018-12-07 16:27 + +文章出发点在于减少false positive + +## Mask R-CNN branch + +roi-pooling生成$7\times 7$特征图用于R-CNN branch,roi-pooling生成$14\times 14$特征图用于Mask branch + +## text context module(TCM) + +由两个子模块构成, + +- pyramid attention module +- pyramid fusion module + +```yaml +after the channel-wise softmax, we obtain the text saliency map. Through the Exponential activation, the saliency map is enhanced, that is, the response gap in text/non-text areas becomes larger. +``` + +## post re-score mechanism \ No newline at end of file diff --git a/essay/pedestrian/ttl.md b/essay/pedestrian/ttl.md new file mode 100644 index 0000000..4ca858b --- /dev/null +++ b/essay/pedestrian/ttl.md @@ -0,0 +1,26 @@ +# Small-scale Pedestrian Detection Based on Somatic Topology Localization and Temporal Feature Aggregation ECCV 2018 hik + +摘要中提到简写为TLL(Topology line localization)框架 + +## introduction +小型人体检测面临的挑战: +1. 模糊的边界与外表,很难从背景中区分开来; +2. 现有的检测方法严重依赖于ground truth box,而box中几乎有一半的像素都是背景,这使分类器很难区分开来。在解决小型目标检测方案中,大都通过控制卷积感受野来解决,而这里认为关键原因在于标注信息不准确。 + +利用了热度图预测来做行人检测,这个思想主要可以提高尺度较小的行人检测mAP,而对尺度较大的人的检测性能是有所损害的,也就是说这种算法只能应用到其适用场景中,而不是一种普适的方法。 + + +loss function: +> $$f=\|\tilde D_t-D_t\|^2 + \|\tilde D_b-D_b\|^2 + \lambda\|\tilde L-L\|^2$$ +其中,$D_t$表示顶点,$D_b$表示底点,$L$表示方向。 + +link score between $b_j$ and $t_i$: +> $$E_{i,j}=\int _{u=0} ^{u=1} \tilde L(p(u)) \cdot \frac{\tilde b_j-\tilde t_i}{\|\tilde b_j-\tilde t_i\|_2} du$$ + +![architecture](../../image/essay/tll.jpg) + +### 4.2 multi-scale representation +使用了Conv3、Conv4、Conv5做link maps预测。 + +## tips +标准评价指标MR: log miss rate averaged over false positive per image(FPPI) \ No newline at end of file diff --git a/essay/person.md b/essay/person.md new file mode 100644 index 0000000..f183a53 --- /dev/null +++ b/essay/person.md @@ -0,0 +1,4 @@ +## face detection +中科院 Dr.ShifengZhang +加拿大麦吉尔大学 Dr.Yuguang Liu +msra JifengDai \ No newline at end of file diff --git a/essay/pose/accuratePoseEstimation.md b/essay/pose/accuratePoseEstimation.md new file mode 100644 index 0000000..d02d77c --- /dev/null +++ b/essay/pose/accuratePoseEstimation.md @@ -0,0 +1,19 @@ +# towards accurate multi-person pose estimation in the wild +使用Faster RCNN做检测,使用headmaps做预测结合一个全卷积ResNet做offsets预测。 + +## Person pose estimation +1. 线性回归关键点的位置(2014文章),但无法解决图像中出现多人多个同类关键点的问题。不是单人预测吗? +2. 预测heatmap,输出精度受限于输出热点图的大小,并且由于maxpooling会导致位置偏移。 +作者的做法是模仿目标检测的方案,每个关键点输出三个热点图,一个通道表示是关键点的confidence,另两个通道表示改关键点在两个方向的偏移。采用双线性插值得到原图大小的关键点位置。 + +## 模型 +two-step cascade +1. detector: faster-RCNN,使用ResNet101作为骨干网络。 +2. refinement: + + +## 测试 +使用ReScore策略 + +## tips +atrous convolution就是dilated convolution(孔洞卷积) \ No newline at end of file diff --git a/essay/pose/associativeEmbedding.md b/essay/pose/associativeEmbedding.md new file mode 100644 index 0000000..a1ce9cd --- /dev/null +++ b/essay/pose/associativeEmbedding.md @@ -0,0 +1,29 @@ +# Associative Embedding:End-to-End Learning for Joint Detection and Grouping 2017 + +## abstract +许多视觉任务可以看做检测和分组两个任务的组合。 + +网络为每一个关节点输出一个detection heatmap和一个tagging heatmap,然后一个tag的相似度将关节点组织为一个个独立的人。 + +low dimensional embeddings与high dimensional embeddings的效果并无差别,因为只要网络模型容量足够,那么就可以学习到将高维嵌入向量映射到低维嵌入向量上的方法,所以论文里采用了1D embedding。 + +使用非极大值抑制获取detection heatmap中的关节点(peak detections)。 + + +## architecture +输入512x512,输出128x128,4个HourGlass module。 + + +## 3.3 multiperson pose esitmation +很容易想到,使用网络同时预测多个尺度的人体也是可行的,但存在着诸多缺点。 +1. 为了学习尺度不变性,模型容量要增大; +2. 池化后,小尺度人体定位会不准确。 + +提出pull-push loss。 + +而作者采用了多尺度测试的方案。 + + +## tips +1. top-down,指先检测行人,再为每个检测框预测heatmap +2. bottom-up,指为整张图片预测heatmap,再将关键点组装成独立的个体。 \ No newline at end of file diff --git a/essay/pose/baseline.md b/essay/pose/baseline.md new file mode 100644 index 0000000..bacccf9 --- /dev/null +++ b/essay/pose/baseline.md @@ -0,0 +1,22 @@ +# Simple Baselines for Human Pose Estimationand Tracking 2018, msra, 电子科技大学 yichen wei + +本文采用了一种top-down的结构,即先使用检测器(这里是Faster RCNN, 56.4mAP for person category in coco-val2017)在整幅图像里检测人,然后将检测框缩放到统一尺寸(如256x192),再输入到pose estimation网络进行关键点预测。 + +## pose estimation +是在ResNet后面接了三个Deconvolution+BN+ReLU层。 +Deconvolution使用256filters,4x4 kernel,stride=2。 + + +## pose tracking +> The pose tracking (or association) uses the same greedy matching method as in [19]. Our only extension is to use optical flow based pose propagation and similarity measurement. + +基于光流做跟踪,并使用greedy bipartile matching algorithm。 + + +## reference +12. two stage?1.检测,2.heatmap预测) Cascaded pyramidnetwork for multi-person pose estimation + +## tips +OKS: object keypoint similarity + + diff --git a/essay/pose/cpnKeyPoints.md b/essay/pose/cpnKeyPoints.md new file mode 100644 index 0000000..7f41bf1 --- /dev/null +++ b/essay/pose/cpnKeyPoints.md @@ -0,0 +1,30 @@ +# cascaded pyramid network for multi-person pose estimation, 2017, face++ yugang, 清华,华中大 +top-down结构,采用FPN做人体检测后,将检测框填充到256:192的比例,再缩放到256x192,最后送入CPN网络。 + +55.3mAP for person category in coco minival。 + +## abstract +使用CPN(cascaded pyramid network)做人体关键点检测 + +## GlobalNet +ResNet50-FPN添加了一个1x1卷积。 +是一个特征金字塔结构网络,用于解决容易定位的关键点。 + +## RefineNet +采用难例学习来解决不容易定位的关键点。 +它的输入是前面GlobalNet(C2,3,4,5)concatentate的结果。 + +## 损失函数 +GlobalNet:L2损失,**是所有层都有监督信息吗?按图所示是的,并且文中说到是多层接受监督学习**,是在通道相加后得到256通道后接1x1然后输出类别数目的通道。 +RefineNet:难例学习L2损失反向传播,只反向传播损失较大的关键点。 + +## 预测 +对预测结果做高斯滤波以减少预测的方差, +Rescoring strategy:是目标检测阶段的boxes'score,与boxes内人体关键点的置信度的均值的乘积作为最后人体实例的置信度。 + +## 数据预处理 +输入:实验得到256x192与256x256的结果相同的结论。 +标签: + +## tips +flops: floating point operations,没有per second的意思 \ No newline at end of file diff --git a/essay/pose/dualpath.md b/essay/pose/dualpath.md new file mode 100644 index 0000000..e46c90b --- /dev/null +++ b/essay/pose/dualpath.md @@ -0,0 +1,10 @@ +# dual path networks for multi-person human pose estimation +DPN(dual path network) +- keypoints path +- data association path + +## tips +- top down +是先检测出人的box,然后对单个box进行预测 +- bottom up +对整幅图进行同时预测关键点,然后集成为人体的肢体。 \ No newline at end of file diff --git a/essay/pose/ganPosenet.md b/essay/pose/ganPosenet.md new file mode 100644 index 0000000..1a96983 --- /dev/null +++ b/essay/pose/ganPosenet.md @@ -0,0 +1,27 @@ +# Adversarial posenet: a structure-aware convolutional network for human pose estimation +## abstract +说的很对,当出现遮挡或肢体交叠时,预测的关键点就可能出现不实际的位置上。为了为网络引入人体结构的先验知识,设计了pose判别器, + +## posenet +输入RGB,输出32通道,16通道的pose estimation,16通道的occlusion estimation。 +标签制作: 值范围(0,1),使用高斯模糊。 + +## pose generator network G +Multitask 使用均方误差作为目标函数。 +为了使用纹理信息,使用encoder-decoder的结构。添加skip结构。使用中间输出监督。使用线性回归预测。使用均方误差损失函数。 +生成器的任务不仅要欺骗判别器,还要学习与label的L2损失 + +## pose discriminator network P +P是为了训练网络获得人体关节点姿势的先验知识,以区分那些不符合人体约束的预测。 +输入RGB,G输出的pose heatmap和occlusion heatmap。 +encoder-decoder结构,skip结构, +只有pose heatmap、occulusion heatmap时,是可以预测出一个合理的姿势的,但是无法匹配原图片中的姿势,所以原图(RGB图)同样要作为输入。遮挡信息在评估预测的合理性时同样有用。 +cGAN? + +## confidence discriminator network C +通过观察groud truth heatmap与predicted pose heatmap,predicted ones经常不是高斯形式的。 +所以这个通过这个判别器可以是网络的输出置信度更高些。 + +## training of the gan + +> $$\mathcal{F}$$ \ No newline at end of file diff --git a/essay/pose/hourglass.md b/essay/pose/hourglass.md new file mode 100644 index 0000000..7151524 --- /dev/null +++ b/essay/pose/hourglass.md @@ -0,0 +1,55 @@ +# stacked hourglass networks for human pose estimation +标准差为1px。 + +array([[3.69163520e-17, 9.03313351e-15, 8.13136765e-13, 2.69273915e-11, + 3.28042784e-10, 1.47018576e-09, 2.42392653e-09, 1.47018576e-09, + 3.28042784e-10, 2.69273915e-11, 8.13136765e-13, 9.03313351e-15, + 3.69163520e-17], + [9.03313351e-15, 2.21033489e-12, 1.98968006e-10, 6.58891545e-09, + 8.02694227e-08, 3.59742594e-07, 5.93115267e-07, 3.59742594e-07, + 8.02694227e-08, 6.58891545e-09, 1.98968006e-10, 2.21033489e-12, + 9.03313351e-15], + [8.13136765e-13, 1.98968006e-10, 1.79105291e-08, 5.93115267e-07, + 7.22562316e-06, 3.23829963e-05, 5.33905349e-05, 3.23829963e-05, + 7.22562316e-06, 5.93115267e-07, 1.79105291e-08, 1.98968006e-10, + 8.13136765e-13], + [2.69273915e-11, 6.58891545e-09, 5.93115267e-07, 1.96412801e-05, + 2.39279777e-04, 1.07237756e-03, 1.76805169e-03, 1.07237756e-03, + 2.39279777e-04, 1.96412801e-05, 5.93115267e-07, 6.58891545e-09, + 2.69273915e-11], + [3.28042784e-10, 8.02694227e-08, 7.22562316e-06, 2.39279777e-04, + 2.91502443e-03, 1.30642331e-02, 2.15392791e-02, 1.30642331e-02, + 2.91502443e-03, 2.39279777e-04, 7.22562316e-06, 8.02694227e-08, + 3.28042784e-10], + [1.47018576e-09, 3.59742594e-07, 3.23829963e-05, 1.07237756e-03, + 1.30642331e-02, 5.85498309e-02, 9.65323516e-02, 5.85498309e-02, + 1.30642331e-02, 1.07237756e-03, 3.23829963e-05, 3.59742594e-07, + 1.47018576e-09], + [2.42392653e-09, 5.93115267e-07, 5.33905349e-05, 1.76805169e-03, + 2.15392791e-02, 9.65323516e-02, 1.59154941e-01, 9.65323516e-02, + 2.15392791e-02, 1.76805169e-03, 5.33905349e-05, 5.93115267e-07, + 2.42392653e-09], + [1.47018576e-09, 3.59742594e-07, 3.23829963e-05, 1.07237756e-03, + 1.30642331e-02, 5.85498309e-02, 9.65323516e-02, 5.85498309e-02, + 1.30642331e-02, 1.07237756e-03, 3.23829963e-05, 3.59742594e-07, + 1.47018576e-09], + [3.28042784e-10, 8.02694227e-08, 7.22562316e-06, 2.39279777e-04, + 2.91502443e-03, 1.30642331e-02, 2.15392791e-02, 1.30642331e-02, + 2.91502443e-03, 2.39279777e-04, 7.22562316e-06, 8.02694227e-08, + 3.28042784e-10], + [2.69273915e-11, 6.58891545e-09, 5.93115267e-07, 1.96412801e-05, + 2.39279777e-04, 1.07237756e-03, 1.76805169e-03, 1.07237756e-03, + 2.39279777e-04, 1.96412801e-05, 5.93115267e-07, 6.58891545e-09, + 2.69273915e-11], + [8.13136765e-13, 1.98968006e-10, 1.79105291e-08, 5.93115267e-07, + 7.22562316e-06, 3.23829963e-05, 5.33905349e-05, 3.23829963e-05, + 7.22562316e-06, 5.93115267e-07, 1.79105291e-08, 1.98968006e-10, + 8.13136765e-13], + [9.03313351e-15, 2.21033489e-12, 1.98968006e-10, 6.58891545e-09, + 8.02694227e-08, 3.59742594e-07, 5.93115267e-07, 3.59742594e-07, + 8.02694227e-08, 6.58891545e-09, 1.98968006e-10, 2.21033489e-12, + 9.03313351e-15], + [3.69163520e-17, 9.03313351e-15, 8.13136765e-13, 2.69273915e-11, + 3.28042784e-10, 1.47018576e-09, 2.42392653e-09, 1.47018576e-09, + 3.28042784e-10, 2.69273915e-11, 8.13136765e-13, 9.03313351e-15, + 3.69163520e-17]]) diff --git a/essay/pose/rnnpose.md b/essay/pose/rnnpose.md new file mode 100644 index 0000000..7b97301 --- /dev/null +++ b/essay/pose/rnnpose.md @@ -0,0 +1,12 @@ +# recurrent human pose estimation +RNN的作用是在不增加参数量的情况下增加神经元的感受野。 + +ConvNet由两部分组成,两者都输出特征图,使用中间层辅助监督。 +1. Feed-Forward module +初始卷积为$3x3$大小。每一层卷积后都有ReLU激活函数,最后输出层是卷积层,之后也接ReLU。除了$1x1$卷积外所有卷积层后都有BN层, +2. Recurrent module +3. Body part heatmaps as supplementary supervision +Body part headmaps作为辅助监督,主要用于数据增强。 +4. target heatmaps and loss function +同样使用均方误差。 + diff --git a/essay/pose/summary.md b/essay/pose/summary.md new file mode 100644 index 0000000..c1e572c --- /dev/null +++ b/essay/pose/summary.md @@ -0,0 +1,14 @@ +# pose estimation + +model | backbone | resolution | mAP(COCO-testdev) +----|---|---|--|--- +coco2016| | |60.5 +coco2017| | |72.1 +simple baseline| ResNet-152 | 384x288 | 73.8 + + + + +model | backbone | resolution | mAP(MPII) +----|---|---|--|--- + diff --git a/essay/prune/groupWise.md b/essay/prune/groupWise.md new file mode 100644 index 0000000..ca02bb2 --- /dev/null +++ b/essay/prune/groupWise.md @@ -0,0 +1,17 @@ +# Fast ConvNets Using Group-wise Brain Damage CVPR 2015.12 +观察到当前的深度学习框架大都将卷积转换为矩阵相乘的形式,如caffe中的im2col,这样做是为了利用现有的矩阵运算库,因为这些库经过了几十年的发展,算法都得到了很好的优化。 + +作者所做的剪枝操作就很好的利用了卷积的实现方式,通过固定结构的剪枝可以使卷积转换的矩阵的维度更小,从而可以加速运算。 + +L21-norm +> $$\Omega_{2,1}(K)=\lambda\sum_{i,j,s}\|\Gamma_{i,j,s}\|=\lambda\sum_{i,j,s}\sqrt{\sum_{t=1}^{T}K(i,j,s,t)^2}$$ +其中,$s$表是滤波器通序号,$T$表示滤波器个数。 + +范数梯度 +> $$\frac{\partial\Omega_{2,1(K)}}{\partial K(i,j,s,t)}=\lambda\frac{K(i,j,s,t)}{\sqrt{\sum_{z=1}^{T}K(i,j,s,z)^2}}$$ + + +## tips +结构化剪枝指剪掉整个滤波器或通道; +非结构化剪枝就是对剪枝参数的位置没有要求; +这里是介于结构化剪枝与非结构化剪枝的一种算法,集成了两者的优点。 \ No newline at end of file diff --git a/essay/prune/learnConnection.md b/essay/prune/learnConnection.md new file mode 100644 index 0000000..08fd485 --- /dev/null +++ b/essay/prune/learnConnection.md @@ -0,0 +1 @@ +# learning both weights and connections for efficient neural networks 2015.10 \ No newline at end of file diff --git a/essay/prune/pruneGist.md b/essay/prune/pruneGist.md new file mode 100644 index 0000000..e3e61d4 --- /dev/null +++ b/essay/prune/pruneGist.md @@ -0,0 +1 @@ +# prunning convolutional neural networks for resource efficient inference \ No newline at end of file diff --git a/essay/prune/quantize.md b/essay/prune/quantize.md new file mode 100644 index 0000000..6671d90 --- /dev/null +++ b/essay/prune/quantize.md @@ -0,0 +1,2 @@ +# Deep Compression: Compressing deep neural networks with pruning, trained quantization and Huffman coding 2016.02 hansong +不是结构化剪枝 \ No newline at end of file diff --git a/essay/prune/summary.md b/essay/prune/summary.md new file mode 100644 index 0000000..6526f67 --- /dev/null +++ b/essay/prune/summary.md @@ -0,0 +1,19 @@ +# tips +- 为什么不直接置参数为0,而使用mask? +直接置参数为0会导致参数被覆盖,置参数为0反向传播时,仍需要重复设置梯度为0,?加载模型参数后,计算剪枝模板。置0后,规则化项还会对diff有影响,所以使用mask比较方便。 + +剪枝在前向传播过程中,parameter要置0,即mask与parameter相乘;反向传播时,要置参数梯度为0,即mask与diff相乘。 + +梯度不需要置0? + +可以将剪枝的比例一步一步的提高,这样可以绘制准确率下降幅度与剪枝比例的曲线。 + + +group wise prunning,剪枝一个group可以使im2col生成的矩阵更小,然而im2col操作依然不能省略掉,而使用shift操作的话,则可以替代im2col。 + +channel wise prunnning,剪枝一个通道就可以直接删掉生成这个通道的滤波器,所以实现加速。 + + +- 使用什么归一化?参数维度?权重L2范数? + +method|model|compressed| \ No newline at end of file diff --git a/essay/read.md b/essay/read.md index 1d66d19..afdad81 100644 --- a/essay/read.md +++ b/essay/read.md @@ -6,4 +6,6 @@ mask rcnn 中推荐 Speed/accuracy trade-offs for modern convolutional object detectors. 何凯明:Surpassing Human-Level Performance on ImageNet Classification" is the most cited paper published in ICCV 2015. -[写论文、做研究](http://www.msra.cn/zh-cn/news/features/do-research-in-computer-vision-20161205) \ No newline at end of file +[写论文、做研究](http://www.msra.cn/zh-cn/news/features/do-research-in-computer-vision-20161205) + +[THUnlp](https://github.com/thunlp) \ No newline at end of file diff --git a/essay/deconvolution.md b/essay/segmentation/deconvolution.md similarity index 98% rename from essay/deconvolution.md rename to essay/segmentation/deconvolution.md index b2e4b40..5dcf04f 100644 --- a/essay/deconvolution.md +++ b/essay/segmentation/deconvolution.md @@ -1,2 +1,4 @@ -[chinese](http://blog.csdn.net/hanging_gardens/article/details/72636450) # adaptive deconvolutional networks for mid and high level feature learning 2011 + +[chinese](http://blog.csdn.net/hanging_gardens/article/details/72636450) + diff --git a/essay/fcn.md b/essay/segmentation/fcn.md similarity index 99% rename from essay/fcn.md rename to essay/segmentation/fcn.md index 679d0bf..39fdd41 100644 --- a/essay/fcn.md +++ b/essay/segmentation/fcn.md @@ -1,4 +1,5 @@ -# Fully Convolutional Networks for segmantic segmentation 2015 CVPR best paper honorable mention. +# Fully Convolutional Networks for segmantic segmentation 2015 CVPR best paper honorable mention + 这里的反卷积与zfnet中的可视化反卷积不是一个概念。 [pytorch code](https://github.com/wkentaro/pytorch-fcn) [官方 code](https://github.com/shelhamer/fcn.berkeleyvision.org) diff --git a/essay/segmentation/gcn.md b/essay/segmentation/gcn.md new file mode 100644 index 0000000..1994708 --- /dev/null +++ b/essay/segmentation/gcn.md @@ -0,0 +1 @@ +# Large Kernel Matters -- Improve Semantic Segmentation by Global Convolutional Network \ No newline at end of file diff --git a/essay/segmentation/parsenet.md b/essay/segmentation/parsenet.md new file mode 100644 index 0000000..26a2578 --- /dev/null +++ b/essay/segmentation/parsenet.md @@ -0,0 +1,25 @@ +# parseNet: looking wider to see better, liuwei + +## parseNet +### global context +尽管理论上,高层神经元的感受野很大,但是事实上,这些神经元的有效感受野是很小的,不足以捕获全局信息? +使用全局均值池化来获取全局信息。 +### early fusion && late fusion +late fusion全局特征向量如何学习自己的分类器? +### L2 normalization layer + +``` +Naively concatenating features leads to poor performance as the ”larger” features dominate the ”smaller” ones. Although during training, the weight might adjust accordingly, it requires very careful tuning of parameters and depends on dataset, thus goes against the robust principle. +``` + +使用L2范数归一化并为每一通道学习scale参数(是受到BN的启发) +需要为特征图上的每一个像素做L2归一化 + +## experiments + +## tips + +w/o: without +w/ : with + +是对图像分割网络的改进,提出了L2 Normalization在S3FD中有用到,是模仿BN的操作,是对一个位置的特征向量做标准化再乘以一个可学习的系数。 diff --git a/essay/segmentation/summary.md b/essay/segmentation/summary.md new file mode 100644 index 0000000..33e6823 --- /dev/null +++ b/essay/segmentation/summary.md @@ -0,0 +1,4 @@ +# model + +[segmentation](https://github.com/qubvel/segmentation_models) +[glouncv-segmentation](https://gluon-cv.mxnet.io/model_zoo/classification.html) \ No newline at end of file diff --git a/essay/segmentation/upsample.md b/essay/segmentation/upsample.md new file mode 100644 index 0000000..18dd2ee --- /dev/null +++ b/essay/segmentation/upsample.md @@ -0,0 +1,33 @@ +# the devil is in the decoder 2017 google + +## contribution + +1. Decoder很重要,不同的decoder在不同的任务中会导致不同的结果 +2. 提出bilinear additive upsampling +3. 提出residual-like connections for decoder +4. 两种decoder的性能一致? + +## upsample操作 + +1. transposed convolution +2. depth to space +3. bilinear upsampling,在upsample之后,往往接convolution,它的计算量是方法1的4倍? + +作者提出的bilinear additive upsampling其实是2和3的融合,即先bilinear upsampling,再每N个通道相加,保持特征图的参数量不变。 + +- skip connection,使用concate +- residual connections for decoder + +## experiments + +对与语义分割, + +- residual不起作用, +- skip-connection有作用, +- Separable transposed有用,就是将不同通道之间分离了,有点像depth-wise convolution. +- depth to space比较差 +- bilinear additive upsample + +## tips + +1. 像素预测的任务一般叫做dense problems \ No newline at end of file diff --git a/essay/ship/car.md b/essay/ship/car.md new file mode 100644 index 0000000..0b9e5c2 --- /dev/null +++ b/essay/ship/car.md @@ -0,0 +1,5 @@ +# Towards End-to-End Car License Plates Detectionand Recognition with Deep Neural Networks 2018 ECCV +2018-09-04 15:40 + +使用VGG-16作为backbone,结合RPN与Roi + diff --git a/essay/ship/rdfpn.md b/essay/ship/rdfpn.md new file mode 100644 index 0000000..3b0c542 --- /dev/null +++ b/essay/ship/rdfpn.md @@ -0,0 +1,16 @@ +# Automatic Ship Detection of Remote Sensing Images from Google Earth in Complex Scenes Based on Multi-Scale Rotation Dense Feature Pyramid Networks 2018 + +## proposed method +网络结构主要由两部分组成 +1. dense feature pyramid network提取特征 +2. rotation region detection network做出预测 + +## 2.1 DFPN +P2,P3,P4,P5做预测 + +## 2.2 RDN + +数据是从Google Earth上收集的图片,共8000幅图片。 +16,393 16,393 × pixels, covering 400 square kilometers. +把图像切分成了重叠0.1的600x1000的子块 + diff --git a/essay/ship/yolt.md b/essay/ship/yolt.md new file mode 100644 index 0000000..1888038 --- /dev/null +++ b/essay/ship/yolt.md @@ -0,0 +1 @@ +# you only look twice 2018 \ No newline at end of file diff --git a/essay/slam/list.md b/essay/slam/list.md new file mode 100644 index 0000000..553dc59 --- /dev/null +++ b/essay/slam/list.md @@ -0,0 +1 @@ +# Efficient Outlier Removal for Large Scale GlobalStructure-from-Motion \ No newline at end of file diff --git a/essay/term.md b/essay/term.md index 9a8bbc2..9610c73 100644 --- a/essay/term.md +++ b/essay/term.md @@ -6,4 +6,9 @@ - mAP: mean average precision 应用在信息检索与多类目标检测领域,在多类目标检测领域中,average precision是每一类的precision-recall计算的一个值,不等于AUC,mAP是多个类的平均值 - auc: area under curve -一种分类算法的benchmark方法,但是不敏感,所以被mAP替代 \ No newline at end of file +一种分类算法的benchmark方法,但是不敏感,所以被mAP替代 + +## +- N/A: not available,不适用 +- w/o: without +- w: with \ No newline at end of file diff --git a/essay/vgg.md b/essay/vgg.md deleted file mode 100644 index f710f90..0000000 --- a/essay/vgg.md +++ /dev/null @@ -1,5 +0,0 @@ -# very deep convolutional networks for large-scale image recognition 2014 - -## classification network -最后的两层全连接后都接dropout(p=0.5)层,具体如下: -> $$fc \rightarrow relu \rightarrow dropout(p=0.5)$$ \ No newline at end of file diff --git a/essay/yolo9000.md b/essay/yolo9000.md deleted file mode 100644 index 9b1401d..0000000 --- a/essay/yolo9000.md +++ /dev/null @@ -1,51 +0,0 @@ -# YOLO9000: Better, Faster, Stronger - -## abstract -67fps yolov2 76.8mAP on VOC2007 -40fps yolov2 78.6mAP on VOC2007 - -yolov2与yolo9000是两个独立的模型,yolov2是基于yolo改进而得到的。 -使用目标检测数据集COCO与图像分类数据集ImageNet联合训练出yolo9000,使用联合训练能够使网络检测那些只有分类标签的数据。 -## introduction -目标检测数据集 ImageNet, coco, PASCAL VOC -图像分类数据集 Yfcc100m, …… -提出了一种联合数据集(hierarchical view),还有一种联合训练的方法。 - -## better -yolo相对于其它region proposal的方法,召回率更低,并且通过error analysis yolo的localization errors较大,所以yolov2着重于改善定位精度与recall,而维持分类精度 -- batch normalization -在所有卷基层的后面添加BN层,提高mAP 2%,BN能够起到规则化的作用,所以dropout可以省略 -- high resolution classifier -大部分检测网络都是使用ImageNet上的预训练好的网络,从AlexNet开始,输入图像的大小就小于$256\times 256$,原始的yolo预训练时使用分辨率为$224\times 224$,检测时将图像扩大到$448\times 448$,这意味着预训练的网络需要同时调整适应目标检测任务与适应扩大的输入图像。所以,作者使用$224\times 224$预训练好后,又在ImageNet上使用$448\times 448$进行了10 epoch的分类训练,再拿来训练目标检测任务的。 -- convolutional with anchor boxes -yolo使用卷积特征接全连接直接预测目标bounding box,faster rcnn使用hand-picked priors来预测目标bounding box。 -使用anchor box会遇到两个问题,1.要人工选择prior box,2.model instability,分别对应以下两点。 -- dimension clusters (dimension指图像的长和宽) -使用聚类来预定义框的中心位置和尺度,而不是如ssd一样的均匀分布,计算上IOU会更好一点 -- direct location prediction -采用了和yolo同样的方法,直接预测相对于grid cell的坐标,这会约束label为$0-1$范围内,同时,使用logistic来约束预测到$0-1$范围内。 -网络每个grid cell预测$5$个bounding box,看不懂??? -最后作者使用了dimension clusters和location prediction。 -- fine-grained features -特征图改为$13\times 13$,ssd和faster r-cnn是直接使用了前几层特征图来预测,而yolo是直接将前几层的特征图经过resize然后concatate到了后面的特征图上。 -- multi-scale training -yolov2仅使用了卷积和池化,所以训练时,可以任意改变输入图像的大小,而不需要更改模型。具体是每隔10个batch随机选取一个输入图像尺寸,然后以这个尺寸训练,因为youloV2的输出缩小了$32$倍,所以预设的输入图像大小以$32$为间隔,即$320,352...,608$。 - -## faster -yolo是基于googlenet的 -- darknet-19 -作者提出的分类网络,用于yolov2,yolov2是完全作者设计的19层卷积,72.9% 准确率在ImageNet上的1000分类上。 -- training for classification -学习率初始为0.1,以多项式衰减 power of 4,数据增强,random crops, rotations, hue, saturation, exposure shifts -先在$224\times 224$上训练,再以$448\times 448$为输入做分类微调 -- training for detection -移除最后一层卷积,替换为3层$3\times 3$的卷积,最后使用$1\times 1$的卷积,输出$5*(5+20)=125$维数据(对应125 filters) -## stronger -提出了一种在分类、检测数据集上一起进行训练的方法 -检测数据集上进行全损失的计算,分类数据集的只进行分类损失的计算。 -- hierarchical classification - - -## conclusion -yolov2 a state of the art 更快的目标检测系统, -yolo9000使用ImageNet和COCO联合训练的检测超过9000类目标的检测系统,使用WordTree。 \ No newline at end of file diff --git a/image/BitmapHImageConversion-300x155.png b/image/BitmapHImageConversion-300x155.png new file mode 100644 index 0000000..5a81bae Binary files /dev/null and b/image/BitmapHImageConversion-300x155.png differ diff --git a/image/essay/match.png b/image/essay/match.png new file mode 100644 index 0000000..637fd53 Binary files /dev/null and b/image/essay/match.png differ diff --git a/image/essay/mtcnn.jpg b/image/essay/mtcnn.jpg new file mode 100644 index 0000000..04dd7dc Binary files /dev/null and b/image/essay/mtcnn.jpg differ diff --git a/image/essay/pyramid.jpg b/image/essay/pyramid.jpg new file mode 100644 index 0000000..410febe Binary files /dev/null and b/image/essay/pyramid.jpg differ diff --git a/image/essay/rcnn123.jpg b/image/essay/rcnn123.png similarity index 100% rename from image/essay/rcnn123.jpg rename to image/essay/rcnn123.png diff --git a/image/essay/relationmodule.jpg b/image/essay/relationmodule.png similarity index 100% rename from image/essay/relationmodule.jpg rename to image/essay/relationmodule.png diff --git a/image/essay/resnet.jpg b/image/essay/resnet.jpg new file mode 100644 index 0000000..e57efc1 Binary files /dev/null and b/image/essay/resnet.jpg differ diff --git a/image/essay/tll.jpg b/image/essay/tll.jpg new file mode 100644 index 0000000..3190709 Binary files /dev/null and b/image/essay/tll.jpg differ diff --git a/image/program/gpumemory.png b/image/program/gpumemory.png new file mode 100644 index 0000000..acde50f Binary files /dev/null and b/image/program/gpumemory.png differ diff --git a/item/ageestimation.md b/item/ageestimation.md index 17e8347..7c4bb1c 100644 --- a/item/ageestimation.md +++ b/item/ageestimation.md @@ -10,10 +10,13 @@ user: adiencedb password: adience ## multi-view face detection + 提出全连接转为卷积的方法,生成heat map,由于训练集中包含各种方向的脸所以,训练模型可以检测任意方向的脸 基于AlexNet进行修正 deep dense face detector(DDFD) + - fine-tunning a pre-trained AlexNet for face detection + AlexNet 共8层网络,前5层是卷及网络,后3层是全连接网络 [14] 作者通过改变网络层的参数把全连接网络的计算方式转成了卷积网络 非极大值抑制确定脸的位置 @@ -33,6 +36,7 @@ deformable part models 意义:因为卷积网络是对输入图像的遍历窗口与卷积核的乘积,遍历步骤使输出结果成为一幅图像。通过全连接转为卷积,使AlexNet的5层卷积+3层全连接转为全部是卷积网络,这样对于一幅输入图像,通过AlexNet后得到的依旧是图像,即heatmap ### [14] DenseNet: implenting efficient convnet descriptor pyramids + 本篇论文提出了DenseNet,主要为了避免因为选框的重叠区域而造成重复计算,而设计的 denseNet feature descriptors 提取方法 - multiscale image pyramids for cnns @@ -44,6 +48,7 @@ deformable part models #### [4] Alexnet: imagenet classification with deep convolutional neural networks + 5层卷积、3层全连接 从3*227*227输入 local response normalization 局部归一化公式 diff --git a/item/buy.md b/item/buy.md deleted file mode 100644 index 4cef71f..0000000 --- a/item/buy.md +++ /dev/null @@ -1,6 +0,0 @@ -武汉星巡智能科技有限公司 -91420111MA4KQRW44L -洪山区南湖大道53号南湖创业园三楼3001室 -13554187813 -汉口银行华中农业大学支行 -016021000131084 \ No newline at end of file diff --git a/item/customer.md b/item/customer.md index b0d8106..6c6b494 100644 --- a/item/customer.md +++ b/item/customer.md @@ -1,4 +1,5 @@ ## background substraction + [专业书籍](Background Modeling and Foreground Detection for Video Surveillance) [background substraction](https://en.wikipedia.org/wiki/Background_subtraction) 1. BackgroundSubtractorCNT diff --git a/item/defect/readme.md b/item/defect/readme.md new file mode 100644 index 0000000..9f6e0da --- /dev/null +++ b/item/defect/readme.md @@ -0,0 +1,2 @@ +比较好的商业软件深度学习工业检测 suakit +2048*2048 \ No newline at end of file diff --git a/item/faceReconition/face.md b/item/face/faceCollect.md similarity index 99% rename from item/faceReconition/face.md rename to item/face/faceCollect.md index c69a63f..ac4ea20 100644 --- a/item/faceReconition/face.md +++ b/item/face/faceCollect.md @@ -74,14 +74,15 @@ centerloss人脸识别 lbp特征:通过对原图像划分为多个不重叠的小块,单独统计小块内的lbp直方图作为特征,根据相似性度量来分类 lgbp直方图序列人脸识别:先做gabor变换,对gabor变换得到的图做lbp直方图统计 - ## Joint Cascade Face Detection and Alignment(MSRA,ECCV14) + [文章讲解](http://blog.jobbole.com/85783/) ## 数据库 + google的leveldb数据库,不适合做查询工作,不支持网络服务 sqlite是一个轻型的数据库 mysql跨平台,可以使用c++操作数据库 MariaDB,类似mysql -xml +xml protobuf:一般用于网络通信,把复杂数据转为序列化数据 \ No newline at end of file diff --git a/item/faceDetect/face.md b/item/face/faceDetect.md similarity index 100% rename from item/faceDetect/face.md rename to item/face/faceDetect.md diff --git a/item/face/faceRecognition.md b/item/face/faceRecognition.md new file mode 100644 index 0000000..4b14bca --- /dev/null +++ b/item/face/faceRecognition.md @@ -0,0 +1 @@ +[very good face recognition summation](https://xraft.github.io/2018/03/21/FaceRecognition/) \ No newline at end of file diff --git a/item/faceReconition/hongruan.md b/item/face/hongruan.md similarity index 100% rename from item/faceReconition/hongruan.md rename to item/face/hongruan.md diff --git a/item/faceReconition/seetaface.md b/item/face/seetaface.md similarity index 100% rename from item/faceReconition/seetaface.md rename to item/face/seetaface.md diff --git a/item/headDetect.md b/item/headDetect.md index 4f5de30..431dcbd 100644 --- a/item/headDetect.md +++ b/item/headDetect.md @@ -1,9 +1,12 @@ ## haar+adaboost + 正样本大于5000时,基本训练不出结果。 ## hog+svm + 需要使用难例学习,即先用大量负样本训练出一个分类器,然后用这个分类器检测一个易被误检成正样本的图片,保存下来,作为负样本。然后重新训练。 ## ssd + 简化版ssd,开始使用的是3层卷积,效果很不好,之后加了两层卷积,效果得到了较高的改善,之后再加卷积层,效果没有继续提升。 收集了2000样本,训练出的模型只对个别视频效果较好,没有很好的泛化能力,特别是阳光直射到头上时,基本检测不出。 \ No newline at end of file diff --git a/item/opticalFlow.md b/item/opticalFlow.md index 4fff8a5..f747e5a 100644 --- a/item/opticalFlow.md +++ b/item/opticalFlow.md @@ -1,6 +1,7 @@ -光流 ------ +# 光流 + ## KLT实现 + - https://en.wikipedia.org/wiki/Kanade%E2%80%93Lucas%E2%80%93Tomasi_feature_tracker - http://cecas.clemson.edu/~stb/klt/ 纯c版本,不依赖于opencv,wiki上有链接,比opencv的精度差,计算量大,内存消耗高,并存在内存泄露 @@ -8,12 +9,17 @@ - opencv自带版本 ## log + 自己写个统计直方图的东西,万成类似ransac的功能 + ## 光电鼠标使用的技术叫做 digital image correlation. + - cross-correlation + 用于表示两幅图像灰度之间的相似度大小 ### 光流原理 + - 亮度守恒公式 > $$\begin{aligned} I(x,y,t)&=I(x+\Delta x, y+\Delta y, t+\Delta t) \\ @@ -30,29 +36,39 @@ I(x,y,t)&=I(x+\Delta x, y+\Delta y, t+\Delta t) \\ 这个方程具有两个变量,所以是欠拟合的,这里讲是具有孔径问题,需要添加其它约束来求解。 ## 1. Iterative Lucas Canade + 由于孔径问题的存在,这里加了一个约束、局部运动一致性,即在一个小窗口内的像素的运动量是相同的。 -使用牛顿法又称为(newton method, newton-raphson fashion)方法迭代求解 -- essay +使用牛顿法又称为(newton method, newton-raphson fashion)方法迭代求解 + +- essay + Pyramidal Implementation of the Lucas Kanade Feature Tracker Description of the algorithm 最大有效移动距离,应该是选择计算hessian矩阵窗口的大小, + ## 2. simple flow ## 3. 光流李平 + - essay -论文在百度云->slam + +论文在百度云->slam Robust Sensing and Control of Micro Aerial Vehicles using a Monocular Camera and an Inertial Measurement Unit -- robust template matching + +- robust template matching + 首先对灰度图像做处,公式为ISC(Incremental Sign Correlation) > $$I_b(x,y)=\begin{cases} 1 & \text{if } I(x,y+1)>I(x,y),\\ 0 & \text{otherwise}. \end{cases}$$ 代价函数(匹配规则,NNMP,the Number of Non-Matching Points) -$$NNMP(x,y)=\sum_{m=-l}^{l}\sum_{n=-l}^{l}I_b(x,y,t) \otimes I_b(x+m+u,y+n+v,t-1) $$ +> $$NNMP(x,y)=\sum_{m=-l}^{l}\sum_{n=-l}^{l}I_b(x,y,t) \otimes I_b(x+m+u,y+n+v,t-1) $$ 其中,$\otimes$为异或符号,(u,v)为运动量。 上面公式的实现,可以使用查找表,可以参见论文。 -- Roubust Lucas Kanade + +- Roubust Lucas Kanade + 对图像做了个变换再进行LK算法,变换公式 > $$I_b(x,y)=\begin{cases} max &\text{if } I(x+m,y+n)>I(x,y),\\ @@ -60,16 +76,19 @@ min &\text{otherwise}. \end{cases}$$ ## 4. px4flow + size: 188*120 包含了两种方法块匹配和LK。 + ## 5. 快匹配 + 可以尝试下对二值化图像做快速匹配 ## camera -ov7251 - +ov7251 ## tips + 1. covariation matrix 协方差矩阵 2. opencv pyrlk算法函数(calcOpticalFlowPyrLK) \ No newline at end of file diff --git a/item/patents.md b/item/patents.md new file mode 100644 index 0000000..24a43d1 --- /dev/null +++ b/item/patents.md @@ -0,0 +1 @@ +已提交专利修改时只能删减内容不能添加字。 \ No newline at end of file diff --git a/item/pedestrian.md b/item/pedestrian.md index d97879b..acbe692 100644 --- a/item/pedestrian.md +++ b/item/pedestrian.md @@ -1,4 +1,5 @@ -### dataset +# dataset + - [CityPersons](https://www.cityscapes-dataset.com/) account:lixiaoguang key:hust2012,需要等待管理员验证 由于citypersons是基于cityscapes的语义分割数据集标注得来的,所以在cityscapes网站上 @@ -7,21 +8,24 @@ - [USC行人数据库](http://iris.usc.edu/Vision-Users/OldUsers/bowu/DatasetWebpage/dataset.html) 该数据库包含三组数据集(USC-A、USC-B和USC-C),以XML格式提供标注信息。USC-A[Wu, 2005]的图片来自于网络,共205张图片,313个站立的行人,行人间不存在相互遮挡,拍摄角度为正面或者背面;USC-B的图片主要来自于CAVIAR视频库,包括各种视角的行人,行人之间有的相互遮挡,共54张图片,271个行人;USC-C有100张图片来自网络的图片,232个行人(多角度),行人之间无相互遮挡。 - [INRIA数据库](http://pascal.inrialpes.fr/data/human/) - 该数据库是目前使用最多的静态行人检测数据库,提供原始图片及相应的标注文件。训练集有正样本614张(包含2416个行人),负样本1218张;测试集有正样本288张(包含1126个行人),负样本453张。图片中人体大部分为站立姿势且高度大于100个象素,部分标注可能不正确。图片主要来源于GRAZ-01、个人照片及google,因此图片的清晰度较高。在XP操作系统下部分训练或者测试图片无法看清楚,但可用OpenCV正常读取和显示。 -- [MIT数据库]() - 该数据库为较早公开的行人数据库,共924张行人图片(ppm格式,宽高为64x128),肩到脚的距离约80象素。该数据库只含正面和背面两个视角,无负样本,未区分训练集和测试集。Dalal等采用“HOG+SVM”,在该数据库上的检测准确率接近100%。 + 该数据库是目前使用最多的静态行人检测数据库,提供原始图片及相应的标注文件。训练集有正样本614张(包含2416个行人),负样本1218张;测试集有正样本288张(包含1126个行人),负样本453张。图片中人体大部分为站立姿势且高度大于100个象素,部分标注可能不正确。图片主要来源于GRAZ-01、个人照片及google,因此图片的清晰度较高。在XP操作系统下部分训练或者测试图片无法看清楚,但可用OpenCV正常读取和显示。 +- [MIT数据库](a) + 该数据库为较早公开的行人数据库,共924张行人图片(ppm格式,宽高为64x128),肩到脚的距离约80象素。该数据库只含正面和背面两个视角,无负样本,未区分训练集和测试集。Dalal等采用“HOG+SVM”,在该数据库上的检测准确率接近100%。 + +## algorithm -### algorithm - ACF(aggregate channel features),积分通道特征 通道可以通过原图像线性变换或非线性变换得到,通道应该具有平移变换不变性,其中,I为输入图像,C为通道,使用Omega表示通道的生成函数 $$C=\Omega(I) \longrightarrow C'=\Omega(I')$$ ## code + [openFrameWork 行人检测开源代码](https://bitbucket.org/fdesmedt/) ## essay -- integral channel features 2009     - 目标检测包括两部分内容: 1,特征提取,2,学习算法       + +- integral channel features 2009 + 目标检测包括两部分内容: 1,特征提取,2,学习算法 这篇文章使用boost的方法,集中注意力于特征提取方面.作者把由图像进行线性或非线性变换得到的图像称为通道(channel),这些通道满足平移不变性,在通道上使用integral images(积分图)获得的特征为integral channel features,这些特征通过积分图获取计算速度很快. 包括 LUV(三通道)+Grad(一通道)+Hist(六个方向的梯度通道) 共十个通道,特征在各通道使用积分图单独获取. adaboost, realboost, logitboost, 决策树adaboost,软级联adaboost @@ -32,8 +36,9 @@ 通过对特征图插值生成特征金字塔. 128*64窗口内,128*64*10/16=5120维特征,10指存在十个通道,16指4*4的小块取和. 使用adaboost训练2048深度的两个树 - -## reading + +## reading + http://blog.csdn.net/carson2005/article/details/8455837 http://blog.csdn.net/rainbow0210/article/details/53586385 [原理讲解](http://blog.csdn.net/xiny520/article/details/51460148) diff --git a/item/resume.md b/item/resume.md index 72690d8..8ad1de5 100644 --- a/item/resume.md +++ b/item/resume.md @@ -1,5 +1,7 @@ # 简历参考 + [很简洁](https://github.com/DuinoDu/duinodu.github.io/blob/master/pdf/resume.pdf) ## 个人网页 + http://dumin.me/ \ No newline at end of file diff --git a/item/segmantation.md b/item/segmantation.md new file mode 100644 index 0000000..4898404 --- /dev/null +++ b/item/segmantation.md @@ -0,0 +1 @@ +[semantic segmantation](https://github.com/CSAILVision/semantic-segmentation-pytorch) \ No newline at end of file diff --git a/item/ship.md b/item/ship.md new file mode 100644 index 0000000..03a69f8 --- /dev/null +++ b/item/ship.md @@ -0,0 +1,34 @@ +## digitalGlobe/spaceNet数据集下载 +[教程](https://blog.csdn.net/DynastyRumble/article/details/76649120) +[下载地址](https://spacenetchallenge.github.io/datasets/datasetHomePage.html) +[aws cli配置](https://aws.amazon.com/cn/cli/),不需要信用卡就可以创建有读权限的用户。 + +- 5kx4k +- 灰度 2-6m +- 红外 10-20m +- RGB 4-12m + +aws s3api get-object --bucket spacenet-dataset --key spacenet-dataset/AOI_5_Khartoum/srcData/rasterData/RGB-PanSharpen/5APR13081815-S2AS_R04C3-056155973020_01_P001.TIF -request-payer requester 5APR13081815-S2AS_R04C3-056155973020_01_P001.TIF + +aws s3api get-object --bucket spacenet-dataset --key SpaceNet_Roads_Competition/srcData/rasterData/RGB-PanSharpen/5APR13081815-S2AS_R04C3-056155973020_01_P001.TIF --request-payer requester 5APR13081815-S2AS_R04C3-056155973020_01_P001.TIF + +s3cmd sync s3://SpaceNet_Roads_Competition/srcData/rasterData/RGB-PanSharpen . + + +aws s3 cp s3://spacenet-dataset/test1.txt ^C + +- 浏览 +aws s3 ls s3://spacenet-dataset/AOI_5_Khartoum/srcData/rasterData/RGB-PanSharpen/ --request-payer requester +- 下载文件夹 +aws s3 cp s3://spacenet-dataset/AOI_5_Khartoum/srcData/rasterData/RGB-PanSharpen/ . --recursive +- 上传 有问题 +aws s3 sync . s3://spacenet-dataset/AOI_5_Khartoum/srcData/rasterData/RGB-PanSharpen/5APR13081815-S2AS_R04C3-056155973020_01_P001.TIF +- 下载 有问题 +aws s3 sync s3://spacenet-dataset/AOI_5_Khartoum/srcData/rasterData/RGB-PanSharpen/5APR13081815-S2AS_R04C3-056155973020_01_P001.TIF . + +aws s3 cp s3://spacenet-dataset/AOI_5_Khartoum/srcData/rasterData/RGB-PanSharpen/5APR13081815-S2AS_R04C3-056155973020_01_P001.TIF . + + +## tips +[航空遥感图像数据集收集](https://blog.csdn.net/hongxingabc/article/details/78833485) +[airbus kaggle competition](https://sandbox.intelligence-airbusds.com/web/) diff --git a/linux/chrome.md b/linux/chrome.md deleted file mode 100644 index 85cac74..0000000 --- a/linux/chrome.md +++ /dev/null @@ -1,10 +0,0 @@ -## 快捷键 -1. ctrl+e ctrl+k 将光标移至浏览器搜索框,使用浏览器默认引擎搜索 -2. ctrl+pageup ctrl+shift+tab 前向翻标签页 -3. ctrl+pagedown ctrl+tab 后向翻标签页 -4. - -## 问题 -- 点击vscode里的一个超链接,chrome只能打开一个新窗口,但不能打开链接 -[解决方法](http://forum.ubuntu.org.cn/viewtopic.php?t=478689) -大体意思,是打开链接的参数没有传给chrome,所以要修改google-chrome.desktop文件 diff --git a/linux/command.md b/linux/command.md index d2ef41e..ee771c4 100644 --- a/linux/command.md +++ b/linux/command.md @@ -1,35 +1,37 @@ ## 内部命令&&外部命令 + linux的命令有内部命令与外部命令之分,可以使用“type COMMAND”来区分。 ## 终端多条指令执行 + - 使用分号(;)隔开,指令顺序执行,执行结果互不影响 - 使用与 (&&),前一条命令执行成功,才会进行下一条指令 - 使用或 (||),从前往后执行命令,如果命令遇到成功执行的指令,则停止执行命令 ## 常用命令 + - find **$ find <指定目录> <指定条件> <指定动作>** [doc](http://www.ruanyifeng.com/blog/2009/10/5_ways_to_search_for_files_using_the_terminal.html) -find 默认搜索当前目录及其子目录,并不过滤任何结果。 +find 默认搜索当前目录及其子目录(如果是软连接好像会失效),并不过滤任何结果。 + ```shell -# 使用实例,需要使用引号 -$ find . -name 'my*' -# 搜索当前目录,文件名以 my 开头的文件 -$ find . -name 'my*' -ls -# 搜索当前目录,文件名以 my 开头的文件,并且显示它们的详细信息。 -$ find . -type f -mmin -10 -# 搜索当前目录中,所有过去10分钟中更新过的普通文件。 如果不加 '-type f'则搜索普通文件+特殊文件?+目录 +find . -name 'my*' # 使用实例,需要使用引号 +find . -name 'my*' -ls # 搜索当前目录,文件名以 my 开头的文件,并且显示它们的详细信息。 +find . -type f -mmin -10 # 搜索当前目录中,所有过去10分钟中更新过的普通文件。 如果不加 '-type f'则搜索普通文件+特殊文件?+目录 +find processed/ -name '*2011*.xml' -exec cp {} /home/shantanu/tosend \; ``` + - info [command]、man -k [command],查看帮助信息 -- locate 定位文件 -```shell -# 是在一个数据库里查找,这个数据库每天只更新一次,可以使用 sudo updatedb 来手动更新数据库 -``` -- watch 监控设备 +- locate 定位文件是在一个数据库里查找,这个数据库每天只更新一次,可以使用 sudo updatedb 来手动更新数据库 + +- watch 监控设备 + ```shell # 比如监控GPU watch -n 1 -d nvidia-smi ``` + - type: 用于区分某个命令是否来自shell - top :display linux processes - whereis 已安装软件位置查询,以及配置文件 @@ -49,72 +51,82 @@ watch -n 1 -d nvidia-smi - kill -9 $(ps -ef | grep xelatex | awk '{print $2}') : 查杀xelatex进程 - chmod 修改权限 - free -h 显示内存消耗 -- +- mutex: 一个优秀的终端复用器类软件,可以替换nohup +- tee: 复制标准输入到标准输出 +- | :管道,将上一个命令的标准输出(不包含标准错误)作为下一个命令的标准输入 +- 2>&1 :将标准错误2重定向到标准输出1上 + +## sudo + +sudo: SuperUser do +su: Switch User +默认安全策略 /etc/sudoers,sudo可以为普通用户提升操作权限,这样就可以省去切换到root再执行sudo命令的麻烦。 ## 例行性任务调度 -crontab + +crontab -e 编辑任务 -l 显示任务 service cron status 显示cron服务的状态 在crontab内使用命令时,要注意把环境变量引入,例如使用notify-send命令时,要特别注意"DISPLAY=:0"变量的引入,否则通知不会正常显示。 ## 磁盘管理 + - fdisk -l 列出硬盘分区表、容量大小、及分区类型,看不到文件系统类型 - df -h 查看已挂载磁盘的空间使用情况 - du 文件大小列表 - parted 功能强大 + ```shell sudo parted /dev/sda # 进入parted环境 (parted) print list # (parted) 环境提示符,输出硬盘分区及文件系统 ``` ## 软件包管理 + - apt(advanced packaging tool,应该是基于dpkg的,即获取到包后使用dpkg安装包) + ```shell apt-cache search -apt-get install +apt-get install pac1 pac2 # 安装(更新)指定包 apt-get reinstall -apt-get remover [--purge(删除包及配置文件)] -#更新源 -apt-get update -#更新已安装的包 -apt-get upgrade -#升级系统 -apt-get dist-upgrade +apt-get remove # 删除软件,保留配置 +apt-get remover [--purge # (删除包及配置文件)] +apt-get purge # 删除软件及配置 +apt-get update #更新源 +apt-get upgrade #更新已安装的包 +apt-get dist-upgrade #升级系统,有风险,最好不 +apt-mark hold # 指定不更新某包,但仍会更新源,源的设置在system setting +apt-mark unhold # 取消不跟新的设定 ``` + - dpkg(debian package,ubuntu是源自debian的linux发行版本) 是一个比较底层的工具 + ```shell -#卸载 purge,不保留配置文件 -dpkg -P -#卸载,保留配置文件 -dpkg -r -#显示所有已安装的deb包,同时显示版本号及剪短说明 -dpkg -l -#显示特定包的信息 -dpkg -s PACKAGENAME +dpkg -P #卸载 purge,不保留配置文件 +dpkg -r #卸载,保留配置文件 +dpkg -l #显示所有已安装的deb包,同时显示版本号及剪短说明 +dpkg -s PACKAGENAME #显示特定包的信息 ``` + - yum(yellow dog updater, modified) 是一个前端软件包管理器,基于rpm包管理 ```shell -# 安装包 -yum install package -# 卸载包 -yum remove package +yum install package # 安装包 +yum remove package # 卸载包 ``` - rpm(redhat package management) ```shell -# 卸载包 -rpm -e -# 查询已安装的包 -rpm -q -# 安装包 -rpm -i -# 升级包 -rpm -u +rpm -e # 卸载包 +rpm -q # 查询已安装的包 +rpm -i # 安装包 +rpm -u # 升级包 ``` + ## 内核操作 + ```shell #内核操作 #ubuntu更新内核,切换内核启动 http://www.bkjia.com/xtzh/952429.html @@ -128,3 +140,7 @@ sudo apt-get purge linux-image # 删除后要使用命令下条命令更新grub sudo update-grub ``` + +## net + +- arp: manipulates or displays the kernel's IPv4 network neighbour cache. It can add entries to the table, delete one or display the current content \ No newline at end of file diff --git a/linux/computer.md b/linux/computer.md index 34554ae..b41bcdf 100644 --- a/linux/computer.md +++ b/linux/computer.md @@ -6,8 +6,7 @@ bios下有个function key可以把media key关掉 [ipv6 google](http://ipv6.google.com.hk/?gws_rd=cr ) 服务器配置 -cpu Intel(R) Core(TM) i7-6800K CPU @ 3.40GHz +主板 X99-UD4-CF +cpu Intel(R) Core(TM) i7-6800K CPU @ 3.40GHz 12线程 gpu 1080ti - - diff --git a/linux/hexo.md b/linux/hexo.md index 8ca79a1..b926c4d 100644 --- a/linux/hexo.md +++ b/linux/hexo.md @@ -1,15 +1,24 @@ +# hexo + [hexo博客配置,个人主页示例](https://xzhewei.github.io/2017/09/29/Hexo-%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/) [hexo mathjax](http://yelog.org/2017/07/05/3-hexo-mathjax/) 公式显示不正常 + ## 操作 + +```shell 先hexo g再执行hexo d布署,也可使直接用hexo d -g hexo -s # 本地网页浏览 +``` ## tips + - 根目录下_config.xml是站点配置文件,主题目录下_config.xml是主题配置文件 - hexo 更新到3.0之后,deploy的type 的github需要改成git -- 在执行 hexo deploy 后,出现 error deployer not found:git 的错误处理 +- 在执行 hexo deploy 后,出现 error deployer not found:git 的错误处理 + 输入代码: + ```shell npm install hexo-deployer-git --save ``` \ No newline at end of file diff --git a/linux/network.md b/linux/network.md index fccb61d..ea9179a 100644 --- a/linux/network.md +++ b/linux/network.md @@ -1,10 +1,109 @@ -1. 进行ping扫描,打印出对扫描做出响应的主机  +# network + +1. 进行ping扫描,打印出对扫描做出响应的主机 + + ```sh + nmap nmap -sP 192.168.1.0/24 + ``` + +2. 扫描之后查看arp缓存表获取局域网主机IP地址(可以获取到mac地址) + + ```sh + cat /proc/net/arp + ``` + +dell服务器的mac地址是 1c:1b:0d:9e:dd:64 + +## 网络 + +osi七层网络模型:物理层->数据链路层-网络层->传输层->会话层->表示层->应用层 +实际使用五层协议栈:物理层->链路层->网络层->传输层->应用层 + +## 代理 + +socks4只能代理tcp协议,而socks5什么协议都可以代理。 +qq使用udp协议 +socks协议工作在会话层,http协议工作在应用层。 +系统代理就是系统设置中有一项是代理服务器设置,也就叫做系统代理。一般而言,只有浏览器会自动调用系统代理进行连接,其它软件如dropbox客户端需要手动设置代理,默认无代理,即直接连接。 + +## 翻墙 + +- google-chrome 插件 tunnello +- hosts更新地址 [1](https://blog.my-eclipse.cn/host-google.html), + ```sh -nmap nmap -sP 192.168.1.0/24  +hosts更改方法,linux下的文件在/etc/hosts ``` -2. 扫描之后查看arp缓存表获取局域网主机IP地址(可以获取到mac地址) +## 清空dns + +```sh +Linux下DNS缓存实现通常有两种方式: +一种是用DNS缓存程序NSCD(name service cache daemon)负责管理DNS缓存。 +一种实现DNS缓存则是用Bind来架设Caching Name Server来实现。 + +如果是清除NSCD上的Cache,可重新启动NSCD服务来达成清除DNS Cache的效果。用这个命令: +# service nscd restart +或是 +#/etc/init.d/nscd restart(这个起作用了) + +如果是清除BIND服务器上的CACHE,用这个命令: +# rndc flush + +如果你的DNS服务器是用dnsmasq实现的,用下面这个命令: +$ sudo /etc/init.d/dnsmasq restart + +注:DNSmasq是一个轻巧的,容易使用的DNS服务工具,它可以应用在内部网和Internet连接的时候的IP地址NAT转换,也可以用做小型网络的DNS服务。 +``` + +## ubuntu wifi + +两台主机通过一根网线构成局域网方法 +分别为两台主机设置IP和netmask(子网掩码),将两者中的一台主机IP设置为网关,即可通信 +ifconfig eth0 192.168.0.1 netmask 255.255.255.0 +route add default gw 192.168.0.1 +即可,只设置IP会ping不通。 + +一直提示 +essid:host name lookup failure//不设置ip地址 + +wlan :wireless local areas network +iwconfig: configure a wireless network interface +ifconfig: configure a network interface +netstat: print network connections,routine table; +iwlist: get more detailed wireless information from a wireless interface. +lsusb:输出usb设备 + +整整弄了一个晚上加上午,笔记本重新建立wifi后,树莓派奇怪的可以连接上了 +过了大概两周了,终于再次链接上了wifi,看了下鸟叔的书,才了解点知识,知道原理是什么,才不至于写命令那么无脑,动态ip应该不需要设置子网掩码,并且自己设置的一直是错的,配置过程如下: +iwconfig wlan0 essid "wifi-ssid"//原来一直输入ifocnfig,导致一直找不到主机名,不清楚原理,此处一定要用iwconfig +ifconfig wlan0 10.42.0.4//成功连接上,子网掩码自动设置为255.0.0.0,不知道为什么是这样,笔记本上是255.255.255.0,在这里浪费了很长时间 +子网掩码设置命令:ifconfig wlan0 netmask 255.255.255.0//需要有wlan0,否则提示无法找到设备 + ```sh -cat /proc/net/arp +(1)首先关闭开发板的有线网卡 +[root@FriendlyARM /]# ifconfig eth0 down +(2)加载USB WiFi无线网卡 +[root@FriendlyARM /]# ifconfig wlan0 up +(3)扫描可用的无线网络 +[root@FriendlyARM /]# iwlist scanning | grep ESSID +lo Interface doesn't support scanning. +eth0 Interface doesn't support scanning. +wmaster0 Interface doesn't support scanning. + ESSID:"FRIENDLY-ARM" + ESSID:"NETGEAR" + ESSID:"TP-LINK" +(4)选择要连接的无线网络 +[root@FriendlyARM /]# iwconfig wlan0 essid "FRIENDLY-ARM" +(5)输入该网络的安全密码//用户名怎么发送?没有解决 +[root@FriendlyARM /]# iwconfig wlan0 key s:12345 +(6)连接到指定的AP(无线路由) +[root@FriendlyARM /]# iwconfig wlan0 ap auto +(7)设置无线网卡的IP地址 +[root@FriendlyARM /]# ifconfig wlan0 192.168.1.120 +(8)使用 ping 命令检测无线网连通状况 +[root@FriendlyARM /]# ping 192.168.1.1 +PING 192.168.1.1 (192.168.1.1): 56 data bytes +64 bytes from 192.168.1.1: seq=0 ttl=64 time=42.804 ms +64 bytes from 192.168.1.1: seq=1 ttl=64 time=5.020 ms ``` -dell服务器的mac地址是 1c:1b:0d:9e:dd:64 \ No newline at end of file diff --git a/linux/program.md b/linux/program.md new file mode 100644 index 0000000..212b6fc --- /dev/null +++ b/linux/program.md @@ -0,0 +1,29 @@ +# linux编程相关 + +## 工程配置 + +![cmake](./cmake.md) + +## 编译 + +![gcc](./gcc.md) + +## 链接库 + +ldd [EXECUTABLE] 显示可执行文件的链接库 + +## 调试 + +![gdb](./gdb.md) +![kdbg](./kdbg.md) + +## 编译时遇到未定义等错误的排查方法 + +1. 检查链接路径是否正确(当然路径不正确会报找不到文件); +2. 检查链接到的库是不是想链接的目标库(例如链接到不同版本的同名库等); +3. 确保依赖关系正确,并检查链接顺序(比如a依赖b,那么a应该放在b的前面,编译tensorflow时,在这里浪费了两天时间); +4. 确认库的源代码.c或.cpp文件都被编译到,而且都被链接进了库中; +5. 用nm查看库的导出函数是否存在; +6. 确认库导出函数的名称与引用处的名称是否一致; +7. 其实这一点和第6点原因一致:确认工程是否cpp和c混用,如果是,请确保cpp文件用c++编译器编译,c文件用c编译器编译; +8. 如果上述方法还是没有解决问题,不可能啊!真的这样的话,就将库代码直接编进工程吧,或者换个库吧,或者换个Makefile吧(谁知道你写的Makefile有什么问题...) \ No newline at end of file diff --git a/linux/shell.md b/linux/shell.md index d84c032..5a3c552 100644 --- a/linux/shell.md +++ b/linux/shell.md @@ -1,69 +1,112 @@ -#!/bin/bash +# !/bin/bash + [doc](https://www.gnu.org/software/bash/manual/bashref.html) [shell编程 教程例子](http://tldp.org/LDP/abs/html/) ## 变量 + - positional parameters + $0 $1 $2:可以使用set和shift命令来赋值和删除赋值 $?: 上一条命令的执行状态 $# : 代表命令所携带参数的个数 - ## 环境变量 + $PATH:可执行程序的查找路径 $LD_LIBRARY_PATH:动态库的查找路径 export 导出环境变量,一个打开的shell的变量有导出变量列表与局部变量列表之分 ## 输入输出命令 -- read + +- read - echo ## 随机数 + linux自带了一个5位的随机数变量 + ```shell echo $RANDOM ``` ## 从一个txt随机输出n行 + ```shell shuf -n100 main.txt sort #这个命令好像也可以 ``` + ## 求两个txt文件的交集、并集、差集 + ```shell # 求解a.txt与b.txt的交集,sort命令读出a.txt与b.txt中的所有行并排序,uniq使得两个文件中的内容为唯一的,使用-d输出两个文件中次数大于1的内容,即是得到交集 sort a.txt b.txt | uniq -d # 求解两个文件的并集,将两个文件进行排序,uniq使得两个文件中的内容为唯一的,即可得到两个文件的并集 sort a.txt b.txt | uniq # 求解两个文件的差集,a.txt-b.txt, 将两个文件排序,最后输出a.txt b.txt b.txt文件中只出现过一次的内容,因为有两个b.txt所以只会输出只在a.txt出现过一次的内容(b.txt的内容至少出现两次),即是a.txt-b.txt差集;对于b.txt-a.txt同理。 -sort a.txt b.txt b.txt | uniq -u +sort a.txt b.txt b.txt | uniq -u ``` ## 统计文件行数并赋值给一个变量 + ```shell # 命令替换是指shell能够将一个命令的标准输出插在一个命令行中任何位置。shell中有两种方法作命令替换:把shell命令用反引号或者$(...)结构括起来,其中,$(...)格式受到POSIX标准支持,也利于嵌套 a=`wc -l < a.txt` ``` -## [变量的数学运算](http://blog.chinaunix.net/uid-20671208-id-3552751.html) +## [变量的数学运算] + +(http://blog.chinaunix.net/uid-20671208-id-3552751.html) + ```shell # 在shell中具有最基本的数学计算能力,如可以使用expr 、let 。但这些都只能处理整形数据。为了要计算小数,就需要通过bc命令扩展。 ``` + ## 正则表达式 -basic regular expression + +basic regular expression extended regular expression 表达式中的控制字符 $:匹配行尾 ## 关闭终端后仍然执行后台程序 + ```shell nohup PROGRAM & #nohup会把程序输出到nohup.out exit #据说要用exit,而不是直接点x号时会起作用 ``` +mutex: 一个优秀的终端复用器类软件,可以替换nohup + ## 查看文件大小 + ```shell du -d2 -h # -h hunman read, -d2 max deepth 2 df -h # 查看磁盘分区使用情况 ``` +## haroopad markdown编辑软件,有提示 + +## [tmux](http://kumu-linux.github.io/blog/2013/08/06/tmux/) + +session会话,一个服务器可以有多个会话 +window窗口,一个会话可以有多个窗口 +pane面板,一个窗口可以有多个面板(即分屏) + +ctrl+b 进入命令模式 +会话操作 +d 脱离当前会话,暂时返回shell界面,使用tmux attach可以重回会话 + +窗口操作 +c 创建新窗口 +& 关闭当前窗口 +数字键 切换到对应数字的窗口(从0开始编号) + +面板操作 +“ 上下分屏 +% 左右分屏 +x 关闭当前分屏 +q 显示面板编号 +o 切换当前窗口中的面板 +方向键 和o命令的作用相同,移动光标对应的面板 \ No newline at end of file diff --git a/linux/software.md b/linux/software.md index d0ea0cb..37db199 100644 --- a/linux/software.md +++ b/linux/software.md @@ -1,15 +1,26 @@ -## app -- foxit-reader linux 64bit [download](https://www.foxitsoftware.com/products/pdf-reader/) +# app + +## ubuntu software + +1. foxit-reader + linux 64bit [download](https://www.foxitsoftware.com/products/pdf-reader/) XchangePDFviwer 可以试下 卸载是直接在安装路径下,双击运行Uninstall - + - chrome : 可以直接sudo apt-get install, 也可以直接从 chrome 网站[下载](https://www.chrome64bit.com/) 或者 wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb + +```shell +sudo add-apt-repository ppa:canonical-chromium-builds/stage +sudo apt-get update +sudo apt-get install chromium-browser +``` + - ubuntu开wifi热点。 http://ubuntuhandbook.org/index.php/2014/06/share-internet-with-android-ubuntu-1404/ - 默认的显示图片命令 display - 搜狗输入法 http://pinyin.sogou.com/linux/?r=pinyin 安装ubuntu16.04英文版,用到的语言是英语,同样安装搜狗输入法,按照错误提示安装了fcixt后,重启出现了搜狗输入法。 - + - 安装git: sudo apt-get install git - linux opencv显示Mat类,可以查看像素值,需要装video播放mp4的插件 - 播放设想头视频windows amcap, linux cheese @@ -18,19 +29,20 @@ 安装: sudo pip install you-get 使用: you-get 'https://www.youtube.com/watch?v=jNQXAC9IVRw' 需要翻墙 [下载youtube](http://www.ytube.win/) 不需要翻墙 - -- 流程图绘制 graphviz + +- 流程图绘制 graphviz, 可以绘制UML图 [在线绘制processon](http://processon.com/diagraming/59589ac2e4b0a77c5ae8d900) - ubuntu录屏 simplescreenrecorder +- bt下载 transmission(linux)、deluge(linux) -- bt下载 transmission(linux) ```shell #安装依赖项 sudo apt-get install libssl-dev libssl-doc libcurl4-openssl-dev libevent-dev libevent-core-2.0-5 libevent-dev libevent-extra-2.0-5 libevent-openssl-2.0-5 libevent-pthreads-2.0-5 autoconf automake intltool libsigsegv2 m4 intltool #运行 transmission-gtk ``` + - 播放视频video需要装插件 gstreamer1.0-libav - 文档编辑 @@ -42,7 +54,7 @@ gstreamer1.0-libav 我的大部分文本是用 VIM 编辑的,包括程序,信件,网页,LaTeX 论文,MetaPost 绘图语言。 至于绘图,你可以用很多可视化的工具,比如 xfig,dia。 -- 幻灯片 +- 幻灯片 幻灯都是用 ConTeXt 做的 - 文献管理 @@ -52,25 +64,67 @@ gstreamer1.0-libav - 文件rm后的恢复 [blog](http://blog.csdn.net/q1302182594/article/details/47315177) -- 百度云加速下载 uGet +- 百度云加速下载 uGet + - goldendict 词典,复制pdf单词到浏览器还是太麻烦了,浪费时间。 + - nvidia驱动安装 [blacklist可能还是要添加,有时会出问题](http://blog.csdn.net/10km/article/details/61191230) [驱动安装blog](http://blog.csdn.net/ssmixi/article/details/73483795) [cuda安装blog](http://blog.csdn.net/qq_28413479/article/details/76377184) +- [电子书阅读器linux](vscode 插件) + +## 云盘 + +1. dropbox + 比较好用的云备份软件(不是google-drive),按照[官网教程](https://www.dropbox.com/install-linux)来安装,包含两步,[proprietary daemon(守护程序)问题](http://www.hovercool.com/en/%E5%AE%89%E8%A3%85Dropbox%E5%AE%A2%E6%88%B7%E7%AB%AF), + 使用的话,需要使用代理,可以按照浏览器代理插件一样设置代理,然后登录是要用浏览器关联进行登录。 + ## vpn -[得自由](https://devpn.info/) -[tunnello插件] -[搬瓦工] + +1. [得自由](https://devpn.info/) +2. [tunnello插件] +3. [搬瓦工] + [配置教程](https://www.diycode.cc/topics/738) [VPS服务器](http://www.idcbuster.com/specials.html) - +[ssr](https://github.com/shadowsocksr-backup/shadowsocksr-csharp/releases) ## programs app -- 源代码分析工具 source insight + +- 源代码分析工具 source insight 是不是只有windows版 可以显示reference trees, class inheritance diagrams和 call trees. ## tips + - 蓝牙下载的文件夹在 Download + +## 共享文件将爱 + +1. Samba 服务器文件夹映射。 + win10不能连接ubuntu共享的文件夹,提示错误代码 0x80070035 找不到网络路径。经过win10网络诊断后,由"连接尝试无响应"推测需要关闭ubuntu的防火墙,执行,ufw disable后就可以连接了。 +2. 谷歌ubuntu的winscp替代软件时,发现了新大陆,即ubuntu自带的文件管理器Nautilus是可以连接服务器的,即可以打开远程文件夹,不需要samba就可以。 +[method](https://askubuntu.com/questions/94665/what-is-a-program-similar-to-winscp) + +3. HTTP 文件共享,可以使用python命令将文件当做浏览器页面 + +## 图片浏览器 + +1. Geeqie,可以查看像素值,可以分栏显示图像以做对比 + +## 文件搜索 + +- everything(windows) + +## 图像分割标注软件 + +[pixelAnnotationTool](https://github.com/abreheret/PixelAnnotationTool) +[labelme(labelimg的升级版)](https://github.com/wkentaro/labelme) +[labelimg-brush](https://github.com/lzx1413/LabelImgTool/tree/brush) +[cityscapes](https://github.com/mcordts/cityscapesScripts) + +## resource + +[svg图标](https://iconsvg.xyz/) diff --git a/linux/software/chrome.md b/linux/software/chrome.md new file mode 100644 index 0000000..91ce109 --- /dev/null +++ b/linux/software/chrome.md @@ -0,0 +1,31 @@ +# chrome + +## 基本搜索 + +- 空格:隔开的每一个都为检索的关键词 +- 双引号:可以完整的检索引号内的句子 +- 加号:表示必须包含该关键词 +- 减号:表示从检索结果中排除包含该关键词的条目。 + +## 高级搜索 + +------------ + +## 快捷键 + +1. ctrl+e ctrl+k 将光标移至浏览器搜索框,使用浏览器默认引擎搜索 +2. ctrl+pageup ctrl+shift+tab 前向翻标签页 +3. ctrl+pagedown ctrl+tab 后向翻标签页 +4. shift+esc 打开chrome自身的资源管理器 + +## 问题 + +- 点击vscode里的一个超链接,chrome只能打开一个新窗口,但不能打开链接 +[解决方法](http://forum.ubuntu.org.cn/viewtopic.php?t=478689) +大体意思,是打开链接的参数没有传给chrome,所以要修改google-chrome.desktop文件 + +- 无法登录chrome浏览器,登录界面一闪而过,不能真正登录 +解决方法:可能是浏览器代理插件的原因,需要先屏蔽掉(停止使用) + +- keyring 问题 +删了记录,还是异常 \ No newline at end of file diff --git a/linux/git.md b/linux/software/git.md similarity index 59% rename from linux/git.md rename to linux/software/git.md index 4bb0027..048af95 100644 --- a/linux/git.md +++ b/linux/software/git.md @@ -1,82 +1,112 @@ +# github + [找什么教程,不如读懂一个readme.txt](https://guides.github.com/) -[Learning github](https://help.github.com/) +[Learning github](https://help.github.com/) [github pages一个不错的版本](http://csrgxtu.github.io/categories/Linux/) - -[Git 命令解释](https://git-scm.com/docs) +[Git 命令解释](https://git-scm.com/docs) [廖雪峰git教程](http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000) - HEAD: git用HEAD表示当前版本,实际上HEAD指向master,master指向当前版本 HEAD^表示上一个版本。 - master: 主分支,本地仓库的分支名 - origin: 我们的文件在github服务器上的默认名为origin,在本地分支的默认名为master。 -``` + +```c 在git clone 远程仓库时,Git 会自动为你将此远程仓库命名为origin(origin只相当于一个别名,运行git remote –v或者查看.git/config可以看到origin的含义),并下载其中所有的数据,建立一个指向它的master 分支的指针,我们用(远程仓库名)/(分支名) 这样的形式表示远程分支,所以origin/master指向的是一个remote branch(从那个branch我们clone数据到本地),*但你无法在本地更改其数据* ``` -## git初始配置 -git初始[配置过程](https://help.github.com/articles/set-up-git/) + +## git本地账户配置 + +git初始[配置过程](https://help.github.com/articles/set-up-git/) + 1. 设置git -- git config --global user.email " " -- git config --global user.name " " -2. 设置ssh keys + - git config --global user.email " " + - git config --global user.name " " + +2. 设置ssh keys -Man git-order Or git help + order得到order相关的帮助文档 + Man git-order Or git help + order得到order相关的帮助文档 ## Git 命令 + - Git init: 初始化生成一个.init,命令行提示符处提示当前git版本名称 - Git clone + ADDRESS:将远程仓库克隆到本地,会自动创建一个和远程仓库同名的文件夹 - Git status: 获取当前文件的状态,是否需要更新,比如新添了一个文件 -``` + Staged: Unstaged: Untracked: git还未对该文件进行版本管理 Deleted: -``` + - Git add filename: 添加文件进入git版本管理。Staging area -``` + Git add all . Git add '*.txt': 在当前路径下搜索,包含子目录。 git add *.txt: 在当前路径下搜索,不包含子目录。 -``` + - Git rm:从版本库中删除, - - -r: 与linux相近,删除目录及子文件。本地仓库,远程仓库都可以删除 + -r: 与linux相近,删除目录及子文件。本地仓库,远程仓库都可以删除 + - git clean: 清除本地修改(未push的更改) - Git commit: 保存staged文件到reposity,进行融合 - - -m "notica: -- Git log: reposity提交日志文件 -- Git remote add [remote branch name] [link,已经在github.com建立好的仓库] :添加远程仓库 - - -v 查看远程仓库 -- Git push [-u] [remote branch name] [local branch name]: 把本地文件提交到origin - - -u:使软件记住本次命令,以后只需输入git push即可。 + -m "notica: + +- git remote add [remote branch name] [link, 已经在github.com建立好的仓库] :添加远程仓库 + git remote add origin git@github.... .git 上传到origin + -v 查看远程仓库 + +- git push [-u] [remote branch name] [local branch name]: 把本地文件提交到origin + -u:使软件记住本次命令,以后只需输入git push即可。 + --set-upstream origin BranchName 上传新分支 + - git pull origin master: 把origin文件下载到本地,相当于运行git fetch,后又运行 git merge。 - git stash - git diff:可以查看文件的修改内容,获取pull下的文件有何不同 ---staged -- Git reset: - - git reset --hard HEAD^:回退到上一版本 - - git commit --hard commit_id:回到commit__id版本 -- Git checkout: - - Git checkout branName: 切换进新的分支 - - git checkout --file NAME:撤销修改 - - git checkout -b newName:创建并进入新的分支 -- Git branch: - - 无参数:输出本地分支信息 - - -a show all the branches git knows about - - -r show remote branches git knows about - - Git branch clean_up: 新建branch名为clean_up - - Git branch:列出当前的分支,与master同一级。 - - Git branch -d clean_up: 删除clean_up分支 - - git branch --graph:显示分支合并图 -- Git merge clean_up: 合并分支,当前在master分支,执行命令把在clean_up分支下的改变应用到master分支。 + --staged +- git reset: + git reset --hard HEAD^:回退到上一版本 + git commit --hard commit_id:回到commit__id版本 + +- git log: 获取reposity提交日志文件 + +- git checkout: + git checkout branName: 切换分支 + git checkout -- fileName:撤销修改 + git checkout -b newName:创建并进入新的分支 + git checkout 2237e55ef49e9c31a8108ff71441480887d241a0 切换到这个提交点 + +- git branch: + 无参数:输出本地分支信息 + -a show all the branches git knows about + -r show remote branches git knows about + git branch clean_up: 新建branch名为clean_up + git branch:列出当前的分支,与master同一级。 + git branch -d clean_up: 删除clean_up分支 + git branch --graph:显示分支合并图 + +- git merge clean_up: 合并分支,当前在master分支,执行命令把在clean_up分支下的改变应用到master分支。 + +## git设置代理、取消代理 + +```s +git config --global http.proxy 'socks5://127.0.0.1:1080' +git config --global https.proxy 'socks5://127.0.0.1:1080' +git config --global --unset http.proxy +git config --global --unset https.proxy +``` ## 帮助信息获取 + ```shell man git git --help ``` ## gitignore + 文件的书写规则 + ```shell / # 表示根目录 *.a # 忽略所有 .a 结尾的文件 @@ -85,7 +115,9 @@ git --help build/ # 忽略任意位置的 build/ 目录下的所有文件 doc/*.txt # 会忽略 doc/notes.txt 但不包括 doc/server/arch.txt ``` + 对于已经提交过的文档,需要设置忽略时,要在git库中删除该文件 + ```shell git rm -r --cached . git add . diff --git a/linux/gnuplot.md b/linux/software/gnuplot.md similarity index 100% rename from linux/gnuplot.md rename to linux/software/gnuplot.md diff --git a/linux/software/halcon.md b/linux/software/halcon.md new file mode 100644 index 0000000..b66cfeb --- /dev/null +++ b/linux/software/halcon.md @@ -0,0 +1,17 @@ +# halcon + +[halcon vs2013属性配置、例程](https://blog.csdn.net/sinat_35570625/article/details/72586109) +[halcon类定义、函数查询]( https://www.mvtec.com/doc/halcon/13/en/HImage.html) + +[himage存储方式](https://multipix.com/supportblog/halcon-bitmap-himage-conversion/) + +![memory](../../image/BitmapHImageConversion-300x155.png) + +机器视觉工程开发流程: http://www.ihalcon.com/read-1285.html +主要是光源、工业相机、镜头选择 +一、图像采集,二、图像分割,三、形态学处理,四、特征提取,五、输出结果。 + +匹配方法 +Component-Based +Gray-Value-Based +Shape-Based, \ No newline at end of file diff --git a/linux/mentohust.md b/linux/software/mentohust.md similarity index 100% rename from linux/mentohust.md rename to linux/software/mentohust.md diff --git a/linux/software/octave.md b/linux/software/octave.md new file mode 100644 index 0000000..52c1b0f --- /dev/null +++ b/linux/software/octave.md @@ -0,0 +1,6 @@ +# octave + +## 命令行模式 +``` +octave-cli +``` \ No newline at end of file diff --git a/linux/software/samba.md b/linux/software/samba.md new file mode 100644 index 0000000..c0df953 --- /dev/null +++ b/linux/software/samba.md @@ -0,0 +1,4 @@ +# samba + +https://www.cnblogs.com/kevingrace/p/8662088.html +http://www.cnblogs.com/kevingrace/p/8550810.html \ No newline at end of file diff --git a/linux/shadowsocks.md b/linux/software/shadowsocks.md similarity index 54% rename from linux/shadowsocks.md rename to linux/software/shadowsocks.md index b12e1b2..0a93b9b 100644 --- a/linux/shadowsocks.md +++ b/linux/software/shadowsocks.md @@ -1,7 +1,11 @@ +[gfwlist](https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt) +[electron-ssr](https://github.com/erguotou520/electron-ssr/releases) + ## 浏览器代理 就是把浏览器对一个网页的访问打包成对一个代理的访问 [switchyOmega](gihup已关注) + ## shadowsocks shadowsocks本地就是对一个地址的访问映射到服务器ip上的访问 ```shell @@ -19,13 +23,3 @@ sudo pip install shadowsocks ``` ## depinfo -``` -国家/地区 IP地址 域名 说明 支持协议 -美国 45.32.166.13 us4.heon.win 美国服务器 L2TP, PPTP, AnyConnect -美国 45.77.159.164 us3.heon.win 美国服务器 L2TP, PPTP, AnyConnect -美国 45.76.239.50 us2.heon.win 美国服务器 L2TP, PPTP, AnyConnect -美国 45.77.157.109 us1.heon.win 美国服务器 L2TP, PPTP, AnyConnect -新加坡 45.76.152.139 sg1.heon.win 新加坡服务器 L2TP, PPTP, AnyConnect -日本 45.77.178.214 jp2.heon.win 日本服务器 L2TP, PPTP, AnyConnect -英国 45.76.133.30 gb1.heon.win 英国服务器 L2TP, PPTP, AnyConnect //较快 -``` diff --git a/linux/vim.md b/linux/software/vim.md similarity index 100% rename from linux/vim.md rename to linux/software/vim.md diff --git a/linux/vscode.md b/linux/software/vscode.md similarity index 64% rename from linux/vscode.md rename to linux/software/vscode.md index 2c7aa04..76576b1 100644 --- a/linux/vscode.md +++ b/linux/software/vscode.md @@ -1,13 +1,16 @@ -# https://code.visualstudio.com/docs -# [main page](https://code.visualstudio.com/) -可以下载insiders版本 +# vscode + +[doc](https://code.visualstudio.com/docs) +[main page](https://code.visualstudio.com/) -安装clang C/C++插件时,clang 需要单独安装 +可以下载insiders版本 ctrl+shift+p 后搜索edit configuration编辑c_cpp_properties.json//属性 后搜索tasks:configure task runner编辑tasks.json///编译 编辑launch.json//debug + ## 快捷键 + - shift+alt 鼠标,可以竖着选中一些列 - ctrl+D 鼠标,选中相同的变量 - ctrl+鼠标点击, 找到选中变量名的定义 @@ -17,10 +20,14 @@ ctrl+shift+p 后搜索edit configuration编辑c_cpp_properties.json//属性 - ctrl+z:撤销 - ctrl+y:重复 - ctrl+shift+c:以当前code打开的文件夹为路径打开终端 +- ctrl+shift+i:格式化文档 +- ctrl+alt+'-': 光标回到上一个位置 +- ctrl+alt+'' +- ctrl+shit+p: 打开命令输入框 MakeFile要配置成debug模式,才可在vscode下单步调试,详见cmake -``` +```conf launch.json包含两部分,一个用于调试的启动,一个用于调试的连接 { "version": "0.2.0", @@ -42,23 +49,44 @@ launch.json包含两部分,一个用于调试的启动,一个用于调试的 ] } ``` + ## 设置 + - 默认字体 -``` - + +```yaml +字体 "editor.fontFamily": "'Droid Sans Mono', 'monospace', monospace, 'Droid Sans Fallback'", - +clang语法 "clang.cxxflags": ["-std=c++11"] - +缩略图 "editor.minimap.enabled": false - +CMakeLists自动补全 CMake +win下行以\r\n结尾,linux下以\n结尾 +"files.eol": "\n", +文件关联,以实现.cu文件的语法高亮 +"files.associations": { + "*.cu":"cpp" +}, +"clang.executable": "C:\\Program Files\\LLVM\\bin\\clang", +打开文件的编码方式 +"files.autoGuessEncoding": true +使用tab键做snnipnet的自动补全 +"editor.tabCompletion": true ``` ## 插件 -- markdown+math: 编辑公式 -- C/C++ clang:语法分析 + +- markdown+math: 编辑公式 2.2版本换行显示正常,以后的版本不正常 +- C/C++ clang:语法分析,clang 需要单独安装 - c/c++ intelisense - cmake language support:自动补全 -- python +- python - latex workshop +- [sftp](https://github.com/liximomo/vscode-sftp/wiki/config) 比较好用的插件,用于自动同步到服务器 + 最好还是不要用同步功能,因为服务器的文件可能不在本地,造成两个地方的文件不同一,最好用文件夹映射过来 +- [setting sync](https://marketplace.visualstudio.com/items?itemName=Shan.code-settings-sync)自动上传vscode的配置到github,同样支持一键下载。另一个syncing好像也不错 +- [vscode打开时间提示](https://github.com/formulahendry/vscode-ycy) +- [git history] +- [setting Sync] gist token 5cb1cb1075e08856a28fc2f97e48ddc0cbf3cdec \ No newline at end of file diff --git a/linux/software/word.md b/linux/software/word.md new file mode 100755 index 0000000..3a85a9f --- /dev/null +++ b/linux/software/word.md @@ -0,0 +1,11 @@ +# 写论文 + +## mathtype + +编辑公式 +插入序号 +序号右对齐,在公示与序号之间按一个tab就好。 + +## note-express + +参考文献插入、排序 \ No newline at end of file diff --git a/linux/zotero.md b/linux/software/zotero.md similarity index 99% rename from linux/zotero.md rename to linux/software/zotero.md index 72b2a15..97f1c6c 100644 --- a/linux/zotero.md +++ b/linux/software/zotero.md @@ -1,6 +1,8 @@ # zotero + 很好用的文献管理软件,同步免费空间只有300M,将pdf存储文件夹(storage)替换为一个链接文件,链接到Dropbox的同步文件夹内,这样注释文件依然使用zotero同步而pdf文件使用dropbox相当于变相增加了zotero的免费可用空间。 storage文件为360Mb时,zotero同步的数据依然有103Mb,以后可能还要扩充。 ## 快捷键 + - 搜索论文后,对论文条目右键双击会定位到论文库的位置 \ No newline at end of file diff --git a/linux/ssh.md b/linux/ssh.md index 96ccb06..1d9440a 100644 --- a/linux/ssh.md +++ b/linux/ssh.md @@ -1,20 +1,29 @@ +# telnet + ## ip:115.156.233.38 key:123456 [ssh无密码登录](http://www.ruanyifeng.com/blog/2011/12/ssh_remote_login.html) -# telnet +```shell +$ ssh-copy-id user@host # +``` + +## ssh -# ssh ssh是一个用于远程登录的连接工具。 -ssh有公钥、秘钥之分,公钥放在远程端,相当于一把锁,秘钥就是钥匙,保持在本地电脑。可以将一对公钥、秘钥用在多个地方。 -使用ssh的登录过程就是本地访问远程端,然后远程端返回一个公钥,并要求输入登录密码,在本地电脑上输入密码后,经过公钥加密发送回远程端,远程端解密后,如果密码正确则正确登录。 +ssh有公钥、秘钥之分,公钥放在远程端,相当于一把锁,秘钥就是钥匙,保存在本地电脑。可以将一对公钥、秘钥用在多个地方。 +ssh的登录过程就是本地访问远程端,然后远程端返回公钥,并要求输入登录密码(私钥),在本地电脑上输入密码后,经过公钥加密发送回远程端,远程端解密后,如果密码正确则正确登录。 + ```shell # 远程登录命令 ssh USER@IP_ADDRESS ``` -## scp +ssh-agent可以管理多个秘钥? + +## scp + ```shell # 把本地文件送到远程, 必须要有DEST文件的权限,才能够输,例如可以将文件传动到USER的家目录。注意必须要有冒号,否则不会传输到的地址; scp SOURCE USER@ADDRESS: DEST @@ -37,14 +46,18 @@ scp -r USER@ADDRESS:/home/PATH SOURCE 服务器 ## 树莓派的ssh远程登陆 + ```shell #使能树莓派的ssh登陆 sudo raspi-config #在打开的界面内选择interface的选项,enter后又打开带有ssh项的窗口 #可以直接登陆 ssh UserName@Ip_Address ``` + ## ssh服务管理 + ubuntu 自带openssh-client软件,但不自带openssh-server,也就是只有客户端,服务端的开启是需要安装openssh-server的。 + ```shell service ssh start # 开启服务 service ssh stop # 关闭服务 diff --git a/linux/systemLog.md b/linux/systemLog.md index f941ee6..a8be5ca 100644 --- a/linux/systemLog.md +++ b/linux/systemLog.md @@ -19,12 +19,16 @@ http://www.expreview.com/21367.html - 安装ubuntu 将ubuntu.iso直接放到u盘,或者解压缩到u盘,用UEFI模式启动,都卡在了安装界面。在win10下,控制面板内关掉快速启动后仍然卡住了。最后使用**rufus**工具制作启动盘成功了 - 使用[refind](http://www.rodsbooks.com/refind/)做引导程序,在sourceForge网站下载 + ## grub + ``` linux grub配置文件在/boot目录下 grub的默认参数文件在/etc/default/grub,更改文件后需要sudo update-grub命令才会更改配置文件 ``` + ## mbr + ``` mbr即 main boot record(主引导记录),是位于磁盘地址最开始的一段引导数据代码。通常,将包含mbr的扇区称为主引导扇区,这一扇区是管理整个磁盘空间的一个特殊空间,它不属于磁盘上的任何分区,因而分区空间内的格式化命令不能清除主引导记录的任何信息。 主引导扇区共512个字节,包含三个部分: @@ -32,7 +36,9 @@ mbr即 main boot record(主引导记录),是位于磁盘地址最开始的一 - 磁盘分区表(DPT,disk partition table),由四个分区表项构成,每个分区表项占16个字节,负责说明磁盘上的分区情况。 - 结束标志(2个字节,值为AA55) ``` + ### mbr转gpt方法 + ``` 在windows下启用cmd命令行,输入以下命令 diskpart @@ -43,84 +49,17 @@ convert gpt //需要先clean再convert,否则会转换失败。 ``` ## ubuntu设置命令行提示符颜色 -[链接](http://www.cnblogs.com/Norlan/p/4944861.html) - -## 翻墙 -- google-chrome 插件 tunnello -- hosts更新地址 [1](https://blog.my-eclipse.cn/host-google.html), -``` -hosts更改方法,linux下的文件在/etc/hosts -``` -## 清空dns -``` -Linux下DNS缓存实现通常有两种方式: -一种是用DNS缓存程序NSCD(name service cache daemon)负责管理DNS缓存。 -一种实现DNS缓存则是用Bind来架设Caching Name Server来实现。 - -如果是清除NSCD上的Cache,可重新启动NSCD服务来达成清除DNS Cache的效果。用这个命令: -# service nscd restart -或是 -#/etc/init.d/nscd restart(这个起作用了) - -如果是清除BIND服务器上的CACHE,用这个命令: -# rndc flush - -如果你的DNS服务器是用dnsmasq实现的,用下面这个命令: -$ sudo /etc/init.d/dnsmasq restart - -注:DNSmasq是一个轻巧的,容易使用的DNS服务工具,它可以应用在内部网和Internet连接的时候的IP地址NAT转换,也可以用做小型网络的DNS服务。 -``` +[链接](http://www.cnblogs.com/Norlan/p/4944861.html) -## ubuntu wifi -``` -两台主机通过一根网线构成局域网方法 -分别为两台主机设置IP和netmask(子网掩码),将两者中的一台主机IP设置为网关,即可通信 -ifconfig eth0 192.168.0.1 netmask 255.255.255.0 -route add default gw 192.168.0.1 -即可,只设置IP会ping不通。 - -一直提示 -essid:host name lookup failure//不设置ip地址 - -wlan :wireless local areas network -iwconfig: configure a wireless network interface -ifconfig: configure a network interface -netstat: print network connections,routine table; -iwlist: get more detailed wireless information from a wireless interface. -lsusb:输出usb设备 - -整整弄了一个晚上加上午,笔记本重新建立wifi后,树莓派奇怪的可以连接上了 -过了大概两周了,终于再次链接上了wifi,看了下鸟叔的书,才了解点知识,知道原理是什么,才不至于写命令那么无脑,动态ip应该不需要设置子网掩码,并且自己设置的一直是错的,配置过程如下: -iwconfig wlan0 essid "wifi-ssid"//原来一直输入ifocnfig,导致一直找不到主机名,不清楚原理,此处一定要用iwconfig -ifconfig wlan0 10.42.0.4//成功连接上,子网掩码自动设置为255.0.0.0,不知道为什么是这样,笔记本上是255.255.255.0,在这里浪费了很长时间 -子网掩码设置命令:ifconfig wlan0 netmask 255.255.255.0//需要有wlan0,否则提示无法找到设备 - -(1)首先关闭开发板的有线网卡 -[root@FriendlyARM /]# ifconfig eth0 down -(2)加载USB WiFi无线网卡 -[root@FriendlyARM /]# ifconfig wlan0 up -(3)扫描可用的无线网络 -[root@FriendlyARM /]# iwlist scanning | grep ESSID -lo Interface doesn't support scanning. -eth0 Interface doesn't support scanning. -wmaster0 Interface doesn't support scanning. - ESSID:"FRIENDLY-ARM" - ESSID:"NETGEAR" - ESSID:"TP-LINK" -(4)选择要连接的无线网络 -[root@FriendlyARM /]# iwconfig wlan0 essid "FRIENDLY-ARM" -(5)输入该网络的安全密码//用户名怎么发送?没有解决 -[root@FriendlyARM /]# iwconfig wlan0 key s:12345 -(6)连接到指定的AP(无线路由) -[root@FriendlyARM /]# iwconfig wlan0 ap auto -(7)设置无线网卡的IP地址 -[root@FriendlyARM /]# ifconfig wlan0 192.168.1.120 -(8)使用 ping 命令检测无线网连通状况 -[root@FriendlyARM /]# ping 192.168.1.1 -PING 192.168.1.1 (192.168.1.1): 56 data bytes -64 bytes from 192.168.1.1: seq=0 ttl=64 time=42.804 ms -64 bytes from 192.168.1.1: seq=1 ttl=64 time=5.020 ms -``` +## 物理内存 +ubuntu默认使用60%的物理内存,即超过60%时会使用swap空间 +```shell +# 查看物理内存分配的百分比 +cat /proc/sys/vm/swappiness +# 修改默认值 +sudo vim /etc/sysctl.conf +vm.swappiness=20 +``` \ No newline at end of file diff --git a/linux/terminal.md b/linux/terminal.md new file mode 100644 index 0000000..428c128 --- /dev/null +++ b/linux/terminal.md @@ -0,0 +1,14 @@ +# .bashrc设置 + +让man page变为彩色 + +```python +# colourful man page +export LESS_TERMCAP_mb=$'\E[01;34m' +export LESS_TERMCAP_md=$'\E[01;34m' +export LESS_TERMCAP_me=$'\E[0m' +export LESS_TERMCAP_us=$'\E[01;32m' +export LESS_TERMCAP_ue=$'\E[0m' +export LESS_TERMCAP_so=$'\E[01;33;44m' +export LESS_TERMCAP_se=$'\E[0m' +``` \ No newline at end of file diff --git a/linux/tex/latex.md b/linux/tex/latex.md index 01618b4..5a7ede3 100644 --- a/linux/tex/latex.md +++ b/linux/tex/latex.md @@ -13,10 +13,18 @@ sudo apt-get install texmaker 1. 看完:一份其实很短的 LaTeX 入门文档,你迷惑的「CTeX 和 LaTeX 都是啥」在倒数第二节有答案. 1. 看完:zip.liam0205.me 或者 刘海洋的《LaTeX 入门》。 -## latex命令 -cvline 新行 -hfill 分栏 - +## beamer命令 +- frametitle{hello beamer} ppt大标题 +- cvline 新行 +- hfill 即在每一行中均匀排布, +- hspace{1cm} 水平方向右移1cm +- hspace*{-1cm} 水平方向左移1cm +- vspace{1cm} 竖直方向下移1cm +- itemize 开始按条列项目 +- \\ 换行 +- includegraphics[height=1cm]{} 设置包含的图片大小及文件路径 +- \tiny \small \large \huge \scriptsize \normalsize \Large \Huge \footnotesize \LARGE 字体大小 +- [c] 居中设置 ## 编译 ```shell xelatex main.tex # beamer diff --git a/linux/tex/markdown.md b/linux/tex/markdown.md index 3ca00b0..0680120 100644 --- a/linux/tex/markdown.md +++ b/linux/tex/markdown.md @@ -1,4 +1,5 @@ -# markdown +# markdown + instant markdown 插件将页面显示在浏览器内,或者访问 http://localhost:8090/ [理想的学习环境]( http://www.yangzhiping.com/tech/writing-space.html) [vscode markdown](https://code.visualstudio.com/docs/languages/markdown) @@ -12,6 +13,7 @@ vscode使用 markdown-it 编译器 markdown 是一种标记型语言,并没有一个完全规范化的版本,其最初的设计者做一个测试文件,凡通过这个测试的文件都可以称为markdown,所以有很多中版本,vscode支持的是common markdown, github支持的是github flavoured markdown,可以在vscode markdown语言支持里查看 ## 常用数学符号 + $$\leqslant$$ $$\geqslant$$ $$\mathbb{E}$$ @@ -19,7 +21,9 @@ $$\sim$$ $$\rlap{\,/}{=}$$$ $$\min_\Theta$$ $$\bar{a}$$ + #### 0. 理解[markdown](https://kramdown.gettalong.org/syntax.html) + kramdown 是一个用Ruby实现的Markdown的解析器。github使用的就是这个解释器 Markdown是一种轻量型标记语言, 其目的在于为以网页为载体的文章的排版提供一种较HTML来说更简便、更安全、可读性更强的书写方式。它并不是HTML的替代品,使用Markdown的 语法编写的文章最终都要通过其翻译器转换成HTML代码。 @@ -87,20 +91,24 @@ _斜体_ *斜体* ``` 效果 ![test](../image/aa.png) + #### 14. 列表:第一行用 '-' 分开,列用 '|' 分开 + ``` first header | second header -------------|------------ content form cell 1 | content from cell 2 content in the first column | content in the second column ``` + 效果 first header | second header -------------|------------ content form cell 1 | content from cell 2 content in the first column | content in the second column -#### 15. 对齐,不起作用??? +#### 15. 对齐,不起作用 + : test1 : test2 : test3 @@ -112,7 +120,6 @@ content in the first column | content in the second column > help - #### 16. 公式显示,vscode下添加了markdown+math插件后,按快捷键ctrl+shift+. 可以翻译公式了 [公示查询](http://goessner.github.io/mdmath/test/) 在浏览器上直接显示 markdown 文件时,公式显示是不成功的,只有在markdown文件头添加如下 javescript 代码段,并翻译成 html 后才成功显示。 @@ -124,16 +131,14 @@ content in the first column | content in the second column $$x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}$$ \\(x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}\\) - - \begin{equation} F(x)=\int_0^t\sin(t)\mathrm{d}\,t+\left[\lim_{x\rightarrow0}g(x)\times\sum_{m=0}^\infty\frac{(-1)^m}{\Gamma(m+{\color{red}α}+1)}\right] \end{equation} ## Markdown 扩展 + ``` Markdown 扩展支持: - * 表格 * 定义型列表 * Html 标签 @@ -144,14 +149,22 @@ Markdown 扩展支持: * MathJax 公式 ``` -#### 1. 扩展HTML 字体、颜色、字号设置 +## 并排放置图像 + +

+ + +## 1. 扩展HTML 字体、颜色、字号设置 + 只有当有设置脚本时,颜色设置才有效(即上面的javascript) markdown本身不支持更改颜色、字体、字号,但是它的扩展HTML支持 + ``` - 黑体字 - face="微软雅黑" size= 3 color=#0099ff ``` + 效果 + - 黑体字 - face="微软雅黑" size= 3 color=#0099ff - diff --git a/machinelearning/caffe/blas.md b/machinelearning/caffe/blas.md new file mode 100644 index 0000000..2075ae3 --- /dev/null +++ b/machinelearning/caffe/blas.md @@ -0,0 +1,100 @@ +# math_function +[函数解析blog](https://blog.csdn.net/seven_first/article/details/47378697#1-caffecpugemm-%E5%87%BD%E6%95%B0) +cblas +vs + + +1. caffe_cpu_gemm +对cblas中的矩阵相乘函数cblas_sgemm,cblas_dgemm(分别对应single float, double float)的封装 +实现的公式 +> $$C = alpha * A * B + beta * C$$ +其中A矩阵M行K列,B矩阵K行N列,C矩阵M行N列。 + +```c++ +// CBLAS_TRANSPOSE 表示是否进行转置 +template<> +void caffe_cpu_gemm(const CBLAS_TRANSPOSE TransA, + const CBLAS_TRANSPOSE TransB, const int M, const int N, const int K, + const float alpha, const float* A, const float* B, const float beta, + float* C) { + int lda = (TransA == CblasNoTrans) ? K : M; + int ldb = (TransB == CblasNoTrans) ? N : K; + cblas_sgemm(CblasRowMajor, TransA, TransB, M, N, K, alpha, A, lda, B, + ldb, beta, C, N); +} +``` +2. caffe_cpu_gemv +对cblas_sgemv的封装。 +> $$y = alpha * A * x + beta * y$$ +A矩阵M行N列 +```c++ +template <> +void caffe_cpu_gemv(const CBLAS_TRANSPOSE TransA, const int M, + const int N, const float alpha, const float* A, const float* x, + const float beta, float* y) { + cblas_sgemv(CblasRowMajor, TransA, M, N, alpha, A, N, x, 1, beta, y, 1); +} +``` + +3. caffe_div、caffe_add、caffe_sub、caffe_mul,caffe_gpu_mul +按元素相除, +> $$y[i] = a[i] / b[i]$$ +```c++ +template <> +void caffe_div(const int n, const float* a, const float* b, + float* y) { + vsDiv(n, a, b, y); +} +``` + +4. caffe_cpu_asum +所有元素之和 +```cpp +template <> +float caffe_cpu_asum(const int n, const float* x) { + return cblas_sasum(n, x, 1); +} +``` +5. caffe_cpu_scale, caffe_gpu_scale,x和y地址可以是同一个吗?应该不可以,因为存在复制,而复制的源、目的地址应该不一致。可以选用caffe_gpu_scal(); +> $$y = alpha * x$$ +```cpp +template <> +void caffe_cpu_scale(const int n, const float alpha, const float *x, + float* y) { + cblas_scopy(n, x, 1, y, 1); + cblas_sscal(n, alpha, y, 1); +} +template <> +void caffe_gpu_scal(const int N, const double alpha, double *X) { + CUBLAS_CHECK(cublasDscal(Caffe::cublas_handle(), N, &alpha, X, 1)); +} +``` +5. caffe_cpu_sign、caffe_gpu_sign +定义在math_function.hpp中,使用了宏定义,caffe_sign。 + +6. caffe_gpu_axpy +> $$y[j]=alpha*x[j]+y[j]$$ +```cpp +template <> +void caffe_gpu_axpy(const int N, const float alpha, const float* X, + float* Y) { + CUBLAS_CHECK(cublasSaxpy(Caffe::cublas_handle(), N, &alpha, X, 1, Y, 1)); +} +``` +7. caffe_gpu_dot 向量内积 + +8. caffe_gpu_axpby +> $$y = a * x + beta * y$$ +```cpp +template <> +void caffe_gpu_axpby(const int N, const float alpha, const float* X, + const float beta, float* Y) { + caffe_gpu_scal(N, beta, Y); + caffe_gpu_axpy(N, alpha, X, Y); +} + +``` +## tips +gemm: General Matrix to Matrix Multiplication +gemv: 矩阵和向量的乘积 +blas: basic linear algorithm subprograms,基础线性代数程序集 \ No newline at end of file diff --git a/machinelearning/caffe/caffe.md b/machinelearning/caffe/caffe.md new file mode 100644 index 0000000..ce5bd7a --- /dev/null +++ b/machinelearning/caffe/caffe.md @@ -0,0 +1,133 @@ +[caffe all in one network](https://yangwenbo.com/articles/caffe-net-config-all-in-one.html) +[caffe-notes](https://blog.csdn.net/fangjin_kl/article/details/53373384) +[UML](http://design-patterns.readthedocs.io/zh_CN/latest/read_uml.html) +[写得比较有深度,讲解caffe中的类](https://zhuanlan.zhihu.com/p/21796890) +[lmdb](http://www.lmdb.tech/doc/) + +## 流程 +Caffe是一个类,caffe是命名空间 +Solver类已经能够独立完成网络的训练,但如果是多gpu设置,则还有P2PSync的封装 +```cpp +tools/caffe.cpp + train + solver_param + create solver + copyLayers、restore // 从solverstate或caffemodel复制参数 + case:GPU + solver.Run() //传入gpus vector,开启多线程,多GPU,每个线程会有自己的P2PSync + parent==nullptr, root_solver + solver_->Solve() + step(iters) + callback() + case:CPU + Solve() // 循环 +``` + +## class 层级的抽象 +### Caffe +Caffe类是一个单例模式 + +solver是在CreatorSolver函数中生成的。 +sgd_solver.cpp中的REGISTER_SOLVER_CLASS(SGD)会将sgd的生成函数注册到SolverRegistry指针变量中。 + +### Solver +包含了Net,类内定义了class Callback + +### P2PSync +public Solver::Callback, GPUParams, InternalThread + +### Net +在Net的初始化函数中,会调用各Layer的SetUp函数 +LayerSetUp()和Reshape()层会被父类的SetUp()调用,而SetUp在Net.Init()中被循环调用。 +```cpp +map param_names_index_ // non-empty name与index的映射,每一次循环,net_param_id都会变? +map blob_names_index_ // 每个blob与index的映射,blob指层的输入、输出,index即blob的序号 +map layer_names_index_ // 每层网络与index的映射,此处index指layer类的序号 +``` + +### BaseDataLayer +public Layer +### BasePrefetchingDataLayer +public BaseDataLayer, public InternalThread +这一层以独立的线程运行 +```cpp +Batch prefetch_[PREFETCH_COUNT]; // 实际数据存储地址 +BlockingQueue*> prefetch_free_; // 存储指针,为什么是个队列?类的构造函数中将prefetch_的地址放入prefetch_free_ +BlockingQueue*> prefetch_full_; +``` +### DataReader +会开启一个线程,每一个epoch只能够从前往后读取,并且一个epoch之后,不能够shuffle数据顺序后再读 + +### DataLayer +public BasePrefetchingDataLayer + +### AnnotatedDataLayer +public BasePrefetchingDataLayer + +### convLayer +[conv](https://blog.csdn.net/sinat_22336563/article/details/69808612) +前向传播时:im2col用于将输入特征图转换成与权重矩阵相乘的排列方式, +反向传播时:计算权重梯度时,im2col同样用于将上一层的残差转换成与权重矩阵相乘的排列形式。 +方向传播时:计算下一层的残差时,col2im用于将与权重矩阵相同的排列形式变成图像的形式。 +同一个batch的样本的残差会在反向传播时叠加。 + +## 数据的抽象 + +### SynceMemory + +### Blob + +是对SyncedMemory类的封装。 +是row-major的,也就是说对于(n,k,h,w)点的物理地址是$(((n*K+k)*H+h)*W+w$ +数据在网络中的流通方式就是Blob,网络的可学习参数也存储在Blob中。 + +## caffe.proto + +- SolverParameter定义solver.prototxt +NetState: train_state, test_state? + +- NetParameter定义net.prototxt +NetState: state + +- LayerParameter定义net.prototxt中的层 +NetStateRule在层里进行设置,包括include和exclude两个变量,会根据NetParameter中的state变量决定是否包含该层 + +- NetState +- NetStateRule + +## solver.prototxt + +test_initialization,在从snapshot加载继续训练的情况下,该参数不起作用 + +## tips + +define中的'##'是一个连接符号,用于把参数连接在一起,'#'是一个字符串化的意思,在宏定义中把参数转换成一个字符串。 + +- 安装问题 +make all 并不包括make pycaffe,所以需要python接口时,仍需要make pycaffe +- 多gpu交流,好像只做了梯度平均,BN并没有做特别处理。 +- aviers初始化 + +```c++ +// if blob.count() = num *a *b *c, then fan_in = a*b*c, fan_out = num*b*c +fan_in = blob.count() / blob.num() // shape(0) +fan_out = blob.count() / blob.channels() // shape(1) ? +``` + +- bug + +```c++ +*** Aborted at 1530771819 (unix time) try "date -d @1530771819" if you are using GNU date *** +PC: @ 0x7f2bcd57bb2b __fprintf_chk +*** SIGSEGV (@0x0) received by PID 31221 (TID 0x7f2bd09a4b00) from PID 0; stack trace: *** + @ 0x7f2bcd49a4b0 (unknown) + @ 0x7f2bcd57bb2b __fprintf_chk + @ 0x4081e9 frcnn_yolo() + @ 0x404266 main + @ 0x7f2bcd485830 __libc_start_main + @ 0x404fe9 _start + @ 0x0 (unknown) +./test.sh: line 28: 31221 Segmentation fault +``` + +文件输出路径写错了 diff --git a/machinelearning/caffe/caffeinstall.md b/machinelearning/caffe/caffeinstall.md index 4e80c0f..d73d196 100644 --- a/machinelearning/caffe/caffeinstall.md +++ b/machinelearning/caffe/caffeinstall.md @@ -28,12 +28,12 @@ for req in $(cat requirements.txt); do pip install $req; done 如果提示报错,一般是缺少必须的包引起的,直接根据提示 pip install 就行了。 安装完后退出root权限 -exit -4. 编译: +exit +4. 编译: cd ~/caffe -make pycaffe +make pycaffe -5. 配置 +5. 配置 添加~/caffe/python到$PYTHONPATH: sudo gedit /etc/profile sudo vim ~/.bashrc (这个比较好) @@ -42,6 +42,7 @@ make pycaffe $ source /etc/profile # 使之生效 caffe官网编译安装 + ```shell cp Makefile.config.example Makefile.config #Adjust Makefile.config (for example, if using Anaconda Python, or if cuDNN is desired) @@ -51,6 +52,7 @@ make runtest ``` ### Question + 1. .build_release/src/caffe/proto/caffe.pb.cc:46977:11: error: expected ‘)’ before ‘else’ Makefile:588: recipe for target '.build_release/src/caffe/proto/caffe.pb.o' failed make: *** [.build_release/src/caffe/proto/caffe.pb.o] Error 1 diff --git a/machinelearning/caffe/data.md b/machinelearning/caffe/data.md new file mode 100644 index 0000000..7db3c69 --- /dev/null +++ b/machinelearning/caffe/data.md @@ -0,0 +1,2 @@ +# coco +minival2014.txt 5000 \ No newline at end of file diff --git a/machinelearning/caffe/gflag.md b/machinelearning/caffe/gflag.md new file mode 100644 index 0000000..02d186b --- /dev/null +++ b/machinelearning/caffe/gflag.md @@ -0,0 +1,6 @@ +# [gflags](https://gflags.github.io/gflags/) +谷歌的一套命令行参数处理程序库 + +DEFINE_ +DECLARE_ +变量自动添加前缀FLAGS_ \ No newline at end of file diff --git a/machinelearning/caffe/glog.md b/machinelearning/caffe/glog.md new file mode 100644 index 0000000..0f77716 --- /dev/null +++ b/machinelearning/caffe/glog.md @@ -0,0 +1,16 @@ +# glog: google log +谷歌开源的日志记录库 + +条件日志:LOG_IF(INFO, expression): 当条件表达式成立时,输出log信息 + +CHECK宏:当条件表达式不成立时,输出Fatald额log信息 +CHECK_GE +CHECK_EQ + +LOG宏: LOG(INFO),输出log信息 + + +## 输出信息结构 +log类型| log日期 |log时间 |进程PID | 文件和行数 | 输出信息 +----|-----|-----|-----|-----|----|----|------| +IWEF(Info,Warn,Error,Fatal)| 月份信息 | 时间信息| 进程号 | 输出信息的文件名称和在文件中的行数 | 调试信息 diff --git a/machinelearning/caffe/gtest.md b/machinelearning/caffe/gtest.md new file mode 100644 index 0000000..385a546 --- /dev/null +++ b/machinelearning/caffe/gtest.md @@ -0,0 +1,2 @@ +# [google test](http://www.cnblogs.com/coderzh/archive/2009/04/06/1426755.html) +谷歌开源的c++代码测试框架 diff --git a/machinelearning/caffe/lmdb.md b/machinelearning/caffe/lmdb.md new file mode 100644 index 0000000..6d3617c --- /dev/null +++ b/machinelearning/caffe/lmdb.md @@ -0,0 +1,4 @@ +# [lmdb](http://www.lmdb.tech/doc/) +lmdb: Lightning Memory-Mapped Database + +在caffe_root/data文件夹下每种数据集都有对应的转换代码 diff --git a/machinelearning/caffe/mapReduce.md b/machinelearning/caffe/mapReduce.md new file mode 100644 index 0000000..4de191d --- /dev/null +++ b/machinelearning/caffe/mapReduce.md @@ -0,0 +1,15 @@ +# [map reduce](http://www.dcs.bbk.ac.uk/~dell/teaching/cc/book/ditp/ditp_ch2.pdf) + +函数编程语言(Lisp,ML)的一个关键特点是支持高阶函数(higher oder function,可以把function当做参数输入的函数)。两个常见的内建高阶函数如map,fold。 + +mapReduce有三个不同但相关的概念 +1. 是一种编程思想,第一阶段map,第二阶段fold +2. 是一种executation frmework(i.e. runtime?),即可以执行按MapReduce形式定义的程序的框架 +3. MapReduce can refer to the software implementation of the programming model and the execution framework? + + +mappers, reducers, partitioners, and combiners. + + +## tips +executation framework就叫做runtime diff --git a/machinelearning/caffe/modelZone.md b/machinelearning/caffe/modelZone.md new file mode 100644 index 0000000..b1a759f --- /dev/null +++ b/machinelearning/caffe/modelZone.md @@ -0,0 +1,24 @@ +# caffe-models + +In this repository you can find a collection of pretrained caffe models. + +Network | Size | Source +------------------------ | -------- | ------ +VGG16 | 527.79MB | [University of Oxford](http://www.robots.ox.ac.uk/%7Evgg/research/very_deep/) +VGG19 | 548.05MB | [University of Oxford](http://www.robots.ox.ac.uk/%7Evgg/research/very_deep/) +ResNet-18 | 44.65MB | [HolmesShuan/ResNet-18-Caffemodel-on-ImageNet](https://github.com/HolmesShuan/ResNet-18-Caffemodel-on-ImageNet) +ResNet-50 | 97.72MB | [KaimingHe/deep-residual-networks](https://github.com/KaimingHe/deep-residual-networks) +ResNet-101 | 170.39MB | [KaimingHe/deep-residual-networks](https://github.com/KaimingHe/deep-residual-networks) +ResNet-152 | 230.26MB | [KaimingHe/deep-residual-networks](https://github.com/KaimingHe/deep-residual-networks) +DenseNet-121 | 30.81MB | [shicai/DenseNet-Caffe](https://github.com/shicai/DenseNet-Caffe) +DenseNet-161 | 110.32MB | [shicai/DenseNet-Caffe](https://github.com/shicai/DenseNet-Caffe) +DenseNet-169 | 54.65MB | [shicai/DenseNet-Caffe](https://github.com/shicai/DenseNet-Caffe) +DenseNet-201 | 77.31MB | [shicai/DenseNet-Caffe](https://github.com/shicai/DenseNet-Caffe) +Inception-v4 | 163.13MB | [soeaver/caffe-model](https://github.com/soeaver/caffe-model/tree/master/cls) +Inception-ResNet-v2 | 213.42MB | [soeaver/caffe-model](https://github.com/soeaver/caffe-model/tree/master/cls) +MobileNet | 16.24MB | [shicai/MobileNet-Caffe](https://github.com/shicai/MobileNet-Caffe) +MobileNet-v2 | 13.53MB | [shicai/MobileNet-Caffe](https://github.com/shicai/MobileNet-Caffe) +SqueezeNet_v1.0 | 4.77MB | [DeepScale/SqueezeNet](https://github.com/DeepScale/SqueezeNet) +SqueezeNet_v1.0_DSD | 4.77MB | [songhan/SqueezeNet-DSD-Training](https://github.com/songhan/SqueezeNet-DSD-Training) +SqueezeNet_v1.0_Residual | 4.77MB | [songhan/SqueezeNet-Residual](https://github.com/songhan/SqueezeNet-Residual) +SqueezeNet_v1.1 | 4.72MB | [DeepScale/SqueezeNet](https://github.com/DeepScale/SqueezeNet) diff --git a/machinelearning/caffe/protobuf.md b/machinelearning/caffe/protobuf.md new file mode 100644 index 0000000..6783544 --- /dev/null +++ b/machinelearning/caffe/protobuf.md @@ -0,0 +1 @@ +[protobuf api](https://developers.google.com/protocol-buffers/docs/reference/cpp-generated) \ No newline at end of file diff --git a/machinelearning/caffe/rng.cpp b/machinelearning/caffe/rng.cpp new file mode 100644 index 0000000..fce3529 --- /dev/null +++ b/machinelearning/caffe/rng.cpp @@ -0,0 +1,110 @@ +/* boost random_demo.cpp profane demo + * + * Copyright Jens Maurer 2000 + * Distributed under the Boost Software License, Version 1.0. (See + * accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + * + * $Id$ + * + * A short demo program how to use the random number library. + */ + +#include +#include +#include // std::time + +#include +#include +#include +#include +#include + +// This is a typedef for a random number generator. +// Try boost::mt19937 or boost::ecuyer1988 instead of boost::minstd_rand +typedef boost::minstd_rand base_generator_type; + +// This is a reproducible simulation experiment. See main(). +void experiment(base_generator_type & generator) +{ + // Define a uniform random number distribution of integer values between + // 1 and 6 inclusive. + typedef boost::uniform_int<> distribution_type; + typedef boost::variate_generator gen_type; + gen_type die_gen(generator, distribution_type(1, 6)); + + // If you want to use an STL iterator interface, use iterator_adaptors.hpp. + boost::generator_iterator die(&die_gen); + for(int i = 0; i < 10; i++) + std::cout << *die++ << " "; + std::cout << '\n'; +} + +int main() +{ + // Define a random number generator and initialize it with a reproducible + // seed. + base_generator_type generator(42); + + std::cout << "10 samples of a uniform distribution in [0..1):\n"; + + // Define a uniform random number distribution which produces "double" + // values between 0 and 1 (0 inclusive, 1 exclusive). + boost::uniform_real<> uni_dist(0,1); + boost::variate_generator > uni(generator, uni_dist); + + std::cout.setf(std::ios::fixed); + // You can now retrieve random numbers from that distribution by means + // of a STL Generator interface, i.e. calling the generator as a zero- + // argument function. + for(int i = 0; i < 10; i++) + std::cout << uni() << '\n'; + + /* + * Change seed to something else. + * + * Caveat: std::time(0) is not a very good truly-random seed. When + * called in rapid succession, it could return the same values, and + * thus the same random number sequences could ensue. If not the same + * values are returned, the values differ only slightly in the + * lowest bits. A linear congruential generator with a small factor + * wrapped in a uniform_smallint (see experiment) will produce the same + * values for the first few iterations. This is because uniform_smallint + * takes only the highest bits of the generator, and the generator itself + * needs a few iterations to spread the initial entropy from the lowest bits + * to the whole state. + */ + generator.seed(static_cast(std::time(0))); + + std::cout << "\nexperiment: roll a die 10 times:\n"; + + // You can save a generator's state by copy construction. + base_generator_type saved_generator = generator; + + // When calling other functions which take a generator or distribution + // as a parameter, make sure to always call by reference (or pointer). + // Calling by value invokes the copy constructor, which means that the + // sequence of random numbers at the caller is disconnected from the + // sequence at the callee. + experiment(generator); + + std::cout << "redo the experiment to verify it:\n"; + experiment(saved_generator); + + // After that, both generators are equivalent + assert(generator == saved_generator); + + // as a degenerate case, you can set min = max for uniform_int + boost::uniform_int<> degen_dist(4,4); + boost::variate_generator > deg(generator, degen_dist); + std::cout << deg() << " " << deg() << " " << deg() << std::endl; + + { + // You can save the generator state for future use. You can read the + // state back in at any later time using operator>>. + std::ofstream file("rng.saved", std::ofstream::trunc); + file << generator; + } + + return 0; +} \ No newline at end of file diff --git a/machinelearning/caffe/structure.md b/machinelearning/caffe/structure.md index 1d46a53..ab6bcea 100644 --- a/machinelearning/caffe/structure.md +++ b/machinelearning/caffe/structure.md @@ -1,4 +1,5 @@ [深度](https://xmfbit.github.io/2017/03/08/mathfunctions-in-caffe/) + # Datum caffe内置的数据结构,由proto自动生成的读写代码,在caffe.proto中有定义 datum = caffe.proto.caffe_pb2.Datum() @@ -18,6 +19,37 @@ pad 参数 有多种选择,默认是开源的ATLAS [对比](https://www.zhihu.com/question/27872849) +## 名词缩写 +- gemm(GEMM: General Matrix to Matrix Multiplication)矩阵与矩阵相乘 +- gemv 矩阵和向量相乘 +- unified virtual address(UVA),将CPU和GPU看做一个统一的空间。 + + +[Caffe中的底层数学计算函数](https://xmfbit.github.io/2017/03/08/mathfunctions-in-caffe/) + +# Datum +caffe内置的数据结构,由proto自动生成的读写代码,在caffe.proto中有定义 +datum = caffe.proto.caffe_pb2.Datum() + +## 多卡、多线程 +P2PSync继承自GPUParams,Solver::Callback, InternalThread + +## caffe.Classifier 继承自 caffe.Net + +## 抽象基类 +### Blob 网络参数 +### layer 网络层 +- base_conv_layer + - conv_layer +- DetectionOutput + 保存的bbox已经归一化到了原图大小。但是为什么cocoAPI的结果与ssd的结果不同? + +## 依赖库 +- BLAS(basic linear algebra subprograms,基础线性代数子程序库) + 提供了一些低层次的通用线性代数运算的实现函数,如向量的相加,数乘,点积和矩阵相乘等。在BLAS的统一框架下,不同厂商根据自己硬件的特点,开发了自己的加速库,这里BLAS起到了应用程序接口(API)标准的作用。 + 有多种选择,默认是开源的ATLAS + [对比](https://www.zhihu.com/question/27872849) + ## 名词缩写 - gemm(GEMM: General Matrix to Matrix Multiplication)矩阵与矩阵相乘 - gemv 矩阵和向量相乘 diff --git a/machinelearning/colab.md b/machinelearning/colab.md new file mode 100644 index 0000000..8f11b35 --- /dev/null +++ b/machinelearning/colab.md @@ -0,0 +1,3 @@ +# colab + +[tutorial](https://medium.com/deep-learning-turkey/google-colab-free-gpu-tutorial-e113627b9f5d) \ No newline at end of file diff --git a/machinelearning/competition.md b/machinelearning/competition.md index 8b7c287..e1d462f 100644 --- a/machinelearning/competition.md +++ b/machinelearning/competition.md @@ -1,3 +1,5 @@ +# competition + https://tianchi.aliyun.com/?spm=5176.100066.1234.1.n9TJUH https://www.kaggle.com/ http://algo.tpai.qq.com/home/introduction/index.html @@ -7,7 +9,8 @@ public leaderboard:是根据公开的50%测试数据集得到的评分 private leaderboard:是没有公开的50%测试数据集得到的评分 kernels:是一个基于浏览器平台的云计算环境 -### workflow stages +## workflow stages + 1. Question or problem definition. 2. Acquire training and testing data. 3. Wrangle, prepare, cleanse the data. @@ -15,4 +18,5 @@ kernels:是一个基于浏览器平台的云计算环境 5. Model, predict and solve the problem. 6. Visualize, report, and present the problem solving steps and final solution. 7. Supply or submit the results. + fare 票价, ordinal 序数, impute 估算 \ No newline at end of file diff --git a/machinelearning/framework.md b/machinelearning/framework.md deleted file mode 100644 index 708b61d..0000000 --- a/machinelearning/framework.md +++ /dev/null @@ -1,4 +0,0 @@ -- tensorflow 大型RNN,LSTM -- pytorch nlp领域? -- mxnet cv领域? -- caffe2 cv领域 \ No newline at end of file diff --git a/machinelearning/glouncv.md b/machinelearning/glouncv.md new file mode 100644 index 0000000..be1da99 --- /dev/null +++ b/machinelearning/glouncv.md @@ -0,0 +1,6 @@ +# glouncv + +## download model + +https://github.com/dmlc/gluon-cv/blob/2318052dc79966bf36675606b7d992a347418292/gluoncv/model_zoo/model_store.py +https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/gluon/models/resnet50_v1d-117a384e.zip diff --git a/machinelearning/links.md b/machinelearning/links.md index 861bc29..9d769e5 100644 --- a/machinelearning/links.md +++ b/machinelearning/links.md @@ -12,13 +12,13 @@ AP(average precision) MR(miss rate) -### 均方根偏差 root mean square deviation(RMSD) +## 均方根偏差 root mean square deviation(RMSD) -### 均方根误差 root mean square error(RMSE) +## 均方根误差 root mean square error(RMSE) 衡量观测值与真值之间的偏差,其中di是误差 $di={x}_{obs} - {x}_{model}$ $$\sqrt{\frac{1}{n}*\sum_{}di^2}$$ -### 标准差,也称为标准偏差 +## 标准差,也称为标准偏差 用来衡量一组数的离散程度 -### 方差,均方差(均是平均的意思,没有根号)(mean square error, MSE) +## 方差,均方差(均是平均的意思,没有根号)(mean square error, MSE) diff --git a/machinelearning/meanshift.md b/machinelearning/meanshift.md index 1a1dc9e..bb676cd 100644 --- a/machinelearning/meanshift.md +++ b/machinelearning/meanshift.md @@ -6,6 +6,7 @@ http://blog.csdn.net/abcjennifer/article/details/8170687 http://blog.csdn.net/itplus/article/details/10088625 ## 一、算法原理 + 概率密度函数的核函数估计也称为parzon窗估计。 mean shift向量,是个向量,指偏移量 - 基本的均值偏移形式 @@ -20,7 +21,9 @@ $$M_h(x)=\frac{\sum_{i=1}^{n}G_h(x_i-x)*w(x_i)*(x_i-x)}{\sum_{i=1}^{n}G_h(x_i-x) parzen窗估计?? ## 二、算法描述[参考]((http://blog.csdn.net/google19890102/article/details/51030884)) + 思想:这里是把每一个数据点当作初始的聚类中心,然后以这个聚类中心计算偏移向量 + ```shell 初始化:设数据集中的每一个点都不是聚类中心,设mean_shift_distance为一次计算出的均值偏移向量,MIN_DISTANCE为一次偏移位移的最小值。 当mean_shift_distance < MIN_DISTANCE时,进入以下循环 @@ -30,7 +33,5 @@ $$M_h(x)=\frac{\sum_{i=1}^{n}G_h(x_i-x)*w(x_i)*(x_i-x)}{\sum_{i=1}^{n}G_h(x_i-x) 检测该数据点偏移量是否小于本轮主循环的最小偏移量,小则更新; 并且当偏移量 < MIN_DISTANCE时,设置当前点为聚类中心点 将该数据点更新为融合进均值偏移量的数据点 -根据聚类中心点是否一致对所有数据点进行类标记,这里可以保留聚类中心点的小数点后两位来再判断是否属于同一类。 +根据聚类中心点是否一致对所有数据点进行类标记,这里可以保留聚类中心点的小数点后两位来再判断是否属于同一类。 ``` - - diff --git a/machinelearning/pytorch/aten.md b/machinelearning/pytorch/aten.md new file mode 100644 index 0000000..6e3887f --- /dev/null +++ b/machinelearning/pytorch/aten.md @@ -0,0 +1,25 @@ +# [ATen](https://github.com/zdevito/ATen/tree/master/aten) + +A Tensor library + +ATen是一个张量库,用于曝光Pytorch中的Tensor操作接口,从而可以在c++11中使用。ATen的API遵循了Pytorch中的命名规范,不过函数调用一般会在命名上加一个后缀"_out",而类内方法直接采用原名字。 + +## THCudaTensor + +该类对象的API定义在THCTensor.h文件,如 + +```c++ +THC_API int THCTensor_(nDimension)(THCState *state, const THCTensor *self); +//实际使用时,按如下调用 +THCTensor_nDimension(state, weight) +``` + +## API + +- THArgCheck() + +```c +// 表达式第二个参数表示该语句所在函数的第n个参数有错误 +// 宏定义https://github.com/pytorch/pytorch/blob/3ce6f0a457dd179113cbe518f6068f6682693280/torch/lib/TH/THGeneral.h.in#L78-L81https://github.com/pytorch/pytorch/blob/3ce6f0a457dd179113cbe518f6068f6682693280/torch/lib/TH/THGeneral.h.in#L78-L81 +// 实际定义 https://github.com/pytorch/pytorch/blob/3ce6f0a457dd179113cbe518f6068f6682693280/torch/lib/TH/THGeneral.c#L96-L117 +``` diff --git a/machinelearning/pytorch/init.md b/machinelearning/pytorch/init.md index 8cd3005..19815cf 100644 --- a/machinelearning/pytorch/init.md +++ b/machinelearning/pytorch/init.md @@ -1,10 +1,15 @@ # 参数初始化 -conv2d:默认使用xavier-uniform初始化参数 -bn2d:running_mean,running_var用于记录输入数据的均值、方差,从而用于eval阶段的均值、方差。 -# 编写 +conv2d:默认使用类似xavier-uniform的方式初始化参数 +bn2d:running_mean,running_var用于记录输入数据的均值、方差,从而用于eval阶段的均值、方差。 +load_state_dict() # 加载模型 + +## 编写 + 使用Module.apply(fn)函数 ## tips + - immediate children modules + immdiate表示 \ No newline at end of file diff --git a/machinelearning/pytorch/module.md b/machinelearning/pytorch/module.md index 8fbee0f..47b319e 100644 --- a/machinelearning/pytorch/module.md +++ b/machinelearning/pytorch/module.md @@ -1,6 +1,10 @@ +# module + ## Parameter类 + 继承自Variable,它有一个特殊的属性是当赋值为类的属性时,属性会自动添加到parameter list?,从而让它出现在Module.parameter返回的迭代器中。不过Parameter没有volatile类型,默认需要求导。 类内有个方法, + ```python # __new__方法始终是静态方法。 # 面向对象的实例化步骤:创建实例对象(new)->初始化实例对象(init)->最后返回实例对象 @@ -9,7 +13,9 @@ def __new__(cls, data=None, requires_grad=True): ``` ## Module类 + 初始化函数 + ```python def __init__(self): self._backend = thnn_backend @@ -21,7 +27,9 @@ def __init__(self): self._modules = OrderedDict() # 存储模型所有Module的有序字典 self.training = True ``` + 绑定方法 + ```python __setstate__() # 魔法方法 __setattr__() # 魔法方法 diff --git a/machinelearning/pytorch/pytorch.md b/machinelearning/pytorch/pytorch.md index 5947ac0..d45de32 100644 --- a/machinelearning/pytorch/pytorch.md +++ b/machinelearning/pytorch/pytorch.md @@ -1,28 +1,33 @@ +# Pytorch + [例子](https://zhuanlan.zhihu.com/p/29024978) -使用pip安装的pytorch -import pytorch 使用anaconda安装的pytorch import torch -# Variable +## Variable(deprecated) + Variable是torch.Tensor的打包,大部分Tensor的操作,Variable都是支持的。对于一个操作(op),如果它的输入存在一个是required_grad=True,那么它的输出就是required_grad=True的,只有当输入全部是required_grad=False时,输出才required_grad=False的。而Variable()构造操作,默认的required_grad=False,而网络参数的类型也是Variable,热它默认的required_grad=True,所以对于网络内的前向传播是有梯度记录的。 ## 保存和加载整个模型 + torch.save(model_object, 'model.pkl') model = torch.load('model.pkl') ## 仅保存和加载模型参数(推荐使用) + torch.save(model_object.state_dict(), 'params.pkl') model_object.load_state_dict(torch.load('params.pkl')) - ## 选择GPU + ```python import os os.environ["CUDA_VISIBLE_DEVICES"] = "1" # gpu ``` + ## pytorch + ```python # Sets the module in evaluation mode. This has any effect only on modules such as Dropout or BatchNorm. # 具体的是设置 module.training变量为False,及子module的training变量为False,在模型内使用是self.training @@ -32,10 +37,13 @@ model.eval() ``` ## 可视化 + visdom tensorboard +onnx 模型可视化 ## Tensor + ```python # 增加维度、减维度 a.squeeze() #默认移除所有size为1的维度,也可以指定维度。 @@ -52,8 +60,11 @@ torch.FloatTensor() # 内部是float类型,而不是floatTensor()? numpy() from_numpy() ``` + ## tips -验证的时候模型的输入应该是 + +- 验证的时候模型的输入应该是 + ```python # 保证没有梯度求解,以防止浪费计算量,以volatile为输入的网络,都不会计算梯度,should be used in inference time Variable(in, volatile=True) @@ -61,13 +72,16 @@ optimizer 返回的是Variable,Variable.data是FloatTensor, Variable.data[0] (, ) ``` -## 使用问题 -- 定义模型后,调用model.cuda()会卡住,网上找的原因是cuda版本与pytorch版本不兼容 -重新安装pytorch解决 +- 训练模型时应该使用固定随机种子,这样restart代码时,可复现随机数,从而杜绝随机种子导致的问题。 +```python +torch.mannual_seed(2) +``` + +## problem + +- 问题描述:使用源码安装,Import有错 -## 使用源码安装,Import有错 -- 问题描述: ```python >>> import torch Traceback (most recent call last): @@ -76,5 +90,7 @@ Traceback (most recent call last): from torch._C import * ImportError: /home/lxg/anaconda2/lib/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /home/lxg/anaconda2/lib/python2.7/site-packages/torch/lib/libshm.so) ``` -- 解决方法: -conda install gcc,不要在pytorch的源代码目录下使用pytorch + +- 解决方法: conda install gcc,不要在pytorch的源代码目录下使用pytorch + +- 定义模型后,调用model.cuda()会卡住,网上找的原因是cuda版本与pytorch版本不兼容,重新安装pytorch解决 diff --git a/machinelearning/tensorflow.md b/machinelearning/tensorflow.md index 98bea21..33a4a80 100644 --- a/machinelearning/tensorflow.md +++ b/machinelearning/tensorflow.md @@ -1,19 +1,27 @@ +# tensorflow + [document](https://www.tensorflow.org/api_docs/) ## tensorboard + tensorboard --logdir=/home/lxg/codedata/tensorflow/log ## placeholder + tf.placeholder() 相当于定义了一个位置,这个位置中的数据在程序运行过程中指定。 feed_dict={x:} 这是一个字典map, 用于指定placeholder中的变量。 [保存和加载模型pb](http://blog.csdn.net/u014432647/article/details/75276718) + ## install + [conda](http://blog.csdn.net/nxcxl88/article/details/52704877?locationNum=13) 还是使用pip install靠谱 -# 动态图、静态图的区别 +## 动态图、静态图的区别 + 如下tensorflow中代码 + ```python node1 = tf.constant(3.0, dtype=tf.float32) node2 = tf.constant(4.0) # also tf.float32 implicitly @@ -25,8 +33,39 @@ print(sess.run([node1, node2])) # 输出为 [3.0, 4.0] ``` + 这里面不包含 3.0或者4.0,因为上面只是定义了计算图,并没有运行 -## 使用cpu(http://blog.csdn.net/silent56_th/article/details/72628606) +## [使用cpu](http://blog.csdn.net/silent56_th/article/details/72628606) + 1. 运行的时候加上前缀 -CUDA_VISIBLE_DEVICES="" python3 train.py \ No newline at end of file +CUDA_VISIBLE_DEVICES="" python3 train.py + +## bug + +cuda和cudnn的版本要对应,否则会提示错误(tensorflow与cuda的版本也要对应?) +> ImportError: libcudnn.so.6: cannot open shared object file: No such file or directory + +## 源码编译安装 + +编译tensorflow-1.11.0-rc2 CPU版本,使用cmake编译,没有使用bazel, +主要解决 + +1. 缺失abseil_cpp库的问题 + + 在一个tensorflow-1.13版本上的contrib/cmake/external文件夹下,找到abseil_cpp.cmake,并复制到本版本的对应文件夹内; + 因为abseil版本更新过快并不兼容本版本的tensorflow,所以更改abseil_cpp.cmake中的GIT_TAG=5e7d459eeca7bc53deab0ee9634601386b53d7c0(201809); + 更改abseil_cpp_STATIC_LIBRARIES变量中libabsl_int128.a到libstr_format_internal.a之后,否则会出现函数未定义; + +2. boringssl、grpc库因为要翻墙 + 可以更改git的代理,或者更改对应的borringssl.cmake、grpc.cmake为本地源码文件编译; + +3. 编译成功后生成libtensorflow.so,接下来编译安装 + 安装目录更改,在build文件夹下的cmake_install.cmake定义CMAKE_INSTALL_PREFIX变量; + 在tf_shared_lib.cmake中添加abseil的安装文件或直接复制abseil头文件到安装目录; + +编译tensorflow-1.11.0-rc2 GPU版本,使用cmake编译,没有使用bazel, +主要解决 + +1. CMakeLists.txt中指定使用CUDA9.0,但是服务器上是CUDA8.0,直接把版本号更改了;同时把提示GPU编译器版本问题的部分注释掉了; +2. nccl的安装,nccl与CUDA版本绑定,所以这里安装了一个CUDA8.0的版本; diff --git a/machinelearning/visdom.md b/machinelearning/visdom.md index c1bc492..5616716 100644 --- a/machinelearning/visdom.md +++ b/machinelearning/visdom.md @@ -6,6 +6,7 @@ pip install visdom ```shell # 对于本地电脑,本地电脑直接运行 python -m visdom.server # 浏览器可以直接打开默认端口,127.0.0.1:8097 + # 对于服务器,服务器电脑运行 -python -m visdom.server # 本地主机浏览器打开端口,127.0.0.1:8097,注意因为服务器在局域网内,所以需要在路由器上添加8097的端口转发功能 +python -m visdom.server # 本地主机浏览器打开端口,server_ip:8097,注意因为服务器在局域网内,所以需要在路由器上添加8097的端口转发功能 ``` \ No newline at end of file diff --git a/program/c++/ceres.md b/program/c++/ceres.md index 5d631e8..0e8ff77 100644 --- a/program/c++/ceres.md +++ b/program/c++/ceres.md @@ -1 +1 @@ -[ceres](http://www.ceres-solver.org/) \ No newline at end of file +# [ceres](http://www.ceres-solver.org/) \ No newline at end of file diff --git a/program/c++/cplusplus.md b/program/c++/cplusplus.md index 48315c1..6f91bcd 100644 --- a/program/c++/cplusplus.md +++ b/program/c++/cplusplus.md @@ -1,13 +1,17 @@ -[cppblog](http://cppblog.com/) +# [cppblog](http://cppblog.com/) + ------ ## 关键字 + - explicit: 使用explicit修饰的构造函数不能使用转换构造函数进行隐式准换 - 转换构造函数: 当一个类的构造函数只有一个参数,并且该参数不是本类的const引用。 ## 二维数组 double (*a)[N]; // N为常数,a即二维数组指针变量。,但是不能把第二维或者更高维的大小省略 + ### 常用库 + - boost 是一个可移植、提供源代码的C++库,作为标准库的后备,是C++标准化进程的开发引擎之一。 逻辑错误:结果与理想不匹配 @@ -19,14 +23,27 @@ - [A*](http://grinninglizard.com/MicroPather/index.htm) ### 捕获异常 -```cpp + +```c try{ // 可能抛出异常的语句 } catch(exceptionType variable){ // 处理异常的语句 } +// for example +try{ + FgLBFTrain Lbf(argv[2]); + if (string(argv[1]) == "Train") + Lbf.Train(); + if (string(argv[1]) == "Predict") + Lbf.Predict(argv[3]); +} +catch (const exception &e){ + cout << e.what() << endl; +} ``` + ### 仿函数 仿函数(functor)又称为函数对象(function object)是一个能行使函数功能的类,使一个类看上去像一个函数。仿函数的语法几乎和我们普通的函数调用一样,不过作为仿函数的类,都必须重载operator()运算符,即函数调用运算符 diff --git a/program/c++/eigen.md b/program/c++/eigen.md index 184aee9..2ededb1 100644 --- a/program/c++/eigen.md +++ b/program/c++/eigen.md @@ -1,18 +1,23 @@ +# eigen + [eigen](http://eigen.tuxfamily.org/index.php?title=Main_Page) [quick reference](http://eigen.tuxfamily.org/dox/group__QuickRefPage.html) 一个矩阵运算库 -------- ## basics + 基本数据结构包括 Matrix Vector,Vector可以看做是行或列为1的Matrix。 Matrix的声明分为静态内存分配和动态内存分配,动态内存分配因为存在内存的变化,所以相对消耗资源多一些。编程时,两种的用法如下L: + ```c++ Eigen::Matrix2f m1; //静态内存分配 Eigen::MatrixXf m2(rows, columns); //动态内存分配 ``` + ## 初始化 ## table of header + Geometry LU Cholesky diff --git a/program/c++/libevent.md b/program/c++/libevent.md index e9f0d21..9e4284e 100644 --- a/program/c++/libevent.md +++ b/program/c++/libevent.md @@ -1 +1 @@ -网络编程 \ No newline at end of file +# 网络编程 \ No newline at end of file diff --git a/program/opengl.md b/program/c++/opengl.md similarity index 100% rename from program/opengl.md rename to program/c++/opengl.md diff --git a/program/c++/stl.md b/program/c++/stl.md new file mode 100644 index 0000000..4e2149b --- /dev/null +++ b/program/c++/stl.md @@ -0,0 +1,100 @@ +# STL standard template library + +std::size_t 是sizeof返回的无符号整数类型,不同 + +## stack 栈容器 + +```cpp +s.empty() // 判断是否为空 +s.size() // 返回元素个数 +s.top() // 访问栈顶元素,对空栈调用访问栈顶元素操作会导致程序异常终止,Segmentation fault (core dumped) +s.pop() // 弹出栈顶元素,对空栈调用弹出操作会导致程序异常终止 +s.push() // 压入元素的拷贝,实际调用实现栈的底层容器的push_back()函数, 无返回值void。 +s.emplace() // 新元素在容器内部就地构造,实际调用实现栈的底层容器的emplace_back()函数。就是输入参数对应容器内元素的构造函数参数。 +s.swap() // 交换两个栈的所有元素,时间复杂度为O(1) +// 没有clear(),erase()函数 +``` + +## queue 队列 + +```cpp +q.empty() +q.size() +q.front() +q.back() +q.push() +q.emplace() +q.pop() +q.swap() +// 无clear(),erase()函数,无迭代器操作 +``` + +## deque 双向队列 +```cpp +d.empty() +d.size() +// 访问 +d.front() +d.back() +// 修改操作 +d.push_back() +d.pop_back() +d.push_front() +d.pop_front() +d.clear() +d.erase() +d.swap() +// 迭代器操作 +d.begin(); d.end() +d.rbegin(); d.rend() +``` + +## vector 矢量容器,元素连续存储 +```cpp +v.empty() // 判断是否为空 +v.size() // +// 访问 +v.front() // 返回第一个元素 +v.back() // 返回最后一个元素 +// 修改 +v.push_back() // +v.emplace_back() // +v.insert() // 传入迭代器及值,插入到迭代器所指向的位置 +v.erase() // 擦除迭代器所指元素,或范围内的元素。返回下一个元素的迭代器,而其它已有迭代器会失效。 +v.clear() // 清空所有元素 +v.swap() // +// 迭代器操作 +``` + +## map 一种排序的关联容器,键值要唯一,使用红黑树实现,是树型结构,不连续存储 + +```cpp +m.insert() // 不影响其它已存在迭代器 +m.erase() // 不影响其它已存在迭代器 +``` + +## string + +```cpp +s.empty() +s.length() +s.size() +// 访问 +s.front() +s.back() +s.substr() // [pos,pos+count) +s.find() +s.starts_with() // c++20 +s.ends_with() // c++20 +// 按字母顺序比较字符串 +s.compare() // 大小写敏感,有两个比较规则,1.长度不同,字符串结尾为'\0'同样参与比较,2.长度相同,按第一个不同字符的大小比较输出 +< > <= >= == != +// 修改 +s.push_back() +s.pop_back() +s.append() +s.insert() +s.erase() +s.clear() +// 迭代器操作 +``` \ No newline at end of file diff --git a/program/v4l.md b/program/c++/v4l.md similarity index 98% rename from program/v4l.md rename to program/c++/v4l.md index 4db5201..965ef0e 100644 --- a/program/v4l.md +++ b/program/c++/v4l.md @@ -1,23 +1,26 @@ -video for linux(v4l2) +# video for linux(v4l2) ----- [v4l2 doc](http://v4l.videotechnology.com/) [blog for v4l2](http://unicornx.github.io/2016/03/12/20160312-v4l2-app/) + ## UVC(Usb Video device Class) + 说的是一类支持视频流的USB设备,有对应的驱动支持这样的设备。 ## v4l2(video for linux) + 是一个设备驱动,视频读取的API集合,以及linux的驱动程序框架。 ## uvc与v4l2的关系 ## code + [blog](http://www.cnblogs.com/surpassal/archive/2012/12/19/zed_webcam_lab1.html) http://blog.csdn.net/tsuibeyond/article/details/50654823 - ## 摄像头驱动 -http://blog.csdn.net/codectq/article/details/44278465 +http://blog.csdn.net/codectq/article/details/44278465 - 输入和输出(三种模式,通过v4l2_capability 查询) Read/Wtite : 可能需要cpu去复制数据,不过也可能支持dma,所以效率不一定不只交换指针的方法差,没有时间戳等信息。 @@ -29,9 +32,12 @@ http://blog.csdn.net/codectq/article/details/44278465 - 扫描方式 progressive: 逐行扫描 interlace : 隔行扫描 + ## notes + 写代码可以参考doc附录里的例子 结构体 + ```c++ struct v4l2_capability { @@ -48,6 +54,7 @@ struct v4l2_buffer ``` 控制参数 + ```c++ VIDIOC_QUERYBUF; //查询buf的状态,参数v4l2_buffer VIDIOC_QBUF; // enqueue 参数v4l2_bufferr diff --git a/linux/clang.md b/program/compile/clang.md similarity index 100% rename from linux/clang.md rename to program/compile/clang.md diff --git a/linux/cmake.md b/program/compile/cmake.md similarity index 91% rename from linux/cmake.md rename to program/compile/cmake.md index d8aa5ea..c52b6c6 100644 --- a/linux/cmake.md +++ b/program/compile/cmake.md @@ -1,19 +1,13 @@ +# CMakeLists.txt + https://cmake.org/Wiki/CMake //系统wiki https://cmake.org/cmake/help/v3.0/index.html [指令查找](https://cmake.org/cmake/help/v3.10/) -# CMakeLists.txt -## tips -- 指令是大小写无关的,参数、变量名是大小写相关的 -- if语句是直接使用变量名,if语句内涵取变量值的工作(${VAR}) -- 参数之间使用空格或分号分开 -- 注释使用"#" -- 设置debug版本编译 -```shell - set(CMAKE_BUILD_TYPE "Debug") - set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g -ggdb") -``` +可以做到跨平台编译 + ## 指令 + 1. project(PROJECTNAME [CXX] [C] [Java]) 指定工程名、工程支持的语言,默认支持所有语言。 会自动定义两个变量project_binary_dir、project_source_dir @@ -35,7 +29,7 @@ https://cmake.org/cmake/help/v3.0/index.html 7. add_library(LIBRARY_NAME [SHARED|STATIC|MODULE] [EXCLUDE_FROM_ALL] [SRC_FILE]) exclude_from_all:表示不会被默认构建,除非有其它模块依赖或手动创建 前缀名lib和后缀名.a或.so是自动添加的,不在name的定义范围内 -8. set_target_properties() +8. set_target_properties() 9. include_directories([after|before] [system] dir2 dir2 ...) 向工程添加多个特定的头文件搜索路径,如果路径存在空格,需使用双引号括起来; 默认是将搜索路径追加到已有的搜索路径的后面,即默认参数after @@ -48,53 +42,59 @@ https://cmake.org/cmake/help/v3.0/index.html 12. subdirs:一次添加多个子目录,不推荐使用 13. cmake_minimum_required(VERSION 2.8) 需要的最低版本号 - 14. find命令查找的是CMAKE_MODULE_PATH下的目录Find< name >.cmake模块 - find_package(OpenCV 2.4.9 REQUIRED) 版本号要放在OpenCV的后面,REQUIRED的前面,表示找不到就停止编译并报错 - include_directories( ${OpenCV_INCLUDE_DIRS} ) [头文件包含](http://docs.opencv.org/master/db/df5/tutorial_linux_gcc_cmake.html) + find_package(OpenCV 2.4.9 REQUIRED) 版本号要放在OpenCV的后面,REQUIRED的前面,表示找不到就停止编译并报错 + **与find_library有什么区别?** + include_directories( ${OpenCV_INCLUDE_DIRS} ) + [头文件包含](http://docs.opencv.org/master/db/df5/tutorial_linux_gcc_cmake.html) 找到包后,会定义如下变量 _FOUND _INCLUDE_DIRS or _INCLUDES _LIBRARIES or _LIBRARIES or _LIBS _DEFINITIONS - -15. aux_source_directory(dir VARIABLE) +15. aux_source_directory(dir VARIABLE) 把一个目录里的源代码文件列表存储在一个VARIABLE变量中 +16. file: 可以正则化匹配*.cpp文件 ## cmake变量 + 变量引用方式: ${VAR_NAME};在if语句中,直接使用变量名if var_name -自定义变量方式: +自定义变量方式: + 1. 显式定义,使用set命令; set(CMAKE_CXX_FLAGS -std=c++11) 2. 隐式定义,像project(name)命令会定义name_binary_dir和name_source_dir两个变量 常用变量: + - project_binary_dir: 执行make的目录,即工程编译发生的目录 - project_source_dir: 整个工程顶层目录 - executable_output_path: 可执行文件的生成目录,在哪里add_executable在哪里设置这个变量 - library_output_path: 共享库、静态库的生成目录,在哪里add_library在哪里设置这个变量 - cmake_install_prefix: 文件安装目录的前缀,默认是/usr/local - CMAKE_C_FLAGS: 设置c编译选项(即gcc的参数),也可以通过add_definitions()添加,必须是大写才会有用 -- CMAKE_< CLANG >_FLAGS:设置c++编译选项,同上。 - flags used regardless of the value of CMAKE_BUILD_TYPE. +- CMAKE_CLANG_FLAGS:设置c++编译选项,同上。 LANG flags used regardless of the value of CMAKE_BUILD_TYPE. - CMAKE_MOUDLE_PATH +- CMAKE_INCLUDE_PATH: cmake中的find_path命令会搜索这个路径下的目录,查找头文件 +- CMAKE_LIBRARY_PATH: cmake中的find_library命令会搜索这个路径下的库文件 + ## 环境变量(不是cmake变量,而是操作系统的环境变量) + cmake调用环境变量的方式:$ENV{var_name} 设置环境变量的方式:set(ENV{var_name} value) -- CMAKE_INCLUDE_PATH - cmake中的find_path命令会搜索这个路径下的目录,查找头文件 -- CMAKE_LIBARAY_PATH - cmake中的find_library命令会搜索这个路径下的库文件 -# make -## 指令 + +## 命令 + - make clean 清除编译出的可执行文件 - make distclean 不支持,编译过程的临时文件是无法清除的 - make VERBOSE=1 输出编译错误信息 + - [cmake设置指定版本opencv](http://www.cnblogs.com/xzd1575/p/5555523.html) + ```shell set(OpenCV_DIR "/home/lxg/app/opencv-2.4.9/build") ``` @@ -105,13 +105,15 @@ make是一条命令,其有三个常用的选项: -k:让make命令在发现错误时仍然继续执行,而不是在检测到第一个错误时就停下来。 make myapp、clean、install即指定了编译生成的目标;当不指定特定目标时,默认创建makefile文件里的第一个目标,第一个all:,一个特殊目标。 makefile文件的组成: + - 依赖关系:定义了每个输出文件与源文件的依赖关系。 - 规则:定义了输出文件的创建方式,如编译命令gcc。必须以tab键开头。 - 注释:已#开头 + makefile官网 : http://www.gnu.org/software/make/manual/make.html +## CMakeLists.txt的编写 -# CMakeLists.txt的编写 Cmake set(ENV{variable} ) //设置环境变量 options @@ -129,6 +131,7 @@ cmake -DCMAKE_BUILD_TYPE=Debug(Release) path 执行cmake . 得到makeFile,接着可以执行 make ,编译得到可执行文件,这是内部编译 。更好的方法是mkdir build,在build文件夹下执行cmake .. ,接着make,这样可以把编译文件留到build文件夹下,这叫外部编译。 ## 静态库、共享库 + 在linux中,库文件分为静态库和共享库两种,静态库以 .a结尾,共享库以 .so结尾, 所有库都是一些函数的打包集合,差别在于静态库每次调用都会生成一个副本,而共享库只有一个副本,更省空间。库文件是一个二进制压缩包,使用时,还需要对应的头文件。 find_package : cmake提供的寻找某个库的头文件与库的指令,如果成功找到,则提供头文件和库文件所在的目录的变量(libraryName_INCLUDE_DIRS, libraryName_LIBRARIES) @@ -143,10 +146,11 @@ target_link_libraries(useHello hello_shared) //usehello是要生成的可执行 error : - 无法找到**Config.cmake,这个文件由安装包的配置决定,不是cmake自动提供的。 -# blog -五、 内部变量 -CMAKE_C_COMPILER:指定C编译器 +## blog + +五、内部变量 +CMAKE_C_COMPILER:指定C编译器 CMAKE_CXX_COMPILER: CMAKE_C_FLAGS:编译C文件时的选项,如-g;也可以通过add_definitions添加编译选项 add_definitions(-std=c++11) //指定c++11 @@ -154,11 +158,11 @@ EXECUTABLE_OUTPUT_PATH:可执行文件的存放路径 LIBRARY_OUTPUT_PATH:库文件路径 CMAKE_BUILD_TYPE::build 类型(Debug, Release, ...),CMAKE_BUILD_TYPE=Debug BUILD_SHARED_LIBS:Switch between shared and static libraries -内置变量的使用: +内置变量的使用: 在CMakeLists.txt中指定,使用set cmake命令中使用,如cmake -DBUILD_SHARED_LIBS=OFF -六、 命令 +六、命令 project (HELLO) #指定项目名称,生成的VC项目的名称; >>使用${HELLO_SOURCE_DIR}表示项目根目录 @@ -184,37 +188,23 @@ target_link_libraries:添加链接库,相同于指定-l参数 add_library: >> add_library(Hello hello.cxx) #将hello.cxx编译成静态库如libHello.a add_custom_target: -message( status|fatal_error, “message”): set_target_properties( ... ): lots of properties... OUTPUT_NAME, VERSION, .... link_libraries( lib1 lib2 ...): All targets link with the same set of libs -七、 说明 +七、说明 1,CMAKE生成的makefile能够处理好.h文件更改时只编译需要的cpp文件; -八、 FAQ +八、FAQ 1) 怎样获得一个目录下的所有源文件 >> aux_source_directory(

) >> 将dir中所有源文件(不包括头文件)保存到变量variable中,然后可以add_executable (ss7gw ${variable})这样使用。 -2) 怎样指定项目编译目标 ->> project命令指定 - 3) 怎样添加动态库和静态库 >> target_link_libraries命令添加即可 -4) 怎样在执行CMAKE时打印消息 ->> message([SEND_ERROR | STATUS | FATAL_ERROR] "message to display" ...) - ->> 注意大小写 - -5) 怎样指定头文件与库文件路径 ->> include_directories与link_directories ->>可以多次调用以设置多个路径 ->> link_directories仅对其后面的targets起作用 - 6) 怎样区分debug、release版本 >>建立debug/release两目录,分别在其中执行cmake -DCMAKE_BUILD_TYPE=Debug(或Release),需要编译不同版本时进入不同目录执行make即可; Debug版会使用参数-g;Release版使用-O3 –DNDEBUG @@ -302,4 +292,17 @@ make VERBOSE=1 [3] http://www.cmake.org/ [4] 安装包中文档 [5] Andrej Cedilnik,HOWTO: Cross-Platform Software Development Using CMake,October, 2003 -[6] Cjacker,CMake实践.PDF \ No newline at end of file +[6] Cjacker,CMake实践.PDF + +## tips + +- 指令是大小写无关的,参数、变量名是大小写相关的 +- if语句是直接使用变量名,if语句内涵取变量值的工作(${VAR}) +- 参数之间使用空格或分号分开 +- 注释使用"#" +- 设置debug版本编译 + +```shell + set(CMAKE_BUILD_TYPE "Debug") + set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g -ggdb") +``` diff --git a/linux/gcc.md b/program/compile/gcc.md similarity index 97% rename from linux/gcc.md rename to program/compile/gcc.md index 93c4294..42940fd 100644 --- a/linux/gcc.md +++ b/program/compile/gcc.md @@ -1,10 +1,12 @@ +# gcc + https://gcc.gnu.org/ https://gcc.gnu.org/onlinedocs/gcc-6.2.0/gcc/index.html#toc_Invoking-GCC - ## command options + --std= +-std= -std= @@ -29,5 +31,6 @@ a.out(assembler output) gcc -E -dM - > class vector; // generic template diff --git a/program/compile/make.md b/program/compile/make.md new file mode 100644 index 0000000..2154102 --- /dev/null +++ b/program/compile/make.md @@ -0,0 +1,14 @@ +# MakeFile + +2019-04-27 21:50 + +[跟我一起写makefile](https://seisman.github.io/how-to-write-makefile/introduction.html) + +源代码---->编译---->链接 + +- ?= 表示当变量未被赋值时,执行赋值 +- := make命令执行时,会将整个makefile文件展开后,再决定变量的值,'='号赋值后,变量的值为最后一个赋值命令的值,而':='会根据赋值命令的位置进行赋值。 + +## tips + +- .a指archive file,存档文件,与windows的.lib文件意思相同 \ No newline at end of file diff --git a/program/database/sql.md b/program/database/sql.md new file mode 100644 index 0000000..8c0a294 --- /dev/null +++ b/program/database/sql.md @@ -0,0 +1,51 @@ +## sql语句 +[python-sql runoob ](http://www.runoob.com/python/python-mysql.html) + +connect 连接 +cursor 箭头 + +cursor.fetchone() +cursor.fetchall() + +## 注释 +```sql +/*注释*/ +-- 注释 +``` +## 表操作(插入、删除) +```sql +-- 如果没有表则创建,支持 char, int, float +create table if not exists TABLENAME (property1 INT, property2 CHAR(20) NOT NULL,...) +-- 如果数据表已经存在使用 execute() 方法删除表。 +DROP TABLE IF EXISTS EMPLOYEE +``` + +## 数据插入 +```sql +-- 把数据插入表中数据 +insert into TABLENAME (property1, property2,...) values (value1, value2) +--插入数据忽略已存在的数据项 +INSERT or IGNORE into tablename VALUES (value1,value2 +--插入数据替代已存在的数据项 +INSERT or REPLACE into tablename VALUES (value1,value2 +``` + +## +``` sql +-- Block数据 +``` + +## 查询操作 +```sql +select * from TABLENAME +``` + +执行语句后需要commit,才能改变数据库 + +- 原子性 +- 一致性 +- 隔离性 +- 永久性 + +## tips +sql语句大小写无关 \ No newline at end of file diff --git a/program/c++/sqlite.md b/program/database/sqlite.md similarity index 87% rename from program/c++/sqlite.md rename to program/database/sqlite.md index 51c9e63..8229407 100644 --- a/program/c++/sqlite.md +++ b/program/database/sqlite.md @@ -1,5 +1,5 @@ -跨平台的轻型数据库 ----- +# 跨平台的轻型数据库 + [官方文档usage](http://www.runoob.com/sqlite/sqlite-c-cpp.html) [官方文档](https://www.sqlite.org/docs.html) @@ -7,16 +7,24 @@ [博客usage](http://www.cnblogs.com/5211314jackrose/p/5815935.html) [数组](http://blog.csdn.net/xiaoaid01/article/details/17998013) -## tips -需要把sqlite的语句写入字符串,再把字符串传入sqlite3_exec()函数来执行。字符串的格式要求包括: -- sql语句大小写都可以 -- 注释使用 "--和--":或"/* 和 */" - - sqlite语句以分号为结尾,对于比较长的字符串可以使用‘\’来换行,是c++里的字符串换行。 -```c++ -#include +## 特点 + +基于c语言写的,支持c++、python、java等多种语言 + +## 安装 + +可以直接下载源码编译安装,选择 makefile 的版本 + +```shell +./configure # 生成makefile +make # 把源代码编译成库文件 +sudo make install # 把库文件安装到系统目录'/usr/local/lib/',把头文件安装到'/usr/local/include/' +# 也可以直接安装包 +sudo apt-get install sqlite # 不能正常使用 ``` ## 图形化管理界面 + ```shelll # 需要sql命令 sudo apt-get install sqliteman @@ -24,24 +32,25 @@ sudo apt-get install sqliteman sudo apt-get install sqlitebrowser ``` -## 特点 -基于c语言写的,支持c++、python、java等多种语言 +## 命令行接口 -## 安装 -可以直接下载源码编译安装,选择 makefile 的版本 ```shell -./configure # 生成makefile -make # 把源代码编译成库文件 -sudo make install # 把库文件安装到系统目录'/usr/local/lib/',把头文件安装到'/usr/local/include/' -# 也可以直接安装包 -sudo apt-get install sqlite # 不能正常使用 +man sqlite #获取sqlite帮助信息 ``` +## python接口 + +[python interface](http://www.runoob.com/sqlite/sqlite-python.html) + +## C接口 + ## 数据结构 + sqlite3:数据库文件打开对象 sqlite3_stmt:数据库文件操作对象 ## 使用 + ```c++ // 数据库使用的数据结构定义 sqlite3 *db; @@ -87,4 +96,16 @@ int sqlite3_finalize(sqlite3_stmt *pStmt); // 关闭打开的数据库 int sqlite3_close(sqlite3*); +``` + +## tips + +需要把sqlite的语句写入字符串,再把字符串传入sqlite3_exec()函数来执行。字符串的格式要求包括: + +- sql语句大小写都可以 +- sql语句中注释使用 "--和--":或"/* 和 */" +- sqlite语句以分号为结尾,对于比较长的字符串可以使用‘\’来换行,是c++里的字符串换行。 + +```c++ +#include ``` \ No newline at end of file diff --git a/program/dotnet/csharp.md b/program/dotnet/csharp.md new file mode 100644 index 0000000..d11121e --- /dev/null +++ b/program/dotnet/csharp.md @@ -0,0 +1,60 @@ +# c_sharp + +[c#类定义、函数查询](https://docs.microsoft.com/en-us/dotnet/api/index?view=netframework-4.7.2) +[microsoft c#](https://docs.microsoft.com/zh-cn/dotnet/csharp/index) +[runoob](http://www.runoob.com/csharp/csharp-tutorial.html) +可以使用[mono](https://www.mono-project.com/)在ubuntu下开发界面程序 + +## 数据类型 + +1. 值类型: 派生自System.ValueType +2. 引用类型: 不包含实际数据,指的是一个内存地址。内置引用类型包含以下三种: + - object + - dynamic + - string +3. 指针类型: 存储地址 + +## 数组 + +声明一个数组不会在内存中初始化数组。当初始化数组变量时,您可以赋值给数组。 + +数组是一个引用类型,所以您需要使用 new 关键字来创建数组的实例。 + +```c# +double[] balance = new double[10]; +``` + +## 字符串 + +```cpp +// string是System.String类的别名。 +// 类的属性 +string.Chars // 获取char对象的指定地址? +string.Length // +// 类的方法 +string.Compare() //字符串比较 +... +``` + +## 结构 + +类是引用类型,结构是值类型。 + +## 类 + +## 接口 + +比较像c++中的纯虚类,用于统一继承类的接口 + +## 不安全代码(unsafe) + +代码块使用unsafe修饰时,允许使用指针类型,**不安全代码或非托管代码**是指使用了指针变量的代码块? +c#中的变量受垃圾回收器管理,所以变量在程序运行时有可能会被移动到其它位置,所以指针要加fixed修饰。通过stackalloc申请分配的内存不受内存管理器管理。 + +## 图像处理 + +[imageprocessor](https://imageprocessor.org/) +[自带的GDI](df) +[c#读取图像各种方法性能对比](https://blogs.msdn.microsoft.com/dotnet/2017/01/19/net-core-image-processing/) +[c++ OpenCV <===> c# Bitmap](https://github.com/sumsuddin/ImageProcessingOpenCV) +[数组 ===> 图像](https://blog.csdn.net/sirenxiaohuayuan/article/details/50345875) diff --git a/program/dotnet/dotnet.md b/program/dotnet/dotnet.md new file mode 100644 index 0000000..cdcbfc1 --- /dev/null +++ b/program/dotnet/dotnet.md @@ -0,0 +1,20 @@ +# .net + +[ubuntu install](https://dotnet.microsoft.com/learn/dotnet/hello-world-tutorial/install) +[.net指南](https://docs.microsoft.com/zh-cn/dotnet/standard/) +[.net框架](https://www.cnblogs.com/eshizhan/archive/2010/01/26/1657041.html) +[命令行](https://docs.microsoft.com/zh-cn/dotnet/core/tools/index?tabs=netcore2x) + +- ASP.NET + 是一个使用 HTML、CSS、JavaScript 和服务器脚本创建网页和网站的开发框架 + +.net的初级组成是CLI(common language infrastructure)和CLR(common language runtime,通用语言运行时) + +c#就是基于.net的托管代码。 +c++/cli是微软设计用来替代c++托管扩展(managed c++)的语言。 +c#的P/Invoke技术 + +## tips + +- native code: 非托管代码 +- managed code: 托管代码 \ No newline at end of file diff --git a/program/dotnet/ide.md b/program/dotnet/ide.md new file mode 100644 index 0000000..747df1c --- /dev/null +++ b/program/dotnet/ide.md @@ -0,0 +1,5 @@ +# integrated development environment (IDE) + +```shell +sudo apt-get install monodevelop +``` diff --git a/program/dotnet/mixed.md b/program/dotnet/mixed.md new file mode 100644 index 0000000..308777d --- /dev/null +++ b/program/dotnet/mixed.md @@ -0,0 +1,46 @@ +# Csharp && C++ 混合编程 + +1. 非托管c++代码编译成dll,然后在c#中使用dllimport调用。这种方法只能使用函数,不支持类 +2. 直接编写托管c++输出类库,供c#调用。但是托管c++不兼容本机c++中的很多内容? +3. 利用托管c++把本机c++包装起来? + +## 代码示例 + +```c# +// c++中的代码 +extern "C"{ + __declspec(dllexport) void hello() {} + __declspec(dllexport) bool __stdcall world(char *str) {} +} +// c#中的代码 +// DllImport用于标识非托管代码段。 +// 形参: dllname, 可选属性:EntryPoint(非托管方法入口点), CharSet(封送字符串参数的编码方式?Unicode,Ansicode), CallingConvention(调用约定) +// 1. 数据复制封送 2. 数据内存地址封送 +using System.Runtime.InteropServices; +class CPP{ + [DllImport("process.dll", EntryPoint="hello")] + public static extern void hello(); + [DllImport("process.dll", EntryPoint="world")] + public static extern void world([MarshalAs(UnmanagedType.LPStr)]string str); +} + +// c#调用 +CPP.hello(); +CPP.world("heollo"); +``` + +```cpp +// c#与c++中类型的转换对应关系 +handle <---> IntPtr +char * <---> string +unsigned char * <---> ref byte +int * <---> ref int +int & <---> ref int +``` + +## tips + +- [呼叫约定](http://www.cnblogs.com/manyou/archive/2012/07/20/2600565.html) +- 提示找不到cppdll时,也可能是因为没有找到cppdll的依赖项 +- P/Invoke (platform invocation services,平台调用服务),公共语言运行时(CLR)提供的跨平台调用方法 +- interop 互操作 \ No newline at end of file diff --git a/program/dotnet/ui.md b/program/dotnet/ui.md new file mode 100644 index 0000000..b900cc6 --- /dev/null +++ b/program/dotnet/ui.md @@ -0,0 +1,3 @@ +# user interface + +c# 控件双击生成对应代码段 \ No newline at end of file diff --git a/program/opencv/videoCapture.md b/program/gpu/cublas.md similarity index 100% rename from program/opencv/videoCapture.md rename to program/gpu/cublas.md diff --git a/program/gpu/cuda.md b/program/gpu/cuda.md new file mode 100644 index 0000000..29cfed5 --- /dev/null +++ b/program/gpu/cuda.md @@ -0,0 +1,116 @@ +# cuda + +Compute Unified Device Architecture,统一设备计算架构 + +## tutorials + +[best practice guide](https://docs.nvidia.com/cuda/cuda-c-best-practices-guide/) +[cuda c programing guide](https://docs.nvidia.com/cuda/cuda-c-programming-guide/) +[cuda runtime](https://docs.nvidia.com/cuda/nvrtc/index.html) +[available tutorial list](https://docs.nvidia.com/cuda/) +[cuda blog](https://blog.csdn.net/shuzfan/article/details/77095270) +[cuda code sample](https://developer.nvidia.com/cuda-code-samples) +[NVIDIA CUDA Programming Guide](sd) +[NVIDIA CUDA Best Practices Guide](sd) +[cuda by example source code](https://developer.nvidia.com/cuda-example) + +## history + +早期的GPU只是用来显示,并不能用来做通用计算,所以人们只能使用OpenGL、DirectX图形编程函数库来控制GPU。2006年发布GeForce 8800GTX后,才在标准C语言的基础上添加一些额外的关键字,形成CUDA C,用于GPU的通用计算,并公开了CUDA C的编译器以及驱动。 + +## setup + +development environment: driver,cuda toolkit(gpu compiler) + +cuda要运行在两个不同的处理器上(cpu&gpu),所以需要两个编译器。而[cuda toolkit](https://developer.nvidia.com/cuda-downloads)只包含GPU编译器,还需要CPU编译器,cuda by example中推荐visual studio。而安装cuda toolkit时,会自动寻找visual studio,并将编译器集成到visual studio中,所以需要先安装visual studio。 + +nvidia nsight是cuda的代码调试器,安装cuda toolkit也会自带安装nvidia nsight hub,使visual studio也支持cuda调试? + +SMs:Streaming Multiprocessors,compute capability与SMs version有关,版本号由'.'分开的两个数字构成,第一个是架构,包括Tesla、Maxwell等等,第二个是对core architecture做小改动的编号。 + +## hello cuda + +```m +we refer to CPU and the system’s memory as the host and refer to the GPU and its memory as the device. A function that executes on the device is typically called a kernel. +``` + +编译器和运行时用于管理从主机到设备代码的调用? + +```m +kernel<<<1, 1>>>() +The angle brackets denote arguments we plan to pass to the runtime system. These are not arguments to the device code but are parameters that will influence how the runtime will launch our device code. +the first number in those parameters represents the number of parallel blocks in which we would like the device to execute our kernel. +the second parameter actually represents the number of threads per block we want the CUDA runtime to create on our behalf. +blockIdx是运行时定义的一个内置变量,虽然我们的代码未定义它,但可以直接使用。 +``` + +## architecture + +![memory](../../image/program/gpumemory.png) + +如图,一个kernel启动的所有线程称为一个网格(grid),而网格又可以分为很多线程块(block)。**GPU的物理结构也是这么划分的吗**?。总的来说,线程结构包含两个层次,第一个层次是grid,第二个层次是block,所以一个线程需要两个变量来唯一标识,即blockIdx和threadIdx,它们都是dim3类型变量,包含(x,y,z)。 + +一个线程块(block)的所有线程都运行在同一个流式多处理器上(Streaming Multiprocessor,SM),而流式多处理器的计算资源有限,现代GPU的线程块支持达1024个线程。 + +全局内存、常量内存、纹理内存 + +## hardware + +GPU的核心组件是流式多处理器(SM),SM的核心组件包括CUDA核心、共享内存和寄存器等。 +当执行kernel时,grid内的线程块被分配到SM上,一个线程块只能在一个SM上调度,而一个SM一般可以同时调度多个线程块。grid只存在于逻辑层,内部线程块被分配到多个SM物理层上。 + +SM采用单指令多线程([Single Instruction Multiple Thread,SIMT](https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#simt-architecture))架构。基本的执行单元是线程束(warp),一个warp包含32个线程,GPU规定,这些线程在同一指令周期执行相同的指令,但每个线程有自己独立的寄存器与指令地址计数器,当遇到分支结构时,一些线程可能需要等待来完成不同分支执行状态的同步。一个SM可以并发多个线程束,线程块被进一步分配到不同的线程束内。 + +由于SM的基本执行单元warp可执行32个线程,所以一般线程块一般设为32的整数倍。 + +## basic concept in cuda c + +- cuda runtime? 存在于cudart库中。 + cuda runtime是cuda 的api接口,还存在另一种更早的api接口叫做cuda driver api,这个接口更复杂一些,runtime是对driver api的封装,不过两者的性能基本一致。 +- cuda指令集叫做PTX +- kernel:使用__global__定义的函数,在device中运行,一个kernel启动的所有线程称为一个grid +- gpu的线程是什么意思 +- threads 的集合是block(可以是一维、二维或三维)),一个block运行在一个core上 +- block的集合是grid(可以是一维、二维或三维) +- grid: +- <<>>表示: + > $$\begin{aligned} arg1 * arg2 &= arg1 * arg2 \\ + blocks * threads\ per\ blocks &= parallel\ threads\end{aligned}$$ +- key word + + ```c + __global__ // kernel function,在主机(或设备)中调用,异步运行于设备, + __device__ // just for cuda function,仅在设备上运行 + __host__ // 主机上运行,一般可以省略 + __shared__ // block内多线程共享的内存,每个block都会保存一个这样的内存块,与c里的static和volatile类似 + + // 不再需要cudaMalloc和cudaFree,要使用cudaMemcpyToSymbol函数而不是cudaMemcpy + // 不能再函数内部做声明、定义 + // 不能用作函数实参,可以用作全局变量 + // 使用constant耗时更稳定,基本保持使用全局显存的最小值 + __constant__ // 常量内存,在kernel运行期间不可改变的显存, + // texture memory,纹理内存,是一种只读内存 + __syncthreads() // 一个block中的所有线程在执行完毕前面的程序后,才会运行后面的程序 + ``` + +## api + +```c +cudaMalloc() // 第一个变量是一个指针的地址,第二个变量是所申请内存的大小 +cudaFree() +cudaMemcpy(dst, src, size, type) +cudaGetDeviceProperties(cudaDeviceProp) +cudaSetDevice() +cudaMallocManaged() // 统一内存管理 +cudaDeviceSynchronize() // 数据同步 +``` + +## tips + +[example](C:\ProgramData\NVIDIA Corporation\CUDA Samples\v9.1\0_Simple\asyncAPI) + +windows SDK(software development kit,软件开发工具包): 包括头文件、库文件、示例代码、开发文档、开发工具。 + +- ALU: arithmetic logitic units, 逻辑运算单元是中央处理器的执行单元。 +- warp:线程束 +- GPGPU: 面向通用计算的GPU,General Computing GPU \ No newline at end of file diff --git a/program/gpu/cudnn.md b/program/gpu/cudnn.md new file mode 100644 index 0000000..d36e661 --- /dev/null +++ b/program/gpu/cudnn.md @@ -0,0 +1 @@ +cudnn 是一个Nvidia提供的神经网络代码库 \ No newline at end of file diff --git a/program/gpu/gpu.md b/program/gpu/gpu.md new file mode 100644 index 0000000..1c4e43e --- /dev/null +++ b/program/gpu/gpu.md @@ -0,0 +1 @@ +(list)[https://en.wikipedia.org/wiki/List_of_Nvidia_graphics_processing_units#GeForce_20_series] \ No newline at end of file diff --git a/program/gpu/nccl.md b/program/gpu/nccl.md new file mode 100644 index 0000000..7b0fb1b --- /dev/null +++ b/program/gpu/nccl.md @@ -0,0 +1,5 @@ +# nccl + +关于多GPU数据传输的库 + +[mainpage](https://developer.nvidia.com/nccl) diff --git a/program/gpu/nvcc.md b/program/gpu/nvcc.md new file mode 100644 index 0000000..babc0ce --- /dev/null +++ b/program/gpu/nvcc.md @@ -0,0 +1,9 @@ +# nvcc + +NVidia Cuda Compiler : 是cuda的编译器 + +- just-in-time compilation,运行时才将PTX代码编译成可执行文件cubin。 +参数 + +- code +- arch \ No newline at end of file diff --git a/program/jekyll.md b/program/jekyll.md index 155b484..80b0559 100644 --- a/program/jekyll.md +++ b/program/jekyll.md @@ -1,7 +1,9 @@ -[jekyll](http://jekyllcn.com/) +# [jekyll](http://jekyllcn.com/) + +## 1. ubuntu安装jekyll + +依赖项 -#### 1. ubuntu安装jekyll -依赖项 - Ruby - RubyGems - NodeJS @@ -11,9 +13,13 @@ - $ sudo gem install jekyll ### 2. 安装成功Jekyll后,接着就是网站初始化,把一个文件夹设置为网站存储地址 + - $ jekyll new myblog + myblog为网站安装到的文件夹,可以用 '.'表示安装到当前目录,如果当前目录非空,需要添加 --force 参数,即 + - $ jekyll new . --force +
 输出错误  Dependency Error: Yikes! It looks like you don't have bundler or one of its dependencies installed. 
 In order to use Jekyll as currently configured, you'll need to install this gem. The full error message from 
diff --git a/program/matlab.md b/program/matlab.md
index 11eb51d..da71d7b 100644
--- a/program/matlab.md
+++ b/program/matlab.md
@@ -1,8 +1,20 @@
-## [matlab函数查询](https://www.mathworks.com/help/)
+# matlab
+
+[matlab函数查询](https://www.mathworks.com/help/)
+
+## 安装
+
+[ubuntu安装](https://blog.csdn.net/StayFoolish_Fan/article/details/53998734)
+
+```sh
+# 安装脚本内有句错误没有提示信息,添加权限后就正常了。
+chmod +x sys/java/jre/glnxa64/jre/bin/java
+```
 
 ## 快捷键
+
 1. ctrl+i 自动缩进
-2. ctrl+r 、ctrl+t 添加注释,取消注释 
+2. ctrl+r 、ctrl+t 添加注释,取消注释
 3. ctrl+tab 窗口切换
 4. f5 运行
 5. f9 单步执行
@@ -12,10 +24,12 @@
 9. f10 step
 
 ## 常用命令
+
 1. clc 清屏
 2. clear 清空变量
 
 ## matlab 常用代码
+
 ```matlab
 # 矩阵索引,标号从1开始
 A(1,1)
diff --git a/program/opencv/mat.md b/program/opencv/mat.md
index 1acf3fb..c3da46e 100644
--- a/program/opencv/mat.md
+++ b/program/opencv/mat.md
@@ -1,7 +1,7 @@
-Mat
-----
+# Mat
 
 ## 类的定义
+
 ```c++
 // 成员变量
 rows        // 2维矩阵中的行
@@ -17,9 +17,60 @@ type        // mat element的格式,与图像编码无关,如 CV_8UC3
 //成员函数
 elemSize()  // 返回矩阵中一个元素的字节数,例如CV_16SC3,返回sizeof(short)*3=6,即六个字节
 elemSize1() // 返回矩阵中一个元素中单独一个通道的字节数,例如CV_16SC3,返回2,即两个字节
+
+src.at(x,y)
+
+```
+
+## 处理
+
+```c++
+hconcat
+```
+
+## transform
+
+```c++
+estimateAffine2D // 计算两个点集6自由度仿射变换矩阵 + ransac
+estimateAffinePartial2D // 计算两个点集4自由度仿射变换矩阵 + ransac
+estimateRigidTransform // 计算两个点集6自由度或4自由度仿射变换矩阵 + ransac
+getAffineTransform // 计算3个点对之间的仿射变换矩阵
+findHomography
+
+transform // 对点做变换
+warpAffine
+warpPerspective
+```
+
+## connected
+
+```c++
+connectedComponents
+connectedComponentsWithStats
 ```
 
-## 元素访问
-```cpp
-cout << src.at(x,y)
-```
\ No newline at end of file
+## opencv提供的特征
+
+```c++
+// official
+ORB
+KAZE
+MSER
+BRISK
+AKAZE
+GFTTDetector
+SimpleBlobDetector
+FastFeatureDetector
+AgastFeatureDetector
+
+// contrib
+FREAK: Fast Retina Keypoint
+SIFT:
+SURF:
+BRIEF
+Censure
+Freak
+LUCID
+Daisy
+Self-similar.
+```
diff --git a/program/opencv/opencvInstall.md b/program/opencv/opencvInstall.md
index 34c9583..04f89db 100644
--- a/program/opencv/opencvInstall.md
+++ b/program/opencv/opencvInstall.md
@@ -1,45 +1,60 @@
+# opencv
+
 [opencv package](https://sourceforge.net/p/opencvlibrary/activity/?page=0&limit=100#553a433fe88f3d0ccc1e5008)
 
-linux下查看Opencv的版本
+## linux下查看Opencv的版本
 
 pkg-config --modversion opencv  
 
 ## 直接安装库
+
 ```shell
+# c++版
 sudo apt-get install libcv-dev
-# python2 安装到系统默认python里,使用pip安装
+sudo apt-get install libopencv
+
+# python版
 pip install opencv-python
+# 这种方式安装无法打开视频,也就是不能使用VideoCapture
+conda install -c https://conda.binstar.org/menpo opencv
+
+## ubuntu 源代码安装opencv 至 conda
+# 源代码编译安装,这种方法可以使用VideoCapture,PATHON_PACKAGES_PATH的指定有用吗??? ,不过这次是可行的
+cmake -D PYTHON_PACKAGES_PATH=/home/lxg/anaconda2/lib/python2.7/site-packages/ -D BUILD_TIFF=ON ..
+cmake -D PYTHON_PACKAGES_PATH=/home/lxg/anaconda3/lib/python3.6/site-packages/ -D BUILD_TIFF=ON ..
 ```
 
 ## 源代码编译安装
+
 生成Makefile文件后,查看选项配置
+
 ```shell
 cmake -L | awk '{if(f)print} /-- Cache values/{f=1}'
 ```
 
-前提:系统更新
-sudo apt-get update   
-sudo apt-get upgrade  
 1. 搭建编译环境,并安装相关关联库  
 搭建C/C++编译环境:  
-sudo apt-get install build-essential    
+sudo apt-get install build-essential
 安装关联库:  
-sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev   
+
+```shell
+sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev  
 sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev  
 sudo apt-get install gstreamer-base-1.0 gthread-2.0 gtk+-2.0 gtk+-3.0 gstreamer-pbutils-1.0 gstreamer-pbutils-0.10
+```
+
 2. 下载OpenCV3.0 代码  
 下载地址https://github.com/Itseez/opencv/archive/3.0.0.zip  
 下载完源代码后,解压至特定文件夹下面。  
 3. 进入opencv-3.0.0中,键入如下命令:  
 cmake -D CMAKE_BUILD_TYPE=Debug -D BUILD_TIFF=ON -D BUILD_EXAMPLES=ON -D CUDA_GENERATION=Auto .. (debug版本opencv,也可以设置把gpu关掉)
-
 4. 在terminal中键入:  
 make -j5  
 5. 然后执行安装  
 sudo make install  
 6. 完成安装  
-sudo /bin/bash -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'    
-sudo ldconfig    
+sudo /bin/bash -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'
+sudo ldconfig
 7. 测试OpenCV3.0
 切换到OpenCV3.0的samples目录下面,并编译samples程序  
 cd opencv/opencv-3.0.0-beta/samples/  
@@ -49,70 +64,119 @@ sudo make -j $(nproc)
 cd cpp/  
 ./cpp-example-facedetect girls.jpg (自己下载一张图片放在该目录)
 
+## 安装contrib库
+
+```shell
+# c++源代码编译,要记得定义nonfree,否则无法使用SURF等算法
+cmake -DBUILD_TIFF=ON  -DOPENCV_EXTRA_MODULES_PATH=/home/lxg/app/opencv-3.3.0/opencv_contrib/modules ..
+cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local -D OPENCV_EXTRA_MODULES_PATH=/home/lxg/codesrc/opencv_contrib-3.4.0/modules/ ..
+# cmake-gui,要记得勾选以下选项,否则无法使用SURF等算法
+OPENCV_ENABLE_NONFREE
+# python
+pip install opencv-contrib-python
+```
+
 ## 卸载
+
 进入build目录
 sudo make uninstall
 
-## ubuntu 安装opencv 至 conda
-```sh
-# 源代码编译安装,这种方法可以使用VideoCapture,PATHON_PACKAGES_PATH的指定有用吗??? ,不过这次是可行的
-cmake -D PYTHON_PACKAGES_PATH=/home/lxg/anaconda2/lib/python2.7/site-packages/ -D BUILD_TIFF=ON ..
-cmake -D PYTHON_PACKAGES_PATH=/home/lxg/anaconda3/lib/python3.6/site-packages/ -D BUILD_TIFF=ON ..
-
-# 这种方式安装无法打开视频,也就是不能使用VideoCapture 
-conda install -c https://conda.binstar.org/menpo opencv
+## 源代码文件解析
+
+```c
+.
+├── 3rdparty
+├── apps
+├── build
+├── .cache
+├── cmake  // 自定义的一些cmake函数,用于辅助opencv的编译,如ocv_download
+├── CMakeLists.txt
+├── CONTRIBUTING.md
+├── data
+├── doc
+├── include
+├── LICENSE
+├── modules
+├── platforms
+├── README.md
+├── samples
+├── .tgitconfig
+└── .vscode
 ```
 
 ## 插件
-windows VisualStudio下的 image watch
 
-## halcon
-机器视觉工程开发流程: http://www.ihalcon.com/read-1285.html
-主要是光源、工业相机、镜头选择
-一、图像采集,二、图像分割,三、形态学处理,四、特征提取,五、输出结果。
+windows VisualStudio下的 image watch
 
-匹配方法
-Component-Based
-Gray-Value-Based
-Shape-Based,
+## question
 
+1. 一堆"undefined reference to `TIFFReadDirectory@LIBTIFF_4.0'"
 
-## opencv3.3.0安装 带contrib模块
-```shell
-cmake -DBUILD_TIFF=ON  -DOPENCV_EXTRA_MODULES_PATH=/home/lxg/app/opencv-3.3.0/opencv_contrib/modules ..
-```
-## question
-1. 一堆"undefined reference to `TIFFReadDirectory@LIBTIFF_4.0'"  
-问题解释  
-According to this, OpenCV needs libtiff4, which Ubuntu has dropped, i.e. the package that replaced it is libtiff5-dev.  
-As a temporary workaround you can specify -DBUILD_TIFF=ON on cmake when configuring, in order to build the libtiff4 version that is distributed with OpenCV.  
-This worked for me in Ubuntu 16.04, with OpenCV 3.2.1.  
-解决方法  
-cmake -DBUILD_TIFF=ON  ..
+   问题解释:
+   According to this, OpenCV needs libtiff4, which Ubuntu has dropped, i.e. the package that replaced it is libtiff5-dev.  
+   As a temporary workaround you can specify -DBUILD_TIFF=ON on cmake when configuring, in order to build the libtiff4 version that is distributed with OpenCV.  
+   This worked for me in Ubuntu 16.04, with OpenCV 3.2.1.  
+   解决方法:
+   cmake -DBUILD_TIFF=ON  ..
 
 2. 安装opencv后,不能使用imshow
-OpenCV Error: Unspecified error (The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script) in cvShowImage, file /tmp/build/80754af9/opencv_1512687413662/work/modules/highgui/src/window.cpp, line 611
-解决方法:
+
+   OpenCV Error: Unspecified error (The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian,  install   libgtk2.0-dev and pkg-config, then re-run cmake or configure script) in cvShowImage, file /tmp/build/80754af9/opencv_1512687413662/work/modules/highgui/src/ window.cpp,   line 611
+   解决方法:
+
+   ```shell
+   # 是因为缺少gtk库,安装
+   sudo apt-get install libgtk # 可以按tab键自动补全的形式查找可安装版本,然后重新编译、安装
+   # 使用源码编译的opencv,安装到库目录
+   cmake -D CMAKE_BUILD_TYPE=Release -D INSTALL_PYTHON_EXAMPLES=ON -D INSTALL_C_EXAMPLES=OFF \
+   -D BUILD_EXAMPLES=ON \
+   -D OPENCV_EXTRA_MODULES_PATH=/home/ubuntu/cb/pkg/opencv/opencv_contrib/modules \
+   -D CMAKE_LIBRARY_PATH=/usr/local/cuda-8.0/targets/x86_64-linux/lib/stubs -D WITH_CUDA=ON -DBUILD_TIFF=ON \
+   -DBUILD_opencv_java=OFF \
+   -DWITH_OPENGL=ON \
+   -DWITH_OPENCL=ON \
+   -DWITH_IPP=ON \
+   -DWITH_TBB=ON \
+   -DWITH_EIGEN=ON \
+   -DWITH_V4L=ON \
+   -DWITH_VTK=OFF \
+   -DBUILD_TESTS=OFF \
+   -DBUILD_opencv_dnn=ON -D CUDA_NVCC_FLAGS="-D_FORCE_INLINES --expt-relaxed-constexpr"  \
+   -DBUILD_LIBPROTOBUF_FROM_SOURCES=ON \
+   -DBUILD_PERF_TESTS=OFF \
+   -DCMAKE_INSTALL_PREFIX=$(python -c "import sys; print(sys.prefix)") \
+   -DPYTHON_DEFAULT_EXECUTABLE=$(which python3)
+   -DPYTHON3_EXECUTABLE=$(which python3) \  # 这里可以设置为PYTHON_EXECUTABLE not PYTHON3_EXECUTABLE
+   -DPYTHON3_INCLUDE_DIR=$(python -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") \
+   -DPYTHON3_PACKAGES_PATH=$(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") \
+   -DPYTHON3_LIBRARY=/home/lxg/anaconda3/lib/libpython3.6m.so  ..
+   # -DPYTHON_NUMPY_INCLUDE_DIRS=/home/ubuntu/anaconda2/envs/virenv_name/lib/python2.7/site-packages/numpy/core/include/ # 能自动匹配到版本
+   cmake -D CMAKE_INSTALL_PREFIX=/usr/local \
+      -D PYTHON_EXECUTABLE=/home/lxg/anaconda3/bin/python ..
+   ```
+
+3. import cv2导致错误
+
+   ```shell
+   Traceback (most recent call last):
+     File "", line 1, in 
+   ImportError: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.22' not found (required by /home/lxg/anaconda3/lib/python3.6/site-packages/../../  libopencv_objdetect.so.3.4)
+   使用下面一条命令解决
+   ln -s ~/anaconda3/lib/libstdc++.so.6.0.24 ~/anaconda3/lib/libstdc++.so.6
+   ```
+
+4. c++程序能够编译成功,无法运行的错误
+
+   ```shell
+   /home/lxg/anaconda3/lib/libopencv_objdetect.so.3.4.2: undefined reference to `typeinfo for std::thread::_State@GLIBCXX_3.4.22'
+   /home/lxg/anaconda3/lib/libopencv_objdetect.so.3.4.2: undefined reference to `std::thread::_M_start_thread(std::unique_ptr >, void (*)())@GLIBCXX_3.4.22'
+   /home/lxg/anaconda3/lib/libopencv_objdetect.so.3.4.2: undefined reference to `std::thread::_State::~_State()@GLIBCXX_3.4.22'
+   collect2: error: ld returned 1 exit status
+   ```
+
 ```shell
-# 是因为缺少gtk库,安装
-sudo apt-get install libgtk # 可以按tab键自动补全的形式查找可安装版本,然后重新编译、安装
-# 使用源码编译的opencv,安装到库目录
-cmake -D CMAKE_BUILD_TYPE=Release -D INSTALL_PYTHON_EXAMPLES=ON -D INSTALL_C_EXAMPLES=OFF \
--D BUILD_EXAMPLES=ON \
--D OPENCV_EXTRA_MODULES_PATH=/home/ubuntu/cb/pkg/opencv/opencv_contrib/modules \
--D CMAKE_LIBRARY_PATH=/usr/local/cuda-8.0/targets/x86_64-linux/lib/stubs -D WITH_CUDA=ON -DBUILD_TIFF=ON \
--DBUILD_opencv_java=OFF -DWITH_OPENGL=ON -DWITH_OPENCL=ON -DWITH_IPP=ON -DWITH_TBB=ON -DWITH_EIGEN=ON -DWITH_V4L=ON -DWITH_VTK=OFF \
--DBUILD_TESTS=OFF -DBUILD_opencv_dnn=ON -D CUDA_NVCC_FLAGS="-D_FORCE_INLINES --expt-relaxed-constexpr"  \
--DBUILD_LIBPROTOBUF_FROM_SOURCES=ON \
--DBUILD_PERF_TESTS=OFF \
--DCMAKE_INSTALL_PREFIX=$(python -c "import sys; print(sys.prefix)") \
--DPYTHON_DEFAULT_EXECUTABLE=$(which python3)
--DPYTHON3_EXECUTABLE=$(which python3) \  # 这里可以设置为PYTHON_EXECUTABLE not PYTHON3_EXECUTABLE
--DPYTHON3_INCLUDE_DIR=$(python -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") \
--DPYTHON3_PACKAGES_PATH=$(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") \
--DPYTHON3_LIBRARY=/home/lxg/anaconda3/lib/libpython3.6m.so  ..
-# -DPYTHON_NUMPY_INCLUDE_DIRS=/home/ubuntu/anaconda2/envs/virenv_name/lib/python2.7/site-packages/numpy/core/include/ # 能自动匹配到版本 
-
- cmake -D CMAKE_INSTALL_PREFIX=/usr/local \
-    -D PYTHON_EXECUTABLE=/home/lxg/anaconda3/bin/python ..
-```
+相同问题:https://stackoverflow.com/questions/45347838/c-undefined-reference-to-stdthread-while-compiling-opencv-and-tensorflow-wi
+问题解析:https://stackoverflow.com/questions/38226993/getting-undefined-reference-to-stdthread-m-start-thread
+解决:https://stackoverflow.com/questions/41538787/how-to-use-the-correct-libstdc
+在CMakeLists.txt添加set(CMAKE_CXX_FLAGS -static-libstdc++)
+```
\ No newline at end of file
diff --git a/program/parallel/openmp.md b/program/parallel/openmp.md
new file mode 100644
index 0000000..ed576c2
--- /dev/null
+++ b/program/parallel/openmp.md
@@ -0,0 +1,9 @@
+# [openmp](https://zh.wikipedia.org/wiki/OpenMP)
+
+```shell
+gcc -fopenmp omp.cpp
+```
+
+在不支持openmp的平台上,自动退化为单线程执行。
+
+multithreading, parallel program?
\ No newline at end of file
diff --git a/program/python/anaconda.md b/program/python/anaconda.md
index 43633cd..ca617d6 100644
--- a/program/python/anaconda.md
+++ b/program/python/anaconda.md
@@ -1,11 +1,15 @@
+# conda
+
 [doc](https://conda.io/docs/user-guide/configuration/use-condarc.html#general-configuration)
 
 python的一个环境、版本管理工具包
 
 使用anaconda安装的pytorch,需要使用命令
+
 ```python
 import torch # 而不是pytorch,据说是因为兼容老版本
 ```
+
 ## 添加[清华的源](https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/)
 
 ```shell
@@ -15,7 +19,10 @@ conda config --set show_channel_urls yes # 显示下载源的地址
 ```
 
 ## 操作
+
 ```python
+# 搜索包
+conda search opencv
 # 只更新torchvision,其它包不更新
 conda update torchvision --no-deps
 # 给包指定版本,update好像不能指定版本
diff --git a/program/python/cv2.md b/program/python/cv2.md
index 14bf484..4bb070f 100644
--- a/program/python/cv2.md
+++ b/program/python/cv2.md
@@ -1 +1,4 @@
-[doc](https://docs.opencv.org/3.0-beta/doc/py_tutorials/py_tutorials.html)
\ No newline at end of file
+[doc](https://docs.opencv.org/3.0-beta/doc/py_tutorials/py_tutorials.html)
+```python
+cv2.imread() # 默认打开BGR通道
+```
\ No newline at end of file
diff --git a/program/python/matplotlib.md b/program/python/matplotlib.md
index 6cb0821..ec2eb15 100644
--- a/program/python/matplotlib.md
+++ b/program/python/matplotlib.md
@@ -1,14 +1,26 @@
+# matplotlib
+
 [matplotlib](http://matplotlib.org/users/index.html)  
 [tutorial](http://www.labri.fr/perso/nrougier/teaching/matplotlib/)  
 [pyplot](http://matplotlib.org/users/pyplot_tutorial.html)  
 
+[指定中文字体-第二种解决方法](https://blog.csdn.net/dgatiger/article/details/50414549)
+
+## 如果是要在远程绘图,就要关闭显示,方法如下
+
+```python
+import matplotlib
+matplotlib.use(Agg) # 这两句要放在文件的最前面
+```
+
 rc?
 rcParams是RcParams的一个实例,用于设置matplotlib的默认绘图参数,并使其有效
+
 ```python
 # 更改大小,有报错??
 matploylib.rcParams['figure.figize'] = (12.0, 6.0)
 
-# 创建窗口对象的时候设置大小 
+# 创建窗口对象的时候设置大小
 import matplotlib.pyplot as plt
 plt.figure('head', figsize=(8,8))
 f, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2,2)
@@ -18,4 +30,9 @@ plt.show()
 plt.set_figwidth(10)
 plt.set_figheight(10)
 plt.suptitle('sd')
-```
\ No newline at end of file
+```
+
+## 类
+
+Figure:是图元素的容器
+Axes:包含了Figure的大部分元素,
diff --git a/program/python/numpy.md b/program/python/numpy.md
index 089f5a3..c7cf709 100644
--- a/program/python/numpy.md
+++ b/program/python/numpy.md
@@ -1,30 +1,33 @@
+# NumPy
+
 [referrence](https://docs.scipy.org/doc/numpy/reference/)
 [referrence](https://docs.scipy.org/doc/numpy/reference/arrays.html)
 [quickstart](https://docs.scipy.org/doc/numpy-dev/user/quickstart.html)
 
 在numpy,axis就是dimensions, axes的数目被称为rank,也就是维数。
 ndarray是numpy里面定义的array,也可以叫array,但是它不同于python标准库里的array
+
+![numpy](../../image/python/ndarray.png)
+
 1. basics
     - print
          设置完全打印输出,np.set_printoptions(threshold='nan')
     - basic operations
     - Indexing, Slicing and Iterating
 
-## NumPy   
-
-![numpy](../image/python/ndarray.png)
-
-1. the n-dimensional array  
+2. the n-dimensional array  
     - 提供了一个N维的矩阵,简写为 ndarray,
     - [array creation routines](https://docs.scipy.org/doc/numpy/reference/routines.array-creation.html#routines-array-creation)
+
 3. indexing
     - 有三种indexing方法
         filed access  
-        basic slicing:通过slicing得到的矩阵,是original矩阵的views   
+        basic slicing:通过slicing得到的矩阵,是original矩阵的views
         advanced indexing  
-    - 省略号(ellipsis,` "...")  
+    - 省略号(ellipsis,` "...")
+
 ```python
-维度变化
+# 维度变化
 squeeze()
 a = arange(16).reshape(2,2,2,2)  
 # 现在,有了一个4维矩阵2x2x2x2,如果选择4维矩阵中所有的首元素,你可以使用ellipsis符号。  
@@ -32,10 +35,10 @@ a = arange(16).reshape(2,2,2,2)
 array([ 0,  2,  4,  6,  8, 10, 12, 14])  
 # 这相当于  
 a[:,:,:,0].flatten()  
-array([ 0,  2,  4,  6,  8, 10, 12, 14]) 
+array([ 0,  2,  4,  6,  8, 10, 12, 14])
 
 # 数据类型
-np.uint8 
+np.uint8
 
 # 向下取整
 np.ceil()
diff --git a/program/python/pandas.md b/program/python/pandas.md
index 48a6284..09ede32 100644
--- a/program/python/pandas.md
+++ b/program/python/pandas.md
@@ -1,11 +1,13 @@
 [pandas](http://pandas.pydata.org/pandas-docs/stable/)
 
 ## terms
+
 tabular 表格
 tenet 宗旨
 NaN: not a number
 
 ### Package overiew
+
 所有的数据结构都是value-mutable
 Series: 一维同质的标签数据
 DataFrame: 二维标签数据,size-mutable
@@ -13,6 +15,7 @@ Panel:三维标签数据,size-mutable(大小可变的阵列)
 io: csv, hdf5/PyTables
 
 ### 10 minutes to pandas
+
 - Object creation
 - Viewing data
     sort
@@ -25,6 +28,7 @@ io: csv, hdf5/PyTables
     to_csv()
 
 ### intro to data structures  (data alignment is intrinsic)
+
 ```python
 # 属性
 df.size() # 包括nan元素的数目
diff --git a/program/python/pil.md b/program/python/pil.md
index ef6179c..c499f89 100644
--- a/program/python/pil.md
+++ b/program/python/pil.md
@@ -1,6 +1,7 @@
 [python image library](http://effbot.org/imagingbook/)
 [pillow](http://pillow.readthedocs.io/en/latest/index.html)
 
+## Image
 ```python
 import Image
 
@@ -20,4 +21,15 @@ numpy.array(image)
 # numpy.array 转 image,数据类型要与mode契合
 Image.fromarray(array, mode='I')
 
-```
\ No newline at end of file
+```
+
+## ImageDraw
+```python
+from PIL import ImageDraw
+draw = ImageDraw.Draw(im)
+draw.rectangle(xy, fill=None, outline=None
+draw.text(xy, text, fill=None, font=None, anchor=None))
+```
+
+## ImageFont
+调整字体,需要本模块
\ No newline at end of file
diff --git a/program/python/pybind11.md b/program/python/pybind11.md
new file mode 100644
index 0000000..ddd04b1
--- /dev/null
+++ b/program/python/pybind11.md
@@ -0,0 +1,6 @@
+# pybind11
+
+[doc](https://pybind11.readthedocs.io/en/latest/intro.html)
+
+能够为python提供c++接口的库,使python能够访问c++11中的类型,与其功能类似的还有boost.python,不过boost为了支持更多的编译器,已经变得非常臃肿。
+可以为pytorch编写插件。
\ No newline at end of file
diff --git a/program/python/python.md b/program/python/python.md
index 33bbf5f..b6e796a 100644
--- a/program/python/python.md
+++ b/program/python/python.md
@@ -1,46 +1,64 @@
-python
-------
+# python
+
 [python3-cookbook](http://python3-cookbook.readthedocs.io/zh_CN/latest/index.html)  
 [python Doc](https://docs.python.org/3/)  
 [廖雪峰python](http://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000)
-### 一些库的reference
+
+## 一些库的reference
+
 [图像处理库 pil](https://en.wikibooks.org/wiki/Python_Imaging_Library)  
 [opencv-python](http://docs.opencv.org/master/d6/d00/tutorial_py_root.html)  
 [json](https://docs.python.org/3.6/library/json.html)   
 [python基础教程](http://www.runoob.com/python/python-tutorial.html)
 
-### 中文支持
+## C++编写python接口
+
+[pybind11](./pybind11.md)
+[setuptools](./setuptools)
+
+## 中文支持
+
 ```python
-# coding=utf-8 
+# coding=utf-8
 ```
-### python 性能分析器
+
+## python 性能分析器
+
 python profiler,可以用于分析python程序每行的耗时
+
 1. cProfile
 2. profile
 3. hotshot
 4. line_profiler
 
-### 调试软件
-pdb
-     
-### 软件包的管理pip
+## 调试软件
+
+pdb;
+import pdb; pdb.set_trace()
+
+## 软件包的管理pip
+
 - 安装pip  
   sudo apt-get install pip 
 - pip安装包
   sudo pip install [PACKAGENAME]
 
-### tricks
+## tricks
+
 - 退出python解释器  
     快捷键ctrl+d : end-of-file character  
     输入 quit() 或者 exit()?  
 - 在交互式编程中  
     上一次的输出会保存到 '_' 变量中,它是只读的  
-- 交互环境下调用shell脚本  
+- 交互环境下调用shell脚本
+
 ```python
 os.system('./command') #执行当前路径下的命令
 ```
+
 - python2.7版本在tty里的自动补全功能要自己设置,新版本好像已经默认配置了,不过这样就不能用tab进行缩进了  
     (python的环境变量像PYTHONSTARTUP,是自己在~/.profile文件或其中包含的命令下设置的,)
+
 ```python
 # 1. 在home目录下创建.pythonstartup文件,复制以下内容到此文件内
 # python startup file  
@@ -63,6 +81,3 @@ export PYTHONSTARTUP="/home/xxxx/.pythonstartup"
 # 3. 使用命令,结束
 source ~/.bashrc
 ```
-
-
-
diff --git a/program/python/pythontutorial.md b/program/python/pythontutorial.md
index af5fdd4..2c44bcf 100644
--- a/program/python/pythontutorial.md
+++ b/program/python/pythontutorial.md
@@ -10,13 +10,26 @@
 ### 换行符
 \
 
-# 基础
-- 运行.py文件  
-  python name.py
+## 基础
+- 运行.py文件 
+```python 
+  python path/name.py # 把name.py的路径添加入sys.path环境变量
+  python -m path.name # 把执行命令的路径添加入sys.path环境变量
+```  
 - 把包(也可以是包里的一个类)导入并换个名字      
   import PACKAGE as NAME   
 - 把包里的一个函数导入  
   from PACKAGE import NAME
+## 复制
+- 对象赋值,就是进行对象的引用。
+string是不可变类型,所以当赋值时,会产生新的地址。
+- 深拷贝: copy.copy(),拷贝对象,但不拷贝对象中的元素。
+- 浅拷贝: copy.deepcopy(),拷贝对象,并拷贝对象中的元素。
+
+非容器类型是没有拷贝的说法的。  
+
+
+
 ## 语句
 - iter  
 迭代
@@ -118,6 +131,7 @@ type(data) //返回数据类型
 11. brief tour of the standard library2
 12. virtual environment and packages
 
+```
 Python基础  
      数据类型和变量  
           python是动态语言,指变量本身类型不固定,与之相对的是静态语言,指定义变量时必须指定变量类型。 
@@ -140,3 +154,4 @@ Python基础
      调用函数:函数名其实就是指向一个函数对象的引用,完全可以把函数名赋给一个变量,相当于给这个函数起别名。
      定义函数:pass,空语句占位符;函数返回值是一个tuple;
      函数的参数:默认参数要指向不变对象。
+```
\ No newline at end of file
diff --git a/program/python/qtpy.md b/program/python/qtpy.md
new file mode 100644
index 0000000..d4312a5
--- /dev/null
+++ b/program/python/qtpy.md
@@ -0,0 +1,8 @@
+# qtpy/pyqt
+
+[doc](https://wiki.python.org/moin/PyQt/Tutorials)
+[qt class](https://doc-snapshots.qt.io/qtforpython/index.html)
+
+## classes
+
+- QListWidget: 列表,可以更改文本字体颜色,文本底色等
\ No newline at end of file
diff --git a/program/python/setuptools.md b/program/python/setuptools.md
new file mode 100644
index 0000000..2e08b1b
--- /dev/null
+++ b/program/python/setuptools.md
@@ -0,0 +1,3 @@
+# setuptools
+
+[setuptools](https://setuptools.readthedocs.io/en/latest/)
\ No newline at end of file
diff --git a/program/python/skimage.md b/program/python/skimage.md
new file mode 100644
index 0000000..4797088
--- /dev/null
+++ b/program/python/skimage.md
@@ -0,0 +1,27 @@
+# skimage
+
+[doc](http://scikit-image.org/docs/stable/api/skimage.measure.html#skimage.measure.label)
+
+skimage包的全称是scikit-image SciKit (toolkit for SciPy) ,它对scipy.ndimage进行了扩展,提供了更多的图片处理功能。它是由python语言编写的,由scipy 社区开发和维护。skimage包由许多的子模块组成,各个子模块提供不同的功能。主要子模块列表如下:
+
+```yaml
+子模块名称                 主要实现功能
+io                            读取、保存和显示图片或视频
+data                       提供一些测试图片和样本数据
+color                           颜色空间变换
+filters             图像增强、边缘检测、排序滤波器、自动阈值等
+draw               操作于numpy数组上的基本图形绘制,包括线条、矩形、圆和文本等
+transform          几何变换或其它变换,如旋转、拉伸和拉东变换等
+morphology          形态学操作,如开闭运算、骨架提取等
+exposure              图片强度调整、如亮度调整、直方图均衡等
+feature                        特征检测与提取等
+measure                  图像属性的测量,如相似性或等高线、连通区域等
+segmentation                          图像分割
+restoration                           图像恢复
+util                                  通用函数
+
+作者:jiandanjinxin
+链接:https://www.jianshu.com/p/f2e88197e81d
+来源:简书
+简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。
+```
\ No newline at end of file
diff --git a/program/qt/qt.md b/program/qt/qt.md
index 3c38817..522a2a9 100644
--- a/program/qt/qt.md
+++ b/program/qt/qt.md
@@ -1,14 +1,18 @@
+# qt
+
+[豆子 qt](http://wiki.jikexueyuan.com/project/learn-road-qt/the-use-of-api-document.html)
+[豆子 qt学习之路](https://www.devbean.net/2012/08/qt-study-road-2-catelog/)
 [qt gui-class](http://doc.qt.io/qt-4.8/qtgui-module.html)  
 [qt精品教程](http://www.qter.org/portal.php?mod=list&catid=6)  
-[qt下载列表](http://download.qt.io/archive/)    
+[qt下载列表](http://download.qt.io/archive/)
 [qt官方例子](http://doc.qt.io/qt-5/qtexamplesandtutorials.html)  
 [sqlite qt驱动](http://qsqlite.sourceforge.net/#description)  
 [qt自带数据库 例子](http://www.qter.org/portal.php?mod=view&aid=51)  
 [在线电子书](https://qtguide.ustclug.org/)  
-[豆子 qt学习之路](https://www.devbean.net/2012/08/qt-study-road-2-catelog/)
 [qt数据库 例子](http://blog.csdn.net/reborntercel/article/details/6991147)
 
 ## 快捷键
+
 1. ctrl + tab 切换打开的文件
 2. f4 切换源代码和头文件
 3. alt+enter 在头文件函数声明上点击并按快捷键添加函数的定义
@@ -18,19 +22,23 @@
 7. f2 快速切换到选中对象的源码
 8. ctrl+鼠标点击 定义与声明之间切换
 
-# ubuntu下配置
+## ubuntu下配置
+
 ## 配置opencv
+
 在.pro文件中添加
+
 ```cmake
 INCLUDEPATH += /usr/local/include \
 LIBS += /usr/local/lib/libopencv_highgui.so \
 ```
 
-
 ## qt creator 快速入门
+
 项目文件就是.pro文件,是用于qmake来生成MakeFile的,可以在项目目录下由qmake -project生成
 qt添加动态链接库文件,在.pro文件添加
-```
+
+```c
 // libseeta_facedet_lib.so
 LIBS += your_lib_path/your_lib     //linux下
 LIBS += -L/home/lxg/codetest/qtface/model/ -lseeta_facedet_lib // linux下配置 共享库(动态库)
@@ -39,6 +47,7 @@ LIBS += /usr/local/lib/libopencv_highgui.so  // win下配置
 ```
 
 - 命令行编译qt程序
+
 ```shell
 # 生成.pro项目文件
 qmake -project
@@ -47,15 +56,19 @@ qmake
 # 编译
 make
 ```
+
 - 命令行编译.ui界面文件生成头文件
+
 ```shell
 uic -o ui_hellodialog.h hellodialog.ui
 ```
 
 ## 安装与卸载
+
 - 卸载,运行安装目录下的
 ./MaintenanceTool.dat
 - 安装,运行.run安装包
 
 ## tips
+
 1. 找不到库的问题可能是头文件与库文件不匹配 
\ No newline at end of file
diff --git a/program/runtime.md b/program/runtime.md
new file mode 100644
index 0000000..87d128f
--- /dev/null
+++ b/program/runtime.md
@@ -0,0 +1,16 @@
+# runtime
+
+2019-04-28 20:47
+
+## [runtime](https://en.wikipedia.org/wiki/Run_time_(program_lifecycle_phase))
+
+run time、executation time。是程序生命周期的一个阶段,与编译时期相对,这个指程序的运行时期。
+
+## [runtime library](https://en.wikipedia.org/wiki/Runtime_library)
+
+指一些靠近底层的程序库,在程序编译时被链接到可执行程序内,用于与运行时环境交互信息,比如内存管理、异常处理等。
+
+## [runtime environment](https://en.wikipedia.org/wiki/Runtime_system)
+
+run-time environment、runtime system、run-time system。  
+runtime system应该类似于操作系统,可以与客户代码运行的时候交互信息与资源,而runtime system也确实在独立运行,从而区别于runtime library。
\ No newline at end of file
diff --git a/program/sql.md b/program/sql.md
deleted file mode 100644
index 288257c..0000000
--- a/program/sql.md
+++ /dev/null
@@ -1,9 +0,0 @@
-## sql语句
-```sql
--- 如果没有表则创建
-create table if not exists TABLENAME()
--- 把数据插入表中数据
-
--- Block数据
-
-```
\ No newline at end of file
diff --git a/program/uml.md b/program/uml.md
new file mode 100644
index 0000000..96bc8d0
--- /dev/null
+++ b/program/uml.md
@@ -0,0 +1,11 @@
+# UML
+
+Unified Modeling Language,统一建模语言
+[wiki](https://zh.wikipedia.org/wiki/%E7%BB%9F%E4%B8%80%E5%BB%BA%E6%A8%A1%E8%AF%AD%E8%A8%80)  
+[doc](https://www.jianshu.com/p/d730f83bd81f)  
+[w3schhol](https://www.w3cschool.cn/uml_tutorial/)  
+[在线绘图visual-paradigm](https://online.visual-paradigm.com/cn/solutions/free-online-drawing-tool/)
+
+可以使用graphviz绘制
+
+UML由三部分组成: 事物(things),关系(relationships),图(diagrams)
\ No newline at end of file
diff --git a/ros/essay/pathplan.md b/ros/pathplan.md
similarity index 91%
rename from ros/essay/pathplan.md
rename to ros/pathplan.md
index 17d2f10..060ef22 100644
--- a/ros/essay/pathplan.md
+++ b/ros/pathplan.md
@@ -1,4 +1,5 @@
-## 1. exploration transform: a stable exploring algorithm for robots in rescue environments  
+# exploration transform: a stable exploring algorithm for robots in rescue environments
+
 **stephan wirth, johannes pellenz**  
 **definition**  
 a frontier is a cell in the occupancy grid that is marked as free but has a neighboring cell that is marked unknown.
@@ -18,6 +19,3 @@ coverage maps是另一种occupancy grid,每个格子存储着这个地方有障
 Computing a sequence of sensing positions based on data acquired at previous locations is referred to as the next-best-view (NBV) problem. 
 ## 4. a frontier-based approach for autonomous exploration
 frontier: regions on the boundary between open space and unexpected space.
-
-
-
diff --git a/weeksummary/aYearInComputerVision.md b/summary/aYearInComputerVision.md
similarity index 100%
rename from weeksummary/aYearInComputerVision.md
rename to summary/aYearInComputerVision.md
diff --git a/summary/algorithmsummary.md b/summary/algorithmsummary.md
new file mode 100644
index 0000000..26d05b3
--- /dev/null
+++ b/summary/algorithmsummary.md
@@ -0,0 +1,5 @@
+## 字符串匹配算法
+
+1. 暴力匹配、朴素匹配
+2. KMP算法 部分匹配表
+3. Boyer-Moore算法 好字符规则、坏字符规则
\ No newline at end of file
diff --git a/weeksummary/blog_one.md b/summary/blog_one.md
similarity index 100%
rename from weeksummary/blog_one.md
rename to summary/blog_one.md
diff --git a/weeksummary/cnnsummary.md b/summary/cnnsummary.md
similarity index 79%
rename from weeksummary/cnnsummary.md
rename to summary/cnnsummary.md
index 5aef962..2c71b5c 100644
--- a/weeksummary/cnnsummary.md
+++ b/summary/cnnsummary.md
@@ -1,6 +1,7 @@
 # CNN summary
 
 ## regularization
+
 - L1
 - L2
 - dropout
@@ -8,24 +9,42 @@
 - combine multiple losses(GoogLeNet)
 
 ## normalization
+
 - batch normalization
 - layer normalization
 - cosine normalization
 - weight normalization
 
+## motivation
+
+1. deeply-supervied nets
 
 ## 内存消耗
+
 [分析译文](http://blog.csdn.net/shenxiaolu1984/article/details/71522141)
-- 模型参数  
+
+- 模型参数
+
 和模型复杂度有关  
 卷积权重、偏置,BN层方差、均值、$\gamma, \beta$参数,relu、dropout层没有参数等
-- 各层响应  
+
+- 各层响应
+
 和模型复杂度有关,和模型参数量(参数共享)没有关系,和输入大小有关系  
 有的层(relu, dropout)可以使用inplace设置来节省内存,不开辟新内存,直接重写到原有响应上。
-- batch_size的影响  
+
+- batch_size的影响
+
 batch_size不影响模型参数的量。但影响各层响应的内存占用,是batch-size倍的关系
-- 卷积计算的影响  
+
+- 卷积计算的影响
+
 CNN卷积的高效方式会提高显存的使用量,$K^2$倍,$K$为卷积核大小。
 
+## 多任务学习
+
+[任务之间的梯度平衡,至关重要](https://www.zhihu.com/question/268105631/answer/335246543)
+
 ## CNN卷积运算
+
 [torch cnn blog](http://blog.csdn.net/shenxiaolu1984/article/details/52373174)
diff --git a/summary/cumpus.md b/summary/cumpus.md
new file mode 100644
index 0000000..73c5add
--- /dev/null
+++ b/summary/cumpus.md
@@ -0,0 +1,117 @@
+## 1. [华为](http://career.huawei.com/reccampportal/next/mini/index.html)
+8月16号优招  
+专业面问简历项目,综合面问了下上过哪些计算机课程,数组链表的区别,其它聊人生。
+
+## 2. [奇虎360](http://campus.chinahr.com/2019/qihu360/index.html)内推截止8月12号,校招截止9月16号。
+人工智能-计算机视觉算法工程师,8月8号申请内推
+```
+职位描述:
+计算机视觉算法的研发和技术应用。
+任职要求:
+1.计算机视觉和机器学习相关专业,硕士及以上;
+2.熟悉图像和视频分类、检测、分割、跟踪等算法;
+3.有深度学习经验优先。
+```
+内推一面挂,编程题目不难,就是vector与queue的使用不熟练,面试过程中竟然掉线了,印象分很差。然后面试过程中表达不清楚,明显的逻辑混乱。
+
+## 3. [京东](http://campus.jd.com/login) 9月6号前
+算法工程师 8月10号申请
+```
+1-2019年毕业,本科及以上学历
+2-研究及应用前沿互联网技术,如机器学习、深度学习、数据挖掘、推荐、搜索、自然语言处理、分布式并行算法、复杂网络、图像识别、计算机视觉、语音等
+3-至少熟悉java, c++,python中的一种开发语言
+4-良好的逻辑思维能力,良好的沟通能力、团队合作精神和学习能力
+```
+## 4. [陌陌]
+深度学习算法工程师 8月26日申请,直接发简历到hr邮箱
+
+## 5. [依图科技](https://app.mokahr.com/campus_apply/yitu-inc)
+校招-AI算法工程师 8月26日申请   
+招聘界面很好,很多可以直接从简历导入。
+
+## 6. [顺丰科技](http://campus.sf-tech.com.cn/campusRecruitment/Jobinner16.html?p=32551039576)
+视觉算法工程师 9月3号, 智联招聘
+
+## 7.[大华](http://dahua.zhiye.com/zpdetail/230187718?r=&p=1%5E11&c=&d=&k=#this)
+智能算法工程师 9月3号,
+
+## 8.[网易互联网]()
+计算机视觉 9月3号   笔试挂掉了  
+内推[https://zhuanlan.zhihu.com/p/40005360]
+笔试挂
+
+## 9. Face++
+宣讲会现场投递简历,笔试,第二天面试。9月8号  
+笔试题目包括定积分、李群SLAM、矩阵求逆、二倍方差内置信区间的概率、点到面的距离……   
+一面较随意
+二面问细节,问公式,问数据结构。
+面试问到adaboost为什么样本权重跟新系数为$\log(\frac{1-e_m}{e_m})$,KCF跟踪中用到的循环矩阵加速理论,哈希解决冲突的方法
+
+## 10. VIVO
+图像算法工程师  9月10号网申
+2018-09-13 21:48 测评
+一面问了AlexNet->VGG->GoogLeNet的改进点、caffe具体如何实现dropout、maxpooling层、如何解决梯度消失,还有笔试题目中的从M个文件选出最大的5个数,使用最小堆。
+二面没怎么问问题
+HR面,问优缺点?印象中打击最大的事情?家人、朋友、同学眼中的你。
+
+## 11. [腾讯]
+9月12号截止  
+9月10号投递网申
+
+## 12. [今日头条]
+计算机视觉 算法 9月10号投递网申
+
+## 13. [图森]
+9月11号现场笔试 漏去了
+2018-09-11 20:23 网申
+
+## 14. 寒武纪 
+2018-09-11 20:40 网申
+2018-09-19 19:00 笔试
+
+## 15. 码隆科技
+2018-09-12 20:24  
+现场笔试,STL(String、queue)使用不熟练  
+2018-09-13 18:31  
+一面技术,自我介绍,然后客流量统计项目,adaboost的训练细节及haar特征;shiftNet前向传播是整数,反向传播是小数,那么是如何反向传播的?关键点预测CPN是如何做的?有没有接触过bottom-up的关键点检测?人脸检测最新的论文,PyramidBox网络的细节点,并且前向预测是如何做的(context与face分类结果是如何结合到一起的)?  
+二面hr,团队合作    
+后面会有性格测评,还有线上面试?
+后面没有收到通知,应该是凉了,面试体验的链接没有填写,可能HR面试失利。
+
+## 16. 科大讯飞
+2018-09-12 20:25
+官网投简历,没有参加笔试
+
+## 17. [YY 欢聚时代](https://app.mokahr.com/campus_apply/hjsd/47)
+虎牙直播 9月27华科大
+2018-09-15 17:06
+官网申请 
+
+## 18. [地平线]
+现场笔试,第二天面试,一面凉了
+反转链表手撕代码没有写出来,太久不写链表的题目了
+
+## 19. [虹软]
+笔试凉了
+
+
+## 驭势科技
+
+
+## [搜狐](http://campus.chinahr.com/2019/sohu/01/index.html#page1)
+8月22号内推截止
+
+
+## [momenta]
+## [hulu](https://www.hulu.com/welcome)
+morgan.cheng@hulu.com 
+
+## [阿里](https://campus.alibaba.com/process.htm?spm=a1z3e1.11770907.0.0.1672725fzgQ9qX)
+8月17号前,内推、网申截止
+
+
+## [百度]
+
+## 课程
+本科: 数字图像处理,计算机视觉,模式识别  
+研究生:数字图像处理,模式识别,计算机图形学,机器学习,图像处理中的数学方法,
\ No newline at end of file
diff --git a/summary/dataset.md b/summary/dataset.md
new file mode 100644
index 0000000..ce23f1e
--- /dev/null
+++ b/summary/dataset.md
@@ -0,0 +1,125 @@
+# dataset
+
+## 人脸检测
+
+[链接总表](http://blog.csdn.net/chenriwei2/article/details/50631212)
+
+- [FDDB] face detection data set and benchmark ,椭圆标记
+    [fddb](http://vis-www.cs.umass.edu/fddb/results.html)
+    [fddb](../essay/face/fddb.md)
+- PASCAL Face dataset
+    851 images, 1341 annotated faces
+- labeled faces in the wild
+    [LFW](http://vis-www.cs.umass.edu/lfw/)
+    205 images with 473 annotated faces 
+- [Adience](http://www.openu.ac.il/home/hassner/Adience/data.html)有8组年龄、性别、丰富环境下
+    数据集: Adience dataset   21K images with 24K face annotation
+- [IMDB-WIKI](https://data.vision.ee.ethz.ch/cvl/rrothe/imdb-wiki/)
+    名人性别、年龄
+- [wider face](http://mmlab.ie.cuhk.edu.hk/projects/WIDERFace/)
+    [widerface](../essay/face/widerface.md)
+
+## 人脸关键点
+
+dataset| samples|description| link
+---|----|----|---
+300W|300 indoor + 300 outdoor|ICCV 2013| [mainpage](https://ibug.doc.ic.ac.uk/resources/300-W/)
+afw|337|obeyed 300w rule| [mainpage](https://ibug.doc.ic.ac.uk/resources/300-W/)
+aflw|25k幅人脸,每个有21处标记|2011|[mainpage](https://www.tugraz.at/institute/icg/research/team-bischof/lrs/downloads/aflw/)用于人脸关键点预测(人脸对齐)most are color, some are gray.[aflw解压工具](http://blog.csdn.net/andeyeluguo/article/details/72875308)(下载需申请,链接中有其他数据库,百度网盘)
+wflw|train:7500+test:2500|98keypoints,2018|[mainpage](https://wywu.github.io/projects/LAB/WFLW.html)
+
+## 表情识别
+
+- [emotionW](https://sites.google.com/view/emotiw2018)
+- [RAF-DB](http://www.whdeng.cn/RAF/model1.html#dataset)
+
+## 人脸识别
+
+- [megaFace](http://megaface.cs.washington.edu/)  
+- [youtube face](https://www.cs.tau.ac.il/~wolf/ytfaces/)
+
+## 辅助驾驶
+
+- viva[Vision for Intelligent Vehicles and Applications (VIVA)](http://cvrr.ucsd.edu/vivachallenge/) 2016,汽车环境下,人手,人脸的检测及跟踪,路标,信号灯,
+- [driverface](https://archive.ics.uci.edu/ml/datasets/DrivFace)
+
+## 行人检测
+
+# dataset link
+
+- [all of kinds dataset](http://personal.ie.cuhk.edu.hk/~ccloy/download.html)  
+- [coco](http://cocodataset.org/#home)  
+- [coco排名](https://competitions.codalab.org/competitions/3221#results)  
+
+- [pascal voc](http://host.robots.ox.ac.uk/pascal/VOC/) [essay: the pascal visual object classes (voc)challenge]  
+- [imageNet](http://www.image-net.org/)  
+
+## visual object tracking, wiki上有更多数据集
+
+- [vot](http://www.votchallenge.net/)
+- [wiki dataset](https://en.wikipedia.org/wiki/Background_subtraction)
+
+## psacal voc
+
+pascal voc: [pattern analysis,statistical modeling and computational learning](http://host.robots.ox.ac.uk:8080/leaderboard/main_bootstrap.php)
+[pascal voc 2007](http://host.robots.ox.ac.uk/pascal/VOC/voc2007/)
+pascal VOC 2012分割 训练集1464张,验证集1449张图片,共2913张
+
+2007中有9963张图片
+SegmentationObject是实例分割的标签文件夹
+SegmentationClass是语义分割的标签文件夹
+JPEGImages是图像文件夹
+
+2012中有17125张图片,每张图片都有一个对应的标签文件在Annotations文件夹。
+
+## 自动驾驶
+
+- [kitti](http://www.cvlibs.net/datasets/kitti/)
+
+## 图像分割
+
+cityscapes 是可以注册下载的
+
+## background substraction数据集
+
+[change detection](http://www.changedetection.net/)
+
+## data augmentation
+
+resize, random crop  
+padding zero, random crop
+hsv change
+horizontal flip
+
+## 人头数据集
+
+- [SCUT Head](https://github.com/HCIILAB/SCUT-HEAD-Dataset-Release)
+- [HollywoodHead](https://www.di.ens.fr/willow/research/headdetection/)
+- [brainwash](https://exhibits.stanford.edu/data/catalog/sx925dc9385)
+- [ShangHaiTech](https://github.com/desenzhou/ShanghaiTechDataset)
+- [crowdhuman](http://www.crowdhuman.org/) Megvii,人群计数。
+
+## ocr
+
+dataset| samples|description| link
+---|----|---|----|---
+ICDAR|[link](http://rrc.cvc.uab.es/?ch=8&com=evaluation&task=1)
+SWT|
+Multi-Lingual|
+
+## google
+
+- [Open Images Dataset V4](a) 用于图像分类、目标检测、视觉目标关系训练的数据集。包含600个类别的bounding box数据集。
+
+## 服饰关键点
+
+[fashion2](https://github.com/switchablenorms/DeepFashion2)
+
+## 语义分割数据集
+
+PASCAL VOC 2012
+BSD
+
+## 特征点匹配
+
+- [建筑](http://www.vision.ee.ethz.ch/showroom/zubud/)
\ No newline at end of file
diff --git a/summary/eccv2018.md b/summary/eccv2018.md
new file mode 100644
index 0000000..ab1af0c
--- /dev/null
+++ b/summary/eccv2018.md
@@ -0,0 +1,5 @@
+Deep Adaptive Attention for Joint Facial Action Unit Detection and Face Alignment
+
+Using LIP to Gloss Over Faces in Single-Stage Face Detection Networks
+
+Joint 3D Face Reconstruction and Dense Alignment with Position Map Regression Network
\ No newline at end of file
diff --git a/summary/intern.md b/summary/intern.md
new file mode 100644
index 0000000..1c43e0c
--- /dev/null
+++ b/summary/intern.md
@@ -0,0 +1,109 @@
+## 大疆
+3-10内推
+```
+深度学习/机器视觉算法优化工程师
+工作职责
+1. 负责深度学习、计算机视觉相关算法、软件方面的研发;
+2. 与FPGA/ASIC工程师配合,实现深度学习,计算机视觉相关算法的高性能实现。
+任职要求
+1. 电子工程,计算机,人工智能等专业硕士以上学历;
+2. 精通C/C++, Python, Matlab编程语言和工具,熟悉Caffe,Tensorflow等平台;
+3. 对相关算法的产品化,工程化兴趣浓厚;
+4. 了解FPGA或ASIC设计,有算法定点化设计经验者优先;
+5. 强烈的责任心,创新意识,逻辑思维及学习能力。
+图像算法工程师
+工作职责
+负责视觉相机的图像算法开发, 包括AEC、去噪、HDR等算法的研究与开发。
+任职要求
+1. 硕士及以上学历;
+2. 熟悉常用的的图像处理方法, 熟练使用C++/C编程语言;
+3. 有嵌入式平台开发经验优先。
+机器学习算法工程师-------------------------------------------------[契合](https://we.dji.com/zh-CN/jobdescription/620068532)
+工作职责
+1. 负责研发机器学习、模式识别、深度学习算法开发;
+2. 负责研发基于图像/点云/雷达的物体检测、运动估计以及语义分割算法;
+3. 负责开发多传感器融合的三维环境感知算法;
+4. 负责与嵌入式深度学习算法工程师协作,针对产品平台进行算法优化。
+任职要求
+1. 计算机科学、信息工程、电子工程、机器人学等专业硕士及以上学历,有C++/Python/Matlab开发经验;
+2. 在模式识别、机器学习、深度学习、机器人学等领域有深入认识,并了解各个算法的条件和瓶颈;
+3. 具有点云数据处理、立体视觉、多视图几何、多传感器融合等科研或开发经验者优先;
+4. 具有物体识别、物体检测、目标跟踪、语义分割、人脸识别等科研或开发经验者优先;
+5. 在相关领域主流会议或期刊发表过论文 (CVPR/ICCV/ECCV/NIPS/ICML/ICLR/IROS/ICRA)者优先;
+6. 具有良好的沟通和写作能力。
+```
+一面现场挂,给人的感觉就是无法继续接下来聊。
+
+## 海康威视--发邮件简历附件给漏了!
+3-10发邮件,海康威视lxghust2016@hust.edu.cn  yangshicai at hikvision.com
+一面 YOLO卡壳、STN详细介绍,实习时间4月1号到9月1号
+客流量统计,320*320输入大小,检测实时,加跟踪后20fps/s,
+
+## 网易
+3-12申请   http://campus.163.com/#/applyJob/empRecode
+计算机视觉算法实习生-深度学习方向(网易杭州)-人工智能事业部
+3月27日在线笔试
+
+## 腾讯医疗
+3-16申请,知乎收藏
+
+## face++ https://zhuanlan.zhihu.com/p/34345043
+3-19申请,知乎收藏
+
+## 美团 机器学习
+3-20官网申
+
+## 百度 2018春实习-北京-计算机视觉算法研发工程师
+3-20官网申请, 简历挂了。。。
+
+## 腾讯 实习计算机视觉
+3-21官网申请 时间 4月中旬-9月1号
+一面 3-22 下午3点 RCNN系列卡壳  
+二面挂 3-22 晚上8点  人脸检测与普通目标检测相比有什么特别的地方?什么事情都要搞个为什么?一输出的线性回归logistic损失与二输出的线性回归softmax损失是等价的?是。为什么?有正则项也相同吗?。KCF原理,大致流程?客流量统计50-60%准确
+SSD与YOLO的区别?IOU预测分支。TEG事业群。劳务实习生?冰山、船只分类为什么没有使用白化?
+
+## 华为2012实验室媒体 互联内推公共号
+3-21邮件申请yunsn.li@huawei.com  
+3-25 官网申请 媒体算法 中央硬件工程院
+
+## 美图
+3月24日官网申请计算机视觉工程师
+## 今日头条 
+3月24日官网申请 AI Lab计算机视觉算法实习生
+## 阿里巴巴自动驾驶方向
+3月24日官网申请 算法工程师-自动驾驶  
+AIlab一面电话面挂
+给人的柑橘就是对方对你毫无兴趣。
+
+## 虹软
+3-25 官网申请  
+熟悉当前流行的计算机视觉与模式分类理论以及常用的统计和学习方法:PCA、Boosting、SVM、Neural Net、Regression等
+熟悉常用特征提取方法:Haar、Gabor、LBP、SIFT、HOG
+
+## 小米
+3-25 官网申请
+熟练掌握各种深度神经网络(DNN, CNN, RNN, LSTM等),并能够将其应用于特定场景中去
+
+## 搜狗
+## 搜狐
+## 格林深瞳
+
+
+## 问题
+1. 做什么
+2. 回答问题时印象较深缺点
+
+## 电话面试注意事项
+1. 手里要有简历
+2. 要准备纸笔
+3. 对公司要有足够的了解
+3. 准备提出的问题
+4. 问什么时候可以得到结果。
+
+## 实习申请邮件
+收到过无数封应聘邮件,基本都没有什么特别好的。我根据自己看邮件和看简历的经验,给你提供几点注意事项吧:1、简明:一天收几百封是非常正常的,一般都不会有时间详细看你的长篇大论;2、扼要:这就好比是一个限制字数的命题作文,比方说30个字尽可能的展示你自己;3、如果专业对口,写一下自己掌握的专业技能,说明你能够承担这份工作;4、实习件,一定要把每周到岗时间明确在邮件中,减少人力疑问的时间;5、其实格式什么的,不重要。
+
+作者:剪刀手爱点赞  
+链接:https://www.zhihu.com/question/21809353/answer/19385163
+来源:知乎
+著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
\ No newline at end of file
diff --git a/summary/interprety.md b/summary/interprety.md
new file mode 100644
index 0000000..9eb9ace
--- /dev/null
+++ b/summary/interprety.md
@@ -0,0 +1,4 @@
+# CNN interprety 可解释性
+
+[feature visualization](https://distill.pub/2017/feature-visualization/#enemy-of-feature-vis)
+[building blocks of interpretablility](https://distill.pub/2018/building-blocks/?utm_source=mybridge&utm_medium=blog&utm_campaign=read_more)
\ No newline at end of file
diff --git a/item/job.md b/summary/job.md
similarity index 99%
rename from item/job.md
rename to summary/job.md
index e0dbe8e..4e10c60 100644
--- a/item/job.md
+++ b/summary/job.md
@@ -1,5 +1,6 @@
 [2017网易计算机视觉笔试](http://blog.csdn.net/zr459927180/article/details/52494669)  
 ## [google](http://blog.csdn.net/ycheng_sjtu/article/details/26393563)
+
 看问题要有深度
 
 有个疑问。自动化学模式识别学的这些东西,和cs学的有什么不一样呢?一样的话,和cs有什么区别呢?论就业的话(原谅我哦这么直接),又有什么区别呢?  
diff --git a/summary/library.md b/summary/library.md
new file mode 100644
index 0000000..3bb9a59
--- /dev/null
+++ b/summary/library.md
@@ -0,0 +1,26 @@
+# library
+
+## neural network
+
+- tensorflow 大型RNN,LSTM
+- pytorch nlp领域?
+- mxnet cv领域?
+
+## image process
+
+- caffe2 cv领域
+- [sod, embed image process](https://github.com/symisc/sod)
+
+## classical image feature
+
+[Image Descriptors and Keypoint Detection](https://cvlab.epfl.ch/software/descriptors-and-keypoints/)
+[FREAK](https://blog.csdn.net/hujingshuang/article/details/47060677)
+[BRISK](https://blog.csdn.net/hujingshuang/article/details/47045497)
+
+## track
+
+[realtime eco](https://github.com/rockkingjy/OpenTracker)
+
+## optimization
+
+[liblinear-A Library for Large Linear Classification](https://www.csie.ntu.edu.tw/~cjlin/liblinear/)
\ No newline at end of file
diff --git a/weeksummary/objfun.md b/summary/objfun.md
similarity index 100%
rename from weeksummary/objfun.md
rename to summary/objfun.md
diff --git a/program/c++/offer.md b/summary/offer.md
similarity index 68%
rename from program/c++/offer.md
rename to summary/offer.md
index 0ca1af7..6a5d3ae 100644
--- a/program/c++/offer.md
+++ b/summary/offer.md
@@ -15,17 +15,26 @@
     创建、插入、删除
     std::pop_heap(),将最大值移入vector最后一个元素
 
-
 ## 算法
-- 分治法
+
+- [stl算法库](http://en.cppreference.com/w/cpp/header/algorithm)
+- 分治法,是一种解决问题的思想,分而治之,divide and conquer,使用这个思想的有快速排序,二分查找,归并排序
+- 插入排序
+- 冒泡排序
+- 希尔排序,(百科讲的比较清楚)是插入排序的一种改进算法,增量参数一般为序列长度减半后再减半的变化。
+- 归并排序,仅次于快速排序,分治法。
 - 快速排序算法,Partition()
     时间复杂度,平均O(nlog(n))次比较,最坏情况O(n^2)。
     空间复杂度,平均O(log(n)),最坏O(n),是递归调用次数,因为递归会消耗栈
-- 动态规划,基于递归的方式分析问题,基于循环的方式编码。自下而上分析。
-- 递归,自上而下分析问题。
+- 动态规划,dynamic programing(表格的意思,而不是程序)。基于递归的方式分析问题,基于循环的方式编码。自下而上分析。
+    有两种编程写法:自底向上、从上到下
+    两个组成部分:状态方程、状态转移方程
+- 递归,自上而下分析问题。1.基线条件,2.递归条件
 
 ## STL
+
 - std::set, std::multiset,根据特定的排序准则,自动将元素进行排序。前者元素不能重复,后者元素可以重复。
+
 ```cpp
 template<
     class Key,
@@ -39,3 +48,6 @@ template<
 throw runtime_error("error message")
 ```
 
+## 排列组合问题
+
+## 二叉树的中序、前序遍历
diff --git a/summary/organize.md b/summary/organize.md
new file mode 100644
index 0000000..3ac02c7
--- /dev/null
+++ b/summary/organize.md
@@ -0,0 +1,38 @@
+VID: object detection in video,基于视频的目标检测
+[很全的会议投稿截止日期](https://aideadlin.es/?sub=CV,NLP,RO,SP,GR,ML)
+
+# 计算机视觉会议
+## A类
+- CVPR, 一年一次,IEEE, international conference on computer vision and pattern recognition
+- ICCV, 两年一次,IEEE, international conference on computer vison
+- ACM MM, ACM international conference on Multimedia
+- NIPS, 每年12月份举办,在中国计算机学会的国际学术会议排名中,NIPS为人工智能领域的A类会议,比较注重理论  
+[NIPS2018](https://nips.cc/Conferences/2018/Schedule)
+- ICML, 每年一次,机器学习
+- ICLR,深度学习方向
+
+## B类
+- ECCV, 两年一次,European conference on computer vision  
+[ECCV2018](http://openaccess.thecvf.com/ECCV2018.py)
+
+## C类
+- ACCV, Asian conference on computer vision
+- ICPR, international conference on pattern recognition 
+- BMVC, British Machine vision conference
+
+# 计算机视觉刊物
+## A类
+- TPAMI, IEEE, Trans on pattern analysis and machine intelligence
+- IJCV, international journal of computer vision
+- TIP, IEEE, transactions on image Processing
+## B类
+- CVIU
+- pattern recognition
+## C类
+- IET-CVI
+- IVC
+- PRL
+
+- [ICDAR](https://en.wikipedia.org/wiki/International_Conference_on_Document_Analysis_and_Recognition), 每两年一次,International Conference on Document Analysis and Recognition
+- [PRCV](http://prcv.qyhw.net.cn/?meeting_id=255)  Chinese Conference on Pattern Recognition and Computer Vision
+- [AAAI](https://www.aaai.org/) Founded in 1979, the Association for the Advancement of Artificial Intelligence
\ No newline at end of file
diff --git a/summary/paper.md b/summary/paper.md
new file mode 100644
index 0000000..05edde0
--- /dev/null
+++ b/summary/paper.md
@@ -0,0 +1,9 @@
+## one-stage相对于two-stage存在的问题
+- 样本类别不平衡,
+- 不能够根据目标大小提取相应的特征
+- 使用anchor匹配机制约束力太强,限制了CNN的模型容量
+
+[知乎](https://www.zhihu.com/people/alan-huang/answers)
+```
+有个小插曲: 之前有Google的人来访问的时候提到, MobileNet其实是他们两年前的工作...因为发现一直没人占这个坑, 所以就挂到arxiv上了.......   所以这个结构比较复古也是说得通的。
+```
\ No newline at end of file
diff --git a/weeksummary/reading.md b/summary/reading.md
similarity index 100%
rename from weeksummary/reading.md
rename to summary/reading.md
diff --git a/weeksummary/sgd.md b/summary/sgd.md
similarity index 92%
rename from weeksummary/sgd.md
rename to summary/sgd.md
index ebcd946..3fc9d09 100644
--- a/weeksummary/sgd.md
+++ b/summary/sgd.md
@@ -1,34 +1,45 @@
 # an overview of gradient descent optimization algorithms sgd
+
 [from blog](http://ruder.io/#open)  
 [中文翻译](http://blog.csdn.net/google19890102/article/details/69942970)  
 [原文有动图](http://ruder.io/optimizing-gradient-descent/index.html#adam)  
 
 ## abstract
+
 本文重在培养对算法不同之处的直觉
 
 ## introduction
+
 [基础介绍推荐cs231n document](http://cs231n.github.io/optimization-1/)  
 学习率$\eta$也叫做步长。
 
 ## gradient descent variants
+
 梯度下降算法依据计算目标函数的梯度时使用数据的大小分为三种,这是一个参数更新的精度与更新过程中所需时间的平衡。
+
 ### batch gradient descent
+
 批梯度下降法,又叫 Vanilla gradient descent,每次参数更新时,在整个训练数据集上计算损失函数关于参数$\theta$的梯度:
 > $$\theta = \theta - \eta \cdot \nabla _{\theta}J(\theta)$$
 因为在每次更新参数时,都需要在整个数据集上计算梯度,所以批梯度下降法会很慢,同时,它无法处理超出内存容量限制的数据集。批梯度下降法也不能在线更新模型,即不能在运行过程中添加新样本。
 它的代码是这样的
+
 ```python
 for i in range(nb_epochs):
     params_grad = evaluate_gradient(loss_function, data, params) # data(包含了label), params(要计算梯度的模型参数)
     params = params - leraning_rate * params_grad
 ```
+
 对于给定的迭代次数,首先,计算损失函数在整个数据集上的损失关于参数的梯度向量。现有的深度学习库已经提供了高效自动计算参数的函数,如果要自己实现,梯度验证是一个比较可靠的方法来验证计算的正确性。  
 更新参数时,使用learning_rate决定更新的步长。对于凸误差函数,批梯度下降法会收敛到全局最优点,而对于非凸误差函数,批梯度下降法只能够收敛到局部最优值。
+
 ### stochastic gradient algorithm(SGD)  
+
 随机梯度下降法,每一次参数更新时,使用一个样本$x^{(i)}$和标签$y^{(i)}$来计算梯度:
 > $$\theta = \theta - \eta \cdot \nabla _{\theta}J(\theta ;x^{(i)};y^{(i)})$$
 对于大数据集,批梯度下降算法在更新参数之前,会计算所有样本的梯度,而其中也包括相似的样本,这样对相同的参数重复计算梯度就会造成计算冗余。而SGD在对每个样本计算梯度后,都更新参数,从而消除了冗余,因此它会更快并且可以在线学习(训练过程中,添加样本)。但是SGD的高方差的频繁更新会导致目标函数的震荡。  
 批梯度下降法会收敛到局部最优值,SGD由于震荡,可以从一个局部最小调到另一个局部最小,从而收敛到更优的局部最小上。另一方面,SGD的持续波动使得最终收敛到特定最小值的过程异常复杂。随着学习率的降低,SGD与批梯度下降法类似,对于非凸误差函数,会收敛到局部最小,对于凸误差函数,会收敛到近似全剧最小上。
+
 ```python
 for i in range(nb_epochs):
     np.random.shuffle(data)
@@ -36,11 +47,14 @@ for i in range(nb_epochs):
         params_grad = evaluate_gradient(loss_funcation, example, params)
         params = params - learning_rate * params_grad
 ```
+
 ### mini-batch gradient descent(SGD)
+
 小批量梯度下降法对上述两种方法进行折中,每次更新参数时,使用$n$个样本计算梯度
 > $$\theta = \theta - \eta \cdot \nabla_{\theta}J(\theta;x^{i:i+n};y^{i:i+n})$$
 这个方法,第一,降低了参数更新量的方差,从而收敛得更加稳定,第二,可以利用深度学习库中高度优化的矩阵优化方法,高效的求解小批量数据的梯度。batch_size一般在$50-256$,通常也叫作SGD。  
 batch size越大,学习率也应该增大?
+
 ```python
 for i in range(nb_epochs):
     np.random.shuffle(data):
@@ -50,31 +64,38 @@ for i in range(nb_epochs):
 ```
 
 ## chanllenge
+
 Vanilla mini-batch gradient descent方法并不能保证收敛,依然有挑战
+
 - 学习率的选择,小学习率会导致收敛过程缓慢,大学习率不容易收敛,导致损失函数在最小值附近震荡或发散。
 - 学习率的调整,如退火随着训练过程的进行调整学习率,如依据预定义的策略调整学习率,如当损失函数下降量少于一个阈值时调整学习率,但是策略与阈值都需要预先定义,因此无法适应数据集的各种特点。
 - 针对所有参数使用相同的学习率也有问题,如数据比较稀疏或者特征的频率不同,那么我们更希望提高出现频次较低的特征的学习率。
 - 是神经网络的误差函数通常是高度非凸的,所以学习算法需要避开无数的局部最小值。[5]解释学习算法遇到的更大阻力其实来自于鞍点,即那些在一个方向是凸的,另一个方向是凹的,马鞍的形状,鞍点的周围通常是误差的平原地带,由于各个轴的梯度都趋向于0,导致SGD很难离开鞍点。
 
 ## gradient descent optimization algorithms
+
 接下来讲解决挑战的深度学习中经常用到的算法,不会涉及对高维数据很难计算的二阶方法如牛顿法
+
 ### momentum
+
 ![momentum](../image/essay/momentum.jpg)  
 图中,椭圆表示损失函数的等高图,带箭头的折线段的每一段表示一次更新的步长的更新向量。  
 在局部最小值附近经常出现沟壑一样结构的损失函数,如上图,SGD在这样的场景中很容易出现在沟壑两边摇摆的情况,导致收敛速度降低。动量法是一种对SGD改进的方法,它将历史步长的更新向量的一个分量$\gamma$增加到了当前的更新向量中,能够减少震荡,趋向于收敛方法。 
-> $$\begin{aligned} v_t &= \gamma v_{t-1}+\eta \nabla_{\theta}J(\theta) \\
-\theta &= \theta - v_t \end{aligned}$$
+> $$\begin{aligned} v_t &= \gamma v_{t-1}+\eta \nabla_{\theta}J(\theta) \\  \theta &= \theta - v_t \end{aligned}$$  
 $\gamma$通常为$0.9$
+
 ### nesterov accelerated gradient(NAG)
+
 对于动量法的改进,因为参数$\theta$肯定会以$-\gamma v_{t-1}$更新,所以这里在更新$-\gamma v_{t-1}$后的位置求梯度,再做实际的参数更新。假设梯度下降算法为一个小球的滚动,那么NAG能够让小球提前在下坡到爬坡的位置减速,而动量法里,只要小球在下坡,就会一直加速。
-> $$\begin{aligned} v_t &=\gamma v_{t-1}+\eta \nabla_{theta}J(\theta - \gamma v_{t-1}) \\
-\theta &= \theta - v_t\end{aligned}$$
+> $$\begin{aligned} v_t &=\gamma v_{t-1}+\eta \nabla_{theta}J(\theta - \gamma v_{t-1}) \\ \theta &= \theta - v_t\end{aligned}$$
 在RNN的优化中,效果很好。  
 ![nag](../image/essay/nag.jpg)  
 蓝色表示动量法参数的更新,蓝色小段表示$\eta\nabla_{\theta}J(\theta)$,蓝色大段表示$\gamma v_{t-1}$。  
 棕色表示NAG算法里的$\gamma v_{t-1}$,红色表示NAG算法里$\eta\nabla_{\theta}J(\theta-\gamma v_{t-1})$,青色表示NAG算法最后的更新。
+
 ### Adagrad
-是一种基于梯度的优化算法,它会对更新频次少的参数调大学习率,对更新频次高的参数调小学习率,因此它适于稀疏数据集。比SGD要鲁棒。   
+
+是一种基于梯度的优化算法,它会对更新频次少的参数调大学习率,对更新频次高的参数调小学习率,因此它适于稀疏数据集。比SGD要鲁棒。
 首先,设置$g_{t,i}$为第$t$次更新时,目标函数对参数$\theta_i$的梯度:
 > $$g_{t,i}=\nabla_{\theta_t}J(\theta_{t,i})$$
 Adagrad调整学习率后的更新规则是
@@ -85,47 +106,51 @@ Adagrad调整学习率后的更新规则是
 $\odot$这里表示矩阵对角线元素与列向量元素间的乘积。
 优点:可以不用调整学习率。  
 缺点:随着更新次数的增多,$G_t$会变得越来越大,导致学习率急剧降低,下一个算法对此做出改进。
+
 ### Adadelta
+
 为了改变Adagrad里学习率单调递减的缺点,使用下式替换$G_t$
 > $$E[g^2]_t=\gamma E[g^2]_{t-1} + (1-\gamma)g_t^2$$
 如同动量法,设置$\gamma=0.9$,那么Adadelta的更新公式是
-> $$\begin{aligned} \Delta \theta_t &= -\frac{\eta}{\sqrt{E[g^2]_{t}+\epsilon}} \odot g_t \\
-\theta_{t+1} &=\theta_t+\Delta \theta_t\end{aligned}$$(1)
+> $$\begin{aligned} \Delta \theta_t &= -\frac{\eta}{\sqrt{E[g^2]_{t}+\epsilon}} \odot g_t \\ \theta_{t+1} &=\theta_t+\Delta \theta_t\end{aligned}$$(1)
 简单起见,上式可以简写为
 > $$\Delta \theta_t=-\frac{\eta}{RMS[g]_t} \odot g_t$$
-其中,$RMS[g]_t=\sqrt{E[g^2]_{t}+\epsilon}$,表示均方根值  
+其中,$RMS[g]_t=\sqrt{E[g^2]_{t}+\epsilon}$,表示均方根值(root mean square)  
 作者注意到更新参数的单位不同??所以又定义了个指数衰减的量
 > $$E[{\Delta \theta}^2]_t=\gamma E[{\Delta\theta}^2]_{t-1} + (1-\gamma){\Delta\theta}_t^2$$
 那么
 > $$RMS[\Delta\theta]_t=\sqrt{E[{\Delta\theta}^2]_{t}+\epsilon}$$
 最后的Adadelta更新规则为
-> $$\begin{aligned}\Delta\theta_t &= \frac{RMS[\Delta\theta]_{t-1}}{RMS[g]_t} \odot g_t \\
-\theta_{t+1} &=\theta_t+\Delta \theta_t\end{aligned}$$(2)
+> $$\begin{aligned}\Delta\theta_t &= \frac{RMS[\Delta\theta]_{t-1}}{RMS[g]_t} \odot g_t \\ \theta_{t+1} &=\theta_t+\Delta \theta_t\end{aligned}$$(2)
 学习率参数已被舍弃
+
 ### RMSprop
+
 实际上与Adadelta的$(1)$式相同,但是两个算法的作者是独立提出的
-> $$\begin{aligned} E[g^2]_t &= 0.9E[g^2]_{t-1}+0.1g_t^2 \\
-\theta_{t+1} &= \theta_t - \frac{\eta}{\sqrt{E[g^2]_t+\epsilon}} \odot g_t \end{aligned}$$
+> $$\begin{aligned} E[g^2]_t &= 0.9E[g^2]_{t-1}+0.1g_t^2 \\ \theta_{t+1} &= \theta_t - \frac{\eta}{\sqrt{E[g^2]_t+\epsilon}} \odot g_t \end{aligned}$$
+
 ### Adam
+
 Adaptive Moment Estimation 是一种为每一个参数计算自适应学习率的算法
-> $$\begin{aligned} m_t&=\beta_1 m_{t-1}+(1-\beta_1)g_t \\
-v_t &= \beta_2 v_{t-1}+(1-\beta_2)g_t^2\end{aligned}$$
+> $$\begin{aligned} m_t&=\beta_1 m_{t-1}+(1-\beta_1)g_t \\ v_t &= \beta_2 v_{t-1}+(1-\beta_2)g_t^2\end{aligned}$$
 $m_t$和$v_t$分别是一阶矩(均值)、二阶矩(无减均值的方差)估计???  
 $m_t$和$v_t$初始化为$0$,如果$\beta_1,\beta_2$趋向于$1$,那么学习率会偏向于$0$,$1-\beta$为decay rates???,所以作者设法纠正
-> $$\begin{aligned} \hat m_t &= \frac{m_t}{1-\beta_1^t} \\
-\hat v_t &= \frac{v_t}{1-\beta_2^t} \end{aligned}$$
+> $$\begin{aligned} \hat m_t &= \frac{m_t}{1-\beta_1^t} \\ \hat v_t &= \frac{v_t}{1-\beta_2^t} \end{aligned}$$
 更新规则为
 > $$\theta_{t+1} = \theta_t - \frac{\eta}{\sqrt{\hat v_t + \epsilon}} \odot \hat m_t \qquad \text{这里不知道原文是不是有笔误}$$
 设置$\beta_1=0.9$,$\beta_2=0.999$,$\epsilon=1e-8$
+
 ### AdaMax
+
 是直接基于Adam的改进,解释的不清楚??
-> $$\begin{aligned} u_t&=\beta_2^\infty v_{t-1}+(1-\beta_2^\infty)|g_t|^\infty \\ 
-&= \max(\beta_2 \cdot v_{t-1},|g_t|)\end{aligned}$$
+> $$\begin{aligned} u_t&=\beta_2^\infty v_{t-1}+(1-\beta_2^\infty)|g_t|^\infty \\ &= \max(\beta_2 \cdot v_{t-1},|g_t|)\end{aligned}$$
 更新规则
 > $$\theta_{t+1} = \theta_t - \frac{\eta}{u_t} \odot \hat m_t $$
+
 ### Nadam
+
 Adam相当于结合了momentum与RMSprop,同样Nesterov-accelerated Adaptive Moment Estimation(Nadam)结合了Adam与NAG。写的比较复杂。
 
 ## 算法可视化
-似乎Adam算法的效果与速度是最好的,但是现在很多论文都只使用SGD与learning rate annealing schedule。但是,根据实验观察,SGD也能够找到最小值,但是通常更费时间,并且更易陷于鞍点或局部极小值,因此,对于比较深、复杂的网络,推荐使用自适应学习率的算法
 
+似乎Adam算法的效果与速度是最好的,但是现在很多论文都只使用SGD与learning rate annealing schedule。但是,根据实验观察,SGD也能够找到最小值,但是通常更费时间,并且更易陷于鞍点或局部极小值,因此,对于比较深、复杂的网络,推荐使用自适应学习率的算法
diff --git a/video/cnndeeperwider.md b/summary/video/cnndeeperwider.md
similarity index 95%
rename from video/cnndeeperwider.md
rename to summary/video/cnndeeperwider.md
index abb4728..0d48136 100644
--- a/video/cnndeeperwider.md
+++ b/summary/video/cnndeeperwider.md
@@ -32,7 +32,7 @@ identity mapping
 ## going wider with interleaved Group Convolutions ICCV 2017
 卷积神经网络的复杂度分析  
 - 时间复杂度  
-使用FLOPs衡量,(floting point operations per second)
+使用FLOPs衡量,(floting point operations)
 - 空间复杂度  
 模型的参数量,体现为模型的体积。
 group convolution  
diff --git a/video/gans.md b/summary/video/gans.md
similarity index 100%
rename from video/gans.md
rename to summary/video/gans.md
diff --git a/video/objectRepresentation.md b/summary/video/objectRepresentation.md
similarity index 100%
rename from video/objectRepresentation.md
rename to summary/video/objectRepresentation.md
diff --git a/summary/week/20181104.md b/summary/week/20181104.md
new file mode 100644
index 0000000..c07bd48
--- /dev/null
+++ b/summary/week/20181104.md
@@ -0,0 +1,20 @@
+## [关于文献阅读和科研选题-程明明](https://mmcheng.net/paperreading/)
+```
+如果你发现自己很多时候可以“预测”这些发展了,那么非常恭喜你,这篇小总结可能对你没太大用处了如果我们又一次陷入那个觉得只恨又一个容易做的工作被别人做掉了的怪圈,那么还是再认真锻炼,仔琢磨这些新的工作是怎么一个接一个在在相似的topic上层出不穷的。
+```
+```
+体现了最牛的一种创新境界“提出新问题”。
+```
+```
+最直接最容易想到的创新莫过于“组合创新”。
+```
+```
+虽然“组合创新”有时候容易被认为是minor improvement,但是如果论文写得好,实验做得充分,也可以做出具有影响力的工作。而且貌似大部分论文都是组合创新。
+```
+
+## [edge detection evaluation metric](http://cs.brown.edu/courses/cs143/2011/results/proj2/lbsun/)
+```
+ODS stands for optimal dataset scale; 
+OIS stands for optimal image scale. 
+The ODS F-measure corresponds to the most outward point on the PR curve plotted. The OIS generally reports a better performance, because the F-measure is computed by aggregating per-image counts that correspond to those that give the best F-measure for each image.
+```
diff --git a/summary/week/20181111.md b/summary/week/20181111.md
new file mode 100644
index 0000000..23b2a8d
--- /dev/null
+++ b/summary/week/20181111.md
@@ -0,0 +1,15 @@
+## [阮一峰](http://www.ruanyifeng.com/blog/2018/11/weekly-issue-30.html)
+```
+谷歌从高管到基层,对社交产品都缺乏足够兴趣。不信你去看,谷歌没有一个高管,喜欢玩社交媒体。甚至谷歌工程师里面,很少有特别喜欢写博客的,Steve Yegge 算一个,但是他觉得谷歌不合适自己,辞职了。
+```
+
+## 图像检索
+```
+第一个是追求所谓的相似,也就是从gallery里去找到相似或者相同的,常见的人脸识别,行人再识别,商品检索,草图检索,都是属于这个范畴,目前的深度学习方法,更多的就是追求如何获得更好的feature,这些领域,其实方法都是可以通用。
+第二个就是传统领域需要做的一个match的问题,即如果某个建筑在一张图里出现,假使其在另外一张图里只出现一半,或者在某个角落里出现,能否再次找到。如果直接采用cnn特征,很有可能找到的轮廓相似的建筑物,而非相同的建筑物。这种情况下,一般是切成patch再分别抽特征,当然后面faster rcnn出来之后,可以在最后的feautre map上直接划分。也可以对feature map的特征做vlad或者fv的编码再检索。一般论文里的标题都是CBIR,instance retrieval这种。
+
+作者:小赖sqLai
+链接:https://www.zhihu.com/question/29467370/answer/238155133
+来源:知乎
+著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
+```
\ No newline at end of file
diff --git a/summary/week/20181126.md b/summary/week/20181126.md
new file mode 100644
index 0000000..0261fc4
--- /dev/null
+++ b/summary/week/20181126.md
@@ -0,0 +1,6 @@
+```
+GeForce 个人计算机、桌面级
+Quadro 工作站
+Titan V和它的服务器级别的大哥Tesla V100是相当新的显卡。
+https://zhuanlan.zhihu.com/p/32729205
+```
\ No newline at end of file
diff --git a/summary/week/20181203.md b/summary/week/20181203.md
new file mode 100644
index 0000000..bcd316c
--- /dev/null
+++ b/summary/week/20181203.md
@@ -0,0 +1,8 @@
+```
+我想,上帝设置死亡这个the end的时候,一定是想教育我们,活在当下最重要,你永远不知道明天和意外哪个先来。可能有点跑题,确实,有真实体验的那些人估计没法现身说法了都,手机吭哧吭哧打了这么多,就是想把自己看到的一些经历分享给大家听,希望所有人都热爱生活,在死亡还没来临的时候,好好活着。曾经看到很经典的话,共勉:你浑浑噩噩过去的今天,就是昨天死去的人期待却没有到达的明天。
+
+作者:草莓超人
+链接:https://www.zhihu.com/question/19946806/answer/31566397
+来源:知乎
+著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
+```
\ No newline at end of file
diff --git a/summary/week/20181216.md b/summary/week/20181216.md
new file mode 100644
index 0000000..4e6a1cd
--- /dev/null
+++ b/summary/week/20181216.md
@@ -0,0 +1,11 @@
+'''
+“习得性无助”是美国心理学家塞利格曼1967年在研究动物时提出的,他用狗作了一项经典实验,起初把狗关在笼子里,只要蜂音器一响,就给以难受的电击,狗关在笼子里逃避不了电击,多次实验后,蜂音器一响,在给电击前,先把笼门打开,此时狗不但不逃而是不等电击出现就先倒在地开始呻吟和颤抖,本来可以主动地逃避却绝望地等待痛苦的来临,这就是习得性无助。
+
+https://baike.baidu.com/item/%E4%B9%A0%E5%BE%97%E6%80%A7%E6%97%A0%E5%8A%A9
+'''
+
+'''
+ “臣民意识”是政治领域的术语。要聊“臣民意识”,顺便把“公民意识”也说一下。这两者的关键性差别在于:“公民意识”认为自己是国家/社会的主人,既有权利也有义务;“臣民意识”认为自己只是一个被统治者(仆人),只有义务没有权利。
+
+https://program-think.blogspot.com/2012/12/emperor-complex.html
+'''
\ No newline at end of file
diff --git a/summary/week/20181223.md b/summary/week/20181223.md
new file mode 100644
index 0000000..3d74fce
--- /dev/null
+++ b/summary/week/20181223.md
@@ -0,0 +1,19 @@
+# 阮一峰
+
+```c
+我觉得演讲的时候最好轻声细语,而不是声嘶力竭。......让观众必须努力才能听清,这有助于他们切换到积极的思维模式下。
+过度反应机制或类似的机制会使我们在有一点点背景噪声的地方更好地集中精力,就好像对抗这些噪声的行为可以帮助我们集中注意力
+```
+
+不敢苟同,更加有吸引力的声音效果才会好。
+
+```c
+急性刺激压力源肯定比一个温和但连续不断的压力源有益。后者大多是让你在生活中感到压抑的东西,包括按揭贷款、税务问题、因拖欠报税而产生的内疚、考试压力、琐碎事务、电子邮件回复、填写表格、每天上下班通勤,等等。
+......
+第一种类型的压力源是【必要的】,而第二种类型的压力源对人的健康却是【有害的】。
+```
+
+```c
+a JIT compiler will combine many light weight functions into a single kernel launch.(gpu?)
+https://fl.readthedocs.io/en/latest/autograd.html
+```
\ No newline at end of file
diff --git a/summary/week/20181228.md b/summary/week/20181228.md
new file mode 100644
index 0000000..73c4ecf
--- /dev/null
+++ b/summary/week/20181228.md
@@ -0,0 +1,9 @@
+# 阮一峰
+
+```c
+通过小说对一代人产生影响,这种事情可能永久地结束了。以后,对一代人有影响的可能将是某个游戏、某个视频节目、某个网红。
+```
+
+```c
+谷歌投资的无人汽车公司 Waymo,开始在亚利桑那州提供出租车服务
+```
\ No newline at end of file
diff --git a/summary/week/20190101.md b/summary/week/20190101.md
new file mode 100644
index 0000000..aa5a9c9
--- /dev/null
+++ b/summary/week/20190101.md
@@ -0,0 +1,27 @@
+# haha
+
+```c
+网络上有句话很流行:
+
+有人尖刻的嘲讽你,你马上尖酸地回敬他;
+
+有人毫无理由的看不起你,你马上轻蔑地鄙视他;
+
+有人在你面前大肆炫耀,你马上加倍证明你更厉害;
+
+有人对你冷漠,你马上对他冷谈疏远;
+
+看,你讨厌的那些人,轻易就把你变成你自己最讨厌的那种样子。
+```
+
+```c
+去爱吧,就像不曾受过伤一样;
+
+跳舞吧,就像没有人欣赏一样;
+
+唱歌吧,就像没有人聆听一样;
+
+工作吧,就像不需要金钱一样;
+
+生活吧,就像今天是世界末日。
+```
\ No newline at end of file
diff --git a/summary/week/20190316.md b/summary/week/20190316.md
new file mode 100644
index 0000000..55801e4
--- /dev/null
+++ b/summary/week/20190316.md
@@ -0,0 +1,14 @@
+# chat
+
+```html
+而为了验证模型的有效性,不得不回归无法避免的 benchmark 比较。而 Andy 的研究受 Dyson 工业界的资助,从博士提出 MonoSLAM 开始到帮助工业界一起开发基于SLAM 算法的扫地机器人 Dyson 360 Eye,他的研究方向一直是优化改善现有算法,得到尽可能 real-time, efficient 的 working system。
+
+所谓观点和研究方向方法的冲突原本在科研里应该是非常常见的也应该是被鼓励的,而我本科的科研记忆却基本是实现导师的想法,即使从我自己的直觉知道这并没法工作,但还是需要投入大量的时间去做实验来证明他真的无法工作。一旦出现观点的冲突就还以排挤的回应。原来那么多年,我都做了假的科研。
+
+作者:刘诗昆
+链接:https://www.zhihu.com/question/298181420/answer/619558578
+来源:知乎
+著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
+```
+
+这才是科研吧!也是我们日常生活中应该有的状态,而不是浑浑噩噩。
\ No newline at end of file
diff --git a/summary/week/20190324.md b/summary/week/20190324.md
new file mode 100644
index 0000000..c04814f
--- /dev/null
+++ b/summary/week/20190324.md
@@ -0,0 +1,16 @@
+# 心理学
+
+原来做题时经常听到的“进入状态”是有科学依据的。
+> 相比“系统1”而言,“系统2”的启动非常慢。经常听到有句话叫做【进入状态】,用来形容“系统2”非常恰当。而且“系统2”的【进入状态】的耗时还与你想要处理的任务的复杂程度有关。如果“系统2”只是处理【简单】任务,“进入状态”的耗时偏【短】;反之,要处理非常复杂的任务,“进入状态”的耗时就偏【长】。你可以形象地理解成——为了处理复杂任务,“系统2”需要达到某种【满负荷运转】的状态。
+
+多任务对人类来说并不合适
+> 系统2”同一个瞬间只能处理【单个】任务。如果让“系统2”同时进行两个复杂任务,至少有一个任务会搞砸(通常是两个都搞砸)。关于这点,也已经得到心理学实验的证实。
+
+学生之间的差别
+> 只要稍微动动脑子就可以避免这个令人窘迫的错误。认为答案是10美分的人显然不爱动脑筋,而说出正确答案的人显然思维更活跃。上万名大学生都回答了这个球拍和球的问题,其结果令人吃惊。哈佛大学、麻省理工学院和普林斯顿大学中 50% 以上的学生给出了这个直觉性的错误答案。在声誉稍差一点的大学里,则有 80% 以上的学生没有验证答案就脱口而出。在这些小实验中,答错问题显然在某种程度上说明了其原因是精神动力不足,而不是努力程度不够。......避免思维上懒惰的人可以被叫做“勤快人”。他们更机警,思维更活跃,不会满足于貌似正确的答案,对自己的直觉也常持怀疑态度。
+
+警句?
+> 所以,“心理舒适区”会导致一种【马太效应】(该效应俗称“两极分化”)——越经常思考的人,就越来越善于思考;越少思考的人,就越来越难以思考。
+
+锻炼思维,指导意见
+> 俺强烈建议:多接触和学习【不同领域】
diff --git a/summary/week/20190407.md b/summary/week/20190407.md
new file mode 100644
index 0000000..914a1f1
--- /dev/null
+++ b/summary/week/20190407.md
@@ -0,0 +1,17 @@
+# 阮一峰
+
+出租车(时间换金钱)
+> 我觉得,越来越多的程序员正在落入这个陷井,用编码的时间换取收入。只有不停地做项目,才能拿到钱。项目做得越多,收入越高。这个项目开发完了,公司又让他去干下一个项目。 忙了好几年,项目完成了一大堆,但是自己什么也没留下,的收入还要取决于从零开始的新项目。这样的话,你跟出租车司机有何两样,哪一天你不写代码了,不是照样没收入。
+
+世界?
+> 有消息称,南京市河西区的环卫工人被要求佩戴 GPS 跟踪智能手环,这会随时监控他们的位置,而且如果他们停止移动超过20分钟,手环就会发出提醒"请继续工作"。报道披露后,公众压力使得当地环卫公司决定稍微让步,现在如果环卫工人留在一个地方,手环不再发出提醒"请继续工作",但仍然会跟踪工人的移动。
+
+## 知乎
+
+2019-04-13 22:57
+> 第一是对过去的结论,不论是自己实验得到的,还是看别人paper得到的,都记得很清楚,而且遇到类似的新paper与新结论,即使表面上形式并不相像,也能很快与之前的结论串起来,并指出异同,此处尤其佩服 @朱锡洲。第二是对复杂系统的把控很强,做detection的同学可能知道,Faster-RCNN等主流框架,其中的细节很多,但是即使遇到非常离奇的bug,组里同学也能快速列举可能的原因,迅速排查,
+
+作者:程大治
+链接:https://www.zhihu.com/question/22081552/answer/644216353
+来源:知乎
+著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
\ No newline at end of file
diff --git a/summary/week/20190425.md b/summary/week/20190425.md
new file mode 100644
index 0000000..f88fca4
--- /dev/null
+++ b/summary/week/20190425.md
@@ -0,0 +1,26 @@
+# 知乎
+
+```m
+“从 2016 年到现在,我已经看了 1800 篇了,看过的都用软件记下来”。粗略算一下,张祥雨平均每天看两篇论文。而这只是他每天做实验、管理团队之余,停歇片刻去做的事情。
+
+作者:新智元
+链接:https://zhuanlan.zhihu.com/p/63270486
+来源:知乎
+著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
+```
+
+世事洞明皆学问,哪用得着专门去看方法论?
+
+```m
+大厂镀金这种事大家笑笑就好,个人认为并不是值得寄托的路线,做技术还是靠自己。
+```
+
+## 豆瓣
+
+```m
+不要用你战术上的勤奋,掩盖战略上的懒惰
+```
+
+```m
+而相反的,我曾经亲眼见过一个朋友为了省一双鞋子的一两百块钱花整整一天的时间在网上看各个网店下的各种评论,就是为了防止买到假货,虽然他最后买到了满意的鞋子,但难道他认为他的一天时间只值一两百块钱?如果他用这么一天时间去看一本书,学习英语,去健身,或者去认识一个有趣的人,获得的收益绝对远远高于那么一两百块钱。但可悲的是,包括以前的我在内,很多人都会把自己的生命浪费在这些蝇头小利上,如果你认为你的一天值两百块,那么你一辈子也只值六百万,连北京的一套房子都比不上。
+```
\ No newline at end of file
diff --git a/weeksummary/20171207.md b/weeksummary/20171207.md
deleted file mode 100644
index e69de29..0000000
diff --git a/weeksummary/dataset.md b/weeksummary/dataset.md
deleted file mode 100644
index 2bcccb4..0000000
--- a/weeksummary/dataset.md
+++ /dev/null
@@ -1,56 +0,0 @@
-## face dataset
-[链接总表](http://blog.csdn.net/chenriwei2/article/details/50631212)
-- face detection data set and benchmark ,椭圆标记
-    [fddb](http://vis-www.cs.umass.edu/fddb/results.html)
-    在2845图像中取了5171张人脸图像,已经读取验证了,图像数目是正确的
-- annotated facial landmarks in the wild(下载需申请,链接中有其他数据库,百度网盘)
-    [aflw](https://www.tugraz.at/institute/icg/research/team-bischof/lrs/downloads/aflw/)
-    [aflw解压工具](http://blog.csdn.net/andeyeluguo/article/details/72875308)
-    25k幅人脸,每个有21处标记
-    most are color, some are gray
-- PASCAL Face dataset
-    851 images, 1341 annotated faces 
-- labeled faces in the wild
-    [LFW](http://vis-www.cs.umass.edu/lfw/)
-    205 images with 473 annotated faces 
-- Adience
-    [Adience](http://www.openu.ac.il/home/hassner/Adience/data.html)有8组年龄、性别、丰富环境下
-    数据集: Adience dataset   21K images with 24K face annotation
-- [IMDB-WIKI](https://data.vision.ee.ethz.ch/cvl/rrothe/imdb-wiki/)
-    名人性别、年龄
-- [wider face](http://mmlab.ie.cuhk.edu.hk/projects/WIDERFace/)
- 12880 images
- 
- ## 人脸识别
- [megaFace](http://megaface.cs.washington.edu/)
- 
-# dataset link
-[all of kinds dataset](http://personal.ie.cuhk.edu.hk/~ccloy/download.html)
-[coco](http://cocodataset.org/#home)
-[coco排名](https://competitions.codalab.org/competitions/3221#results)
-
-[pascal voc](http://host.robots.ox.ac.uk/pascal/VOC/) [essay: the pascal visual object classes (voc)challenge]
-[imageNet](http://www.image-net.org/)
-
-# visual object tracking, wiki上有更多数据集
-[vot](http://www.votchallenge.net/)
-[wiki dataset](https://en.wikipedia.org/wiki/Background_subtraction)
-
-## psacal voc
-pascal voc: [pattern analysis,statistical modeling and computational learning](http://host.robots.ox.ac.uk:8080/leaderboard/main_bootstrap.php)
-[pascal voc 2007](http://host.robots.ox.ac.uk/pascal/VOC/voc2007/)
-pascal VOC 2012分割 训练集1464张,验证集1449张图片,共2913张
-
-## 自动驾驶
-[kitti](http://www.cvlibs.net/datasets/kitti/)
-
-## 图像分割
-cityscapes 是可以注册下载的
-## background substraction数据集
-[change detection](http://www.changedetection.net/)
-
-## data augmentation
-resize, random crop  
-padding zero, random crop 
-hsv change 
-horizontal flip
diff --git a/weeksummary/essay.md b/weeksummary/essay.md
deleted file mode 100644
index d0c2b7d..0000000
--- a/weeksummary/essay.md
+++ /dev/null
@@ -1,26 +0,0 @@
-VID: object detection in video,基于视频的目标检测
-
-# 计算机视觉会议
-## A类
-- CVPR, 一年一次,IEEE, international conference on computer vision and pattern recognition
-- ICCV, 两年一次,IEEE, international conference on computer vison
-- ACM MM, ACM international conference on Multimedia
-## B类
-- ECCV, 两年一次,European conference on computer vision
-## C类
-- ACCV, Asian conference on computer vision
-- ICPR, international conference on pattern recognition 
-- BMVC, British Machine vision conference
-
-# 计算机视觉刊物
-## A类
-- TPAMI, IEEE, Trans on pattern analysis and machine intelligence
-- IJCV, international journal of computer vision
-- TIP, IEEE, transactions on image Processing
-## B类
-- CVIU
-- pattern recognition
-## C类
-- IET-CVI
-- IVC
-- PRL
diff --git a/weeksummary/paper.md b/weeksummary/paper.md
deleted file mode 100644
index 1eccbb3..0000000
--- a/weeksummary/paper.md
+++ /dev/null
@@ -1,5 +0,0 @@
-## one-stage相对于two-stage存在的问题
-- 样本类别不平衡,
-- 不能够根据目标大小提取相应的特征
-- 使用anchor匹配机制约束力太强,限制了CNN的模型容量
-