Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Data augmentation plays a crucial role in enhancing the performance and generali

Augmented data is created by applying modifications such as geometric and color space transformations to existing data, thereby enriching the original dataset with varied forms. Conversely, synthetic data is entirely new and generated from scratch using advanced techniques like Deep Neural Networks (DNNs) and Generative Adversarial Networks (GANs), adding further diversity and volume to the dataset. Both methods significantly expand the quantity and variety of data available for training machine learning models. Data augmentation is applicable not only to images but also to audio, video, text, and other data types. This is good for scenarios with limited training data. It enhances model accuracy, prevents overfitting, and reduces costs associated with data labelling and cleaning. However, challenges such as the persistence of original dataset biases and the high cost of quality assurance remain.

In practice, data augmentation techniques vary across data types. For audio, this includes noise injection and pitch adjustments; for text, methods like word shuffling and syntax-tree manipulation are used. Image augmentation involves transformations like flipping, cropping, and applying kernel filters. Advanced techniques like Neural Style Transfer and the use of GANs for new data point generation further extend its capabilities. These methods are instrumental in fields like healthcare for medical imaging, self-driving cars using synthetic data, and natural language processing, particularly in low-resource language scenarios. Specific image augmentation practices, such as random rotations, brightness adjustments, shifts, flips, and zoom, are implemented using tools like Pytorch, Augmentor, Albumentations, Imgaug, and OpenCV. These tools facilitate a range of augmentations, from Gaussian noise to perspective skewing, catering to diverse machine learning needs.
In practice, data augmentation techniques vary across data types. For audio, this includes noise injection and pitch adjustments; for text, methods like word shuffling and syntax-tree manipulation are used. Image augmentation involves transformations like flipping, cropping, and applying kernel filters. Advanced techniques like Neural Style Transfer and the use of GANs for new data point generation further extend its capabilities. These methods are instrumental in fields like healthcare for medical imaging, self-driving cars using synthetic data, and natural language processing, particularly in low-resource language scenarios. Specific image augmentation practices, such as random rotations, brightness adjustments, shifts, flips, and zoom, are implemented using tools like PyTorch, Augmentor, Albumentations, Imgaug, and OpenCV. These tools facilitate a range of augmentations, from Gaussian noise to perspective skewing, catering to diverse machine learning needs.

The significance of data augmentation becomes particularly evident in the context of image classification with CNNs. Standardized datasets, often used in initial CNN training, set high expectations due to their ample sample sizes and resultant model accuracy. However, when these models are applied to real-world problems, a gap in performance is frequently observed, underscoring the need for more extensive and varied data. Data augmentation addresses this gap by multiplying the number of images in a dataset, potentially by significant factors, without the need for additional data collection. This not only increases dataset size but also introduces variability, enhancing the robustness of the training process. By implementing batch-wise augmentation during model training, it also conserves disk space, as there's no need to store transformed images.

Expand Down
8 changes: 4 additions & 4 deletions chapters/en/unit8/terminologies/linear-algebra.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ Most three-dimensional data consists of objects such as points which have a defi

However, various systems have different conventions for this coordinate system. The most important difference is handedness, which is the relative orientation of the X, Y and Z axes. The easiest way to remember the difference is to point your middle finger inwards, such that your thumb, index, and middle fingers are roughly at right angles to each other. On your left hand, your thumb (X), index finger (Y), and middle finger (Z) form a left-handed coordinate system. Similarly, the fingers of your right hand make a right-handed coordinate system.

In mathematics and physics, a right-handed system is usually used. However, in computer graphics, different libraries and environments have different conventions. Notably, Blender, Pytorch3d and OpenGL (mostly) use right-handed coordinates, whilst DirectX uses left-handed coordinates.Here we will use the right-handed convention, following Blender and NerfStudio.
In mathematics and physics, a right-handed system is usually used. However, in computer graphics, different libraries and environments have different conventions. Notably, Blender, PyTorch3D and OpenGL (mostly) use right-handed coordinates, whilst DirectX uses left-handed coordinates.Here we will use the right-handed convention, following Blender and NerfStudio.

## Transformations

It is useful to be able to rotate, scale, and translate these coordinates in space. For example, if an object is moving, or if we want to change these coordinates from world coordinates relative to some fixed set of axes, to coordinates relative to our camera.

These transformations can be represented by matrices. Here we'll use `@` to denote matrix multiplication. To allow us to represent translation, rotation and scaling in a consistent manner, we take the three dimensional coordinates \\([x,y,z]\\), and add an extra coordinate \\(w=1\\). These are known as homogeneous coordinates - more generally, \\(w\\) can take any value, and all points on the four-dimensional line \\([wx, wy, wz, w]\\) correspond to the same point \\([x,y,z]\\) in three-dimensional space. However, here, \\(w\\) will always be 1.

