seoulsky-field / CXRAIL-dev

CXRAIL-dev
MIT License
7 stars 0 forks source link

Features: Implement augmentation #23

Open kdg1993 opened 1 year ago

kdg1993 commented 1 year ago

What

Implement user-friendly & basic image augmentation

Why

How

kdg1993 commented 1 year ago

So far, I think two strategies, auto augmentation & random augmentation, seem nice to try first

First of the two, auto augmentation looks nice but it is slightly different from what I expected

I referred

For implementation, torchvision's AutoAugment or Albumentation's AutoAlbument look great to be to try first

kdg1993 commented 1 year ago

After briefly searching the AutoAlbument, (the AutoML tools for auto-augmentation of albumentations, https://albumentations.ai/docs/autoalbument/) my mind became conservative about using the AutoAlbument

Before listing up the key points that changed my mind, it would be better to introduce the pros of AutoAlbument

Despite these nice advantages above, there are two obstacles that made me conservative to use it

  1. So far, AutoAlbument not supports multilabel problem (they support classification and segmentation
  2. The AutoAlbument is implemented in pl-hydra format

Solving (1) might be possible by customizing the github code but it is hard to deny this is a time-consuming and difficult task Thus, it should be very carefully compared between the difficulty of customizing AutoAlbument and its necessity for our purpose

(2) seems more complicated than (1) to me. Pl-hydra format makes AutoAlbument more user-friendly but since our code set also uses hydra, I can not guarantee it will make some conflict when we mix AutoAlbument in our code set Thus, even if we divide searching best augmentation policy by the AutoAlbument & model training by our code set, the reliability of the suggestion that the found policy is not sub-optimal will rapidly disappear with a small difference between augmentation settings and model training settings For example, the best augmentation policy by AutoAlbument for 100% CheXpert with resnet50 can not guarantee it is still best for 30% MIMIC with SWIN model

Additionally, searching best augmentation has an intrinsic problem in that it is a very cost-expensive task Given that intrinsic problem, finding the best augmentation uses sampling, sub-policy strategy, and some assumptions

Thus, discuss best vs moderate augmentation in terms of the task's cost, difficulty, and necessity will be needed soon

kdg1993 commented 1 year ago

I suggest the RandAugment instead of the Albumentations' AutoAlbument as the next job

In my point of view, RandAugment (RA) is quite simple but persuasive & the paper compares other popular automatic augmentation algorithms AutoAugment (AA), Fast AutoAugment (FAA), and Population-Based Augmentation (PBA) very well

Before diving into the RA, I referred to this paper (https://arxiv.org/pdf/1909.13719v2.pdf) and got a lot of insight from it I recommend this paper not only to understand the RA but also to get insight into popular augmentation automatization strategies

The first key point : Simplicity

The second key point : Weak Assumption

image (Figure.3 from the RA paper)