深度篇——神经网络(六) 细说 数据增强与fine-tuning

返回主目录

返回神经网络目录

上一章:深度篇——神经网络(五)  细说 优化器

下一章:深度篇——神经网络(七) 细说 DNN神经网络手写数字代码演示

 

本小节,细说 数据增强与fine-tuning,下一小节细说 神经网络手写数字代码演示

 

本小节的数据增强与fine-tuning,还是属于对神经网络的调优过程。

 

5. 调优神经网络

(9). 数据增强

数据增强是深度学习中常用的技巧之一,主要用于增加训练数据集,让数据尽可能的多样化,是的训练的偶像具有更强的泛化能力。现有的各大深度学习框架都已经自带了数据增强,平时在使用的时候直接调用对应的接口函数,但是只要的话,缺少对数据进行详细的分析。在实际应用中,并非所有的数据增强方式都使用于当前的训练数据。这需要用户根据自己的数据集特征来确定应该使用哪几种数据增强方式。数据增强方式常用有以下3种:

原图:

①. 空间几何变换类

   a. 翻转

       翻转包括水平翻转和垂直翻转,其变换公式如下:

             水平翻转:

               \large \left\{\begin{matrix} x = - x_{0} \\ y = y_{0} \end{matrix}\right.

             垂直翻转:

                \large \left\{\begin{matrix} x = x_{0} \\ y = - y_{0} \end{matrix}\right.

       矩阵变换公式如下:

             水平翻转:

                \large \left[\begin{matrix} x \\ y \\ 1 \end{matrix}\right] = \left[\begin{matrix} -1 & 0 & 0 \\0 & 1 & 0 \\ 0 & 0 &1 \end{matrix}\right] \left[\begin{matrix} x_{0} \\ y_{0} \\ 1 \end{matrix}\right]

             垂直翻转:

                \large \left[\begin{matrix} x \\ y \\ 1 \end{matrix}\right] = \left[\begin{matrix} 1 & 0 & 0 \\0 & - 1 & 0 \\ 0 & 0 &1 \end{matrix}\right] \left[\begin{matrix} x_{0} \\ y_{0} \\ 1 \end{matrix}\right]

           

            

   b. 旋转

       对图像做一定角度旋转操作,其变换公式如下:

                 顺时针旋转:

                  \large \left\{\begin{matrix} x = x_{0} cos \alpha - y_{0} sin \alpha \\ y = x_{0} sin \alpha + y_{0} cos \alpha \end{matrix}\right.

                 逆时针旋转:

                   \large \left\{\begin{matrix} x = x_{0} cos \alpha + y_{0} sin \alpha \\ y = -x_{0} sin \alpha + y_{0} cos \alpha \end{matrix}\right.

       矩阵变换公式如下:

                  顺时针旋转:

                   \large \left[\begin{matrix} x \\ y \\ 1 \end{matrix}\right] = \left[\begin{matrix} cos \alpha & - sin \alpha & 0 \\ sin \alpha & cos \alpha & 0 \\ 0 & 0 &1 \end{matrix}\right] \left[\begin{matrix} x_{0} \\ y_{0} \\ 1 \end{matrix}\right]

                 逆时针旋转:

                   \large \left[\begin{matrix} x \\ y \\ 1 \end{matrix}\right] = \left[\begin{matrix} cos \alpha & sin \alpha & 0 \\ - sin \alpha & cos \alpha & 0 \\ 0 & 0 &1 \end{matrix}\right] \left[\begin{matrix} x_{0} \\ y_{0} \\ 1 \end{matrix}\right]

           

   c. 平移

       平移是指所有的图像在 x 轴 和 y 轴 方向各平移和。其变换公式如下:

                   \large \left\{\begin{matrix} x = x_{0} + \triangle x \\ y = y_{0} + \triangle y \end{matrix}\right.

         矩阵的变换公式如下:

                    \large \left[\begin{matrix} x \\ y \\ 1 \end{matrix}\right] = \left[\begin{matrix} 1 & 0 & \triangle x \\0 & 1 & \triangle y \\ 0 & 0 &1 \end{matrix}\right] \left[\begin{matrix} x_{0} \\ y_{0} \\ 1 \end{matrix}\right]

         

   d. crop 裁剪

       裁剪图片的感兴趣区域 (ROI)

       

   e. 图像缩放

       图像缩放是指对当前图像进行任意的缩放,其变换公式如下:

              \large \large \left\{\begin{matrix} x = a \cdot x_{0} \\ y = b \cdot y_{0} \end{matrix}\right.

             \large a, \; b: 为倍数,如 0.8 倍 或 1.1 倍

       矩阵变换公式如下:

               \large \left[\begin{matrix} x \\ y \\ 1 \end{matrix}\right] = \left[\begin{matrix} a & 0 & 0 \\0 & b & 0 \\ 0 & 0 &1 \end{matrix}\right] \left[\begin{matrix} x_{0} \\ y_{0} \\ 1 \end{matrix}\right]

       

   f. 错切

     错切变换是将坐标点沿 x 和 y 轴发生不等量的变换,得到点的过程。其数学公式如下:

                \large \left\{\begin{matrix} x = x_{0} + cy_{0} \\ y = bx_{0} + y_{0} \end{matrix}\right.

      矩阵变换公式如下:

                  

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值