Libraries such as [Pytorch3d](https://pytorch3d.org/) provide a range of functions for generating and manipulating transformations.
Libraries such as [PyTorch3D](https://pytorch3d.org/) provide a range of functions for generating and manipulating transformations.

Yet another convention to note - OpenGL treats positions as column vectors `x` (of shape 4x1), and applies a transformation `M` by pre-multiplying the vector by the matrix (`M @ x`), whereas DirectX and Pytorch3d consider positions as row vectors of shape (1x4), and apply a transformation by post-multiplying the vector by the matrix ( `x @ M` ). To convert between the two conventions we need to take the transpose of the matrix `M.T`. We will show how a cube transforms under different transformation matrices in a few code snippets. For these code snippets, we will use the OpenGL convention.
Yet another convention to note - OpenGL treats positions as column vectors `x` (of shape 4x1), and applies a transformation `M` by pre-multiplying the vector by the matrix (`M @ x`), whereas DirectX and PyTorch3D consider positions as row vectors of shape (1x4), and apply a transformation by post-multiplying the vector by the matrix ( `x @ M` ). To convert between the two conventions we need to take the transpose of the matrix `M.T`. We will show how a cube transforms under different transformation matrices in a few code snippets. For these code snippets, we will use the OpenGL convention.

### Translations

Expand Down Expand Up @@ -137,7 +137,7 @@ The output should look something like this:

### Rotations

Rotations around an axis are another commonly used transformation. There are a number of different ways of representing rotations, including Euler angles and quaternions, which can be very useful in some applications. Again, libraries such as Pytorch3d include a wide range of functionalities for performing rotations. However, as a simple example, we will just show how to construct rotations about each of the three axes.
Rotations around an axis are another commonly used transformation. There are a number of different ways of representing rotations, including Euler angles and quaternions, which can be very useful in some applications. Again, libraries such as PyTorch3D include a wide range of functionalities for performing rotations. However, as a simple example, we will just show how to construct rotations about each of the three axes.

- Rotation around the X-axis:

Expand Down
2 changes: 1 addition & 1 deletion chapters/en/unit9/tools_and_frameworks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import torch.quantization
```
## Hands-on guide

For a hands-on guide on how to use the Pytorch Quantization, refer this [notebook](https://github.com/huggingface/computer-vision-course/blob/main/notebooks/Unit%209%20-%20Model%20Optimization/torch.ipynb)
For a hands-on guide on how to use the PyTorch Quantization, refer this [notebook](https://github.com/huggingface/computer-vision-course/blob/main/notebooks/Unit%209%20-%20Model%20Optimization/torch.ipynb)

## ONNX Runtime

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

增强数据通过对现有数据应用几何变换和颜色空间变换等修改手段来生成,从而以多种形式丰富原始数据集。与之相对,合成数据则是完全由先进技术,如深度神经网络 (DNN) 和生成对抗网络 (GAN),从零开始生成的新数据,进一步提升了数据集的多样性和规模。这两种方法均能显著扩展可用于训练机器学习模型的数据量和种类。数据增强技术不仅限于图像数据,同样适用于音频、视频、文本以及其他类型的数据。在训练数据受限的场景下,数据增强尤为重要。它可以有效提高模型精度,缓解过拟合问题,并降低数据标注和清洗的成本。然而,诸如原始数据集偏差的持续存在以及高质量保证的高成本等挑战依然存在。

在实践应用中,数据增强技术会根据不同的数据类型而有所差异。例如,对于音频数据,常用的增强方法包括噪声注入和音调调整;对于文本数据,则常采用词语shuffle和句法树操作等方法。图像增强则常涉及翻转、裁剪以及应用卷积核等变换操作。诸如神经风格迁移以及利用 GAN 生成新数据点等前沿技术,进一步拓展了数据增强的应用边界。这些方法在诸多领域都显示出其重要价值,例如医疗健康领域的医学影像分析、自动驾驶汽车的合成数据应用,以及自然语言处理领域,特别是在低资源语言场景下的应用。特定的图像增强实践,例如随机旋转、亮度调整、平移、翻转和缩放等,可以通过 Pytorch、Augmentor、Albumentations、Imgaug 和 OpenCV 等工具实现。这些工具提供了丰富的增强功能,从添加高斯噪声到透视畸变,能够满足各种机器学习应用的需求。
在实践应用中,数据增强技术会根据不同的数据类型而有所差异。例如,对于音频数据,常用的增强方法包括噪声注入和音调调整;对于文本数据,则常采用词语shuffle和句法树操作等方法。图像增强则常涉及翻转、裁剪以及应用卷积核等变换操作。诸如神经风格迁移以及利用 GAN 生成新数据点等前沿技术,进一步拓展了数据增强的应用边界。这些方法在诸多领域都显示出其重要价值,例如医疗健康领域的医学影像分析、自动驾驶汽车的合成数据应用,以及自然语言处理领域,特别是在低资源语言场景下的应用。特定的图像增强实践,例如随机旋转、亮度调整、平移、翻转和缩放等,可以通过 PyTorch、Augmentor、Albumentations、Imgaug 和 OpenCV 等工具实现。这些工具提供了丰富的增强功能,从添加高斯噪声到透视畸变,能够满足各种机器学习应用的需求。

在基于 CNN 的图像分类任务中,数据增强的重要性尤为突出。标准化数据集常被用于 CNN 的初始训练阶段,它们通常拥有充足的样本量和由此带来的高模型精度,因此为模型性能设定了较高的基准。然而,当这些模型被应用于解决现实世界问题时,性能会出现显著下降,这突显了对更广泛和多样化数据的迫切需求。数据增强技术通过成倍增加数据集中的图像数量(甚至可达数倍),而无需额外的数据采集工作,从而有效缓解了这一问题。这不仅扩大了数据集规模,更重要的是引入了数据变异性,从而显著增强了训练过程的鲁棒性。通过在模型训练过程中采用批量数据增强策略,还可以有效节省磁盘空间,因为无需预先存储所有变换后的图像。

Expand Down