A peak into Automatic Data Augmentation by Policy Searching

A peak into Automatic Data Augmentation by Policy Searching

기계학습(machine-learning, ML) 혹은 딥러닝(Deep-learning, DL) 기반으로 모델을 학습할 때 데이터 증강(data augmentation, DA)은 모델의 일반화(generalization) 성능과 좋은 Representation 학습에 있어 매우 중요한 기술입니다. 그러나 이는 주로 사람의 경험이나 직관에 크게 의존합니다. ML/DL community에서도 이러한 문제를 인식하고 효과적으로 Data augmentation을 자동으로 수행하기 위한 방법에 대해 고민해 왔습니다. 이번 글에서는 사람에 대한 의존성을 낮추고 Data augmentation을 보다 효과적으로 수행하기 위한 연구 중 하나로 탐색 기반 접근법인 Automatic augmentation policy searching에 대해 다루고자 합니다.

딥러닝에서 일반화

Deep Neural Network(DNN)은 매우 유연한 Universal function approximator입니다. 따라서 주어진 데이터 세트를 이용해 DNN 모델을 학습할 때 자주 과적합(overfitting) 되어버립니다. Overfitting이 일어나면 학습한 데이터 세트가 매우 우수할지라도 학습에 없었던 데이터 세트에 대해서는 성능이 잘 나오지 않게 됩니다. 이를 ‘일반화 성능이 좋지 못하다’라고 말하기도 합니다.

