Skip to content

Commit 2fd4a7f

Browse files
committed
添加数据增强方法
1 parent b20c77f commit 2fd4a7f

34 files changed

+6261
-684
lines changed

doc/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
# The full version, including alpha/beta/rc tags
3232
release = torch_book.__version__
33-
html_baseurl = 'https://xinetzone.github.io/torch_book'
33+
html_baseurl = 'https://xinetzone.github.io/torch-book'
3434

3535
# -- General configuration ---------------------------------------------------
3636

@@ -166,7 +166,7 @@
166166
# 默认情况下,编辑按钮将指向版本库的根。
167167
# 如果你的文档被托管在一个子文件夹中,请使用以下配置:
168168
"path_to_docs": "doc/", # 文档的路径,默认 `docs/``
169-
"github_url": "https://github.com/xinetzone/torch_book",
169+
"github_url": "https://github.com/xinetzone/torch-book",
170170
"repository_url": "https://github.com/xinetzone/torch_book",
171171
"repository_branch": "main", # 文档库的分支,默认 `master`
172172
# -- 在导航栏添加一个按钮,链接到版本库的议题 ------------------------------
File renamed without changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# 卷积算法指南
22

33
```{toctree}
4-
intro
4+
chaos
55
```

doc/paper/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
```{toctree}
44
:maxdepth: 2
55
6+
transforms/index
67
quant/index
78
convolution-arithmetic/index
89
```

doc/paper/transforms/cutmix.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Cutmix
2+
3+
{cite:p}`yun2019cutmix`

doc/paper/transforms/cutout.ipynb

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"cells": [
3+
{
4+
"attachments": {},
5+
"cell_type": "markdown",
6+
"metadata": {},
7+
"source": [
8+
"# 数据增强之 Cutout\n",
9+
"\n",
10+
"```{note}\n",
11+
"{cite:p}`devries2017improved` 是由 Devansh Arpit、 Stanisław Jastrzębski、Nicolas Ballas、David Krueger、Emmanuel Bengio 和 Yoshua Bengio 于 2017 年发布的一篇研究论文。\n",
12+
"\n",
13+
"这篇论文介绍了一种正则化技术,用于解决卷积神经网络(CNNs)中的过拟合问题。当 CNN 基于有限的数据集进行训练时,就容易出现过拟合的问题,导致网络仅仅是记忆了训练数据,而未能适应新的数据点。\n",
14+
"\n",
15+
"这种正则化技术名为“Cutout”,它涉及到在训练期间随机选择输入图像的正方形区域,将其所有像素设置为零。这个过程在不同的训练示例中随机进行,有助于防止网络过度依赖于特定的特征或输入数据的部分。\n",
16+
"\n",
17+
"该论文提供了实验结果,表明 Cutout 改进了 CNN 在多个图像分类数据集上的表现,包括 CIFAR-10、CIFAR-100 和 SVHN。Cutout 被证明可以显著减少过拟合,并提高 CNN 的泛化性能。作者还将 Cutout 与其他正则化技术(如 dropout)进行了比较,并表明 Cutout 在泛化性能方面优于它们。\n",
18+
"\n",
19+
"总的来说,“使用 Cutout 改进卷积神经网络的正则化”提供了一种有力的正则化技术,可以帮助改善 CNN 的泛化性能。这种方法易于实现并可以轻松集成到现有的 CNN 架构中,因此是处理深度学习应用中的过拟合问题的一种有用技术。\n",
20+
"\n",
21+
"Cutout 技术在很多方面都是可扩展的,因为它的思想是基于一个通用的原则。例如,类似于 Cutout 的技术,如 MixUp,DropBlock 和 DropPath,都是以类似的想法出现的,即在训练期间随机删除或修改输入。这些变体进一步拓展了 Cutout 的应用领域和功效,使其成为更加灵活和适用于更多深度学习应用的技术。\n",
22+
"```"
23+
]
24+
},
25+
{
26+
"attachments": {},
27+
"cell_type": "markdown",
28+
"metadata": {},
29+
"source": [
30+
"Cutout 使用固定大小的正方形区域,采用全 0 填充,而且允许正方形区域在图片外(由于这点,Cutout 非正方形区域都在边界处)。\n",
31+
"\n",
32+
"- 正方形区域的边长固定;\n",
33+
"- 正方形区域使用同一种像素值填充;\n",
34+
"- 正方形随机出现在图片中,超出边界的部分被截断。\n",
35+
"\n",
36+
"```{tip}\n",
37+
"- 正方形边长的设定,是否会覆盖图像主要信息;在尺度不一的实际业务场景中可能影响其效果,比如目标检测中将目标全部覆盖了。\n",
38+
"- 使用 Cutout 前,先进行归一化,以降低像素填充的影响。\n",
39+
"```"
40+
]
41+
}
42+
],
43+
"metadata": {
44+
"language_info": {
45+
"name": "python"
46+
},
47+
"orig_nbformat": 4
48+
},
49+
"nbformat": 4,
50+
"nbformat_minor": 2
51+
}

doc/paper/transforms/index.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# 数据增强
2+
3+
一些常用的数据增强方法:
4+
5+
- Cutout:通过 0 填充,随机删除矩形区域
6+
- Random Erasing:通过均值填充,随机删除矩形区域,
7+
- Mixup:两张图像每个位置的像素根据一定比例进行叠加,label 根据像素叠加比例进行分配
8+
- Cutmix:随机删除矩形区域,并通过另一张图像的同一位置像素值填充,label 根据像素所占比例进行分配
9+
10+
11+
```{toctree}
12+
cutout
13+
random-erasing
14+
mixup
15+
cutmix
16+
mosaic
17+
```

doc/paper/transforms/mixup.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Mixup
2+
3+
{cite:p}`zhang2018mixup`

doc/paper/transforms/mosaic.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Mosaic
2+
3+
Mosaic数据增强方法是[YOLOV4](https://link.zhihu.com/?target=https%3A//github.com/Tianxiaomo/pytorch-YOLOv4)论文中提出来的,主要思想是将四张图片进行随机裁剪,再拼接到一张图上作为训练数据。这样做的好处是丰富了图片的背景,并且四张图片拼接在一起变相地提高了batch_size,在进行batch normalization的时候也会计算四张图片,所以对本身batch_size不是很依赖,单块GPU就可以训练YOLOV4。
4+
5+
- cutout和cutmix就是填充区域像素值的区别;
6+
- mixup和cutmix是混合两种样本方式上的区别:
7+
- mixup是将两张图按比例进行插值来混合样本,cutmix是采用cut部分区域再补丁的形式去混合图像,不会有图像混合后不自然的情形。
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Random Erasing
2+
3+
{cite:p}`zhong2017random`

0 commit comments

Comments
 (0)