[그림1] 적절히 Fitting된 모델(좌)과 Overfitting된 모델(우) (출처: https://untitledtblog.tistory.com/158)

Over fitting이 일어나는 근본적인 이유는 DNN 모델의 Capacity가 일반적으로 주어지는 학습 데이터 세트에 비해 너무 크기 때문입니다. 이러한 경우 DNN은 단순히 학습 데이터들을 “외워”버리게 됩니다. 학습 데이터 세트가 작기 때문에 굳이 내제된 특징들을 배우려하지 않습니다. 따라서 조금만 다른 데이터가 들어오면 제대로 문제를 풀지 못하는 문제가 발생합니다. 때문에 DL 기반 학습 모델을 실제로 사용하기 위해서는 일반화가 매우 중요합니다. 이를 해결하기 위해 많은 연구가 진행되었고 기본적이지만 효과적인 방법이 바로 Data augmentation입니다.

딥러닝에 Data augmentation 적용

만약 데이터가 계속 주어진다면 Overfitting 문제는 발생하지 않습니다. 하지만 이는 실제로 불가능하죠. 무한히 많은 데이터를 얻는 대신 주어진 데이터를 적절히 부풀려서 학습에 사용하는 접근법이 바로 Data augmentation입니다. [그림2]와 같이 한 장의 코알라 사진만으로도 수없이 많은 유사 이미지를 생성할 수 있습니다. DNN에게 이렇게 Augmentation된 수많은 코알라 이미지들을 분류하도록 학습시키면 이들로부터 공통된 특성을 찾고 학습하게 됩니다. 이로서 DNN은 단순히 데이터를 외우는 것이 아니라 데이터 세트에 내재된 특징을 학습하고 Overfitting을 피할 수 있습니다.

[그림2] Data augmentation 예시 (출처: https://github.com/aleju/imgaug)

그렇다면 Data augmentation을 무작정해서 모델을 학습시키면 무조건 Overfitting을 막을 수 있을까요? 당연히 그렇지 않습니다. 너무 과한 Data augmentation은 데이터가 원래 갖고 있던 특성을 파괴시켜 오히려 모델에 혼란만 가중시킬 수 있습니다. Task에 잘 맞는 적절한 Augmentation은 무엇일까요? 정확히 정의하는 것은 불가능할 것 같습니다. Data augmentation은 거의 무조건 사용하는 중요하고 기본적인 기법이지만 실제 적용할 때에는 “적당한” Augmenting operation을 위해 사람의 직관과 경험에 의존할 수밖에 없습니다.

Automatic date augmentation

여기서 “적당한”의 범위를 찾는 문제가 바로 Automatic data augmentation입니다. 관련 연구는 크게 네 가지로 분류할 수 있습니다. 이 중에서 Augmentation에 속하는 두 가지 분류에 대해 소개하고자 합니다.

Data Augmentation

Single operation

  • Manually designed single operation: 엔지니어의 직관과 경험으로 설계Automatically designed single operation:
  • Augmentation network를 두고 엔지니어는 loss function만 정의해서 네트워크가 스스로 augmentation 학습

Combination of operation (Augmentation policy)

  • Manually designed augmentation policy: 엔지니어 직접 hand tunning
  • undefined

먼저 Automatically designed single operation은 엔지니어의 직관이나 경험에 의해 설계된 것이 아닌 Augmentation을 위한 Augmentation network(DNN)를 따로 두고, 엔지니어는 단지 DNN을 학습하기 위한 적절한 목표(objective function or loss function)만 정해주는 것입니다. DNN 스스로 좋은 Augmentation을 만들어 Augmenting operator가 되도록 학습시키는 방식입니다.

Automatic augmentation policy searching은 Augmenting operation을 조합하는 정책을 탐색한다는 의미입니다. 데이터 세트와 Task가 주어졌을 때 DNN 없이 기존에 있는 Augmenting operation(rotation, invert, shearing, color jittering, cutout 등)들을 어떻게 조합하면 최적의 Augmentation이 가능한지 자동으로 탐색하는 방식입니다. Automatic augmentation policy searching에 관한 연구로는 다음 논문을 참고할 수 있습니다.

AutoAugment (CVPR 2019)

Fast AutoAugment (NeurlPS 2019)

Fast AutoAugment

Data augmentation is an essential technique for improving generalization ability of deep learning models. Recently, AutoAugment has been proposed as an algorithm to automatically search for augmentation policies from a dataset and has significantly enhanced performances on many image recognition tasks. However, its search method requires thousands of GPU hours even for a relatively small dataset. In this paper, we propose an algorithm called Fast AutoAugment that finds effective augmentation policies via a more efficient search strategy based on density matching. In comparison to AutoAugment, the proposed algorithm speeds up the search time by orders of magnitude while achieves comparable performances on image recognition tasks with various models and datasets including CIFAR-10, CIFAR-100, SVHN, and ImageNet.

https://arxiv.org/abs/1905.00397

Population based augmentation: Efficient learning of augmentation policy schedule (ICML 2019)

Population Based Augmentation: Efficient Learning of Augmentation Policy Schedules

A key challenge in leveraging data augmentation for neural network training is choosing an effective augmentation policy from a large search space of candidate operations. Properly chosen augmentation policies can lead to significant generalization improvements; however, state-of-the-art approaches such as AutoAugment are computationally infeasible to run for the ordinary user. In this paper, we introduce a new data augmentation algorithm, Population Based Augmentation (PBA), which generates nonstationary augmentation policy schedules instead of a fixed augmentation policy. We show that PBA can match the performance of AutoAugment on CIFAR-10, CIFAR-100, and SVHN, with three orders of magnitude less overall compute. On CIFAR-10 we achieve a mean test error of 1.46%, which is a slight improvement upon the current state-of-the-art. The code for PBA is open source and is available at https://github.com/arcelien/pba.

https://arxiv.org/abs/1905.05393

DADA: Differentiable automatic data augmentation (ECCV 2020)

DADA: Differentiable Automatic Data Augmentation

Data augmentation (DA) techniques aim to increase data variability, and thus train deep networks with better generalisation. The pioneering AutoAugment automated the search for optimal DA policies with reinforcement learning. However, AutoAugment is extremely computationally expensive, limiting its wide applicability. Followup works such as Population Based Augmentation (PBA) and Fast AutoAugment improved efficiency, but their optimization speed remains a bottleneck. In this paper, we propose Differentiable Automatic Data Augmentation (DADA) which dramatically reduces the cost. DADA relaxes the discrete DA policy selection to a differentiable optimization problem via Gumbel-Softmax. In addition, we introduce an unbiased gradient estimator, RELAX, leading to an efficient and effective one-pass optimization strategy to learn an efficient and accurate DA policy. We conduct extensive experiments on CIFAR-10, CIFAR-100, SVHN, and ImageNet datasets. Furthermore, we demonstrate the value of Auto DA in pre-training for downstream detection problems. Results show our DADA is at least one order of magnitude faster than the state-of-the-art while achieving very comparable accuracy. The code is available at https://github.com/VDIGPKU/DADA.

https://arxiv.org/abs/2003.03780

RandAugment: Practical automated data augmentation with a reduced search space (NeurlPS 2020)

이번 글에서는 DL에서 Data augmentation 기법의 중요성과 한계점을 알아보고 이를 풀기 위한 방법론으로 Automatic data augmentation 분야 중 Automatic augmentation policy searching에 대해 소개했습니다. 소개한 연구들이 이미지 데이터에 국한되어 있다고 생각하지 않기 때문에 다른 데이터에 대해서는 어떤 식으로 적용되는지 알아보고, Automatic data augmentation 방법론에 포함시킬 수 있을지에 대해 고찰해 보는 것도 필요하다고 생각합니다.

관련기사