Machine Learning, Deep Learning

Data augmentation: color jitter

n.han 2021. 4. 18. 17:41

Color jitter

Data augmentation은 데이터의 크기를 키우기 위해 데이터에 여러 조작을 하는 행위들을 말합니다. 본 포스트는 data augmentation 기법 중 color jitter에 대한 글 입니다.

jitter란 약간의 불규칙한 움직임, 변형, 그리고 불안정을 의미합니다.

Jitter


color jitter은 이미지 data augmentation 기법의 하나로, 이미지의 Lightness, Hue 그리고 saturation 등을 임의로 변하는 것을 의미합니다.

Manipulations of the hue, saturation and value (brighness) aspects of the image.

Color jitter 방법 중 색의 주요한 세 속성인 HSL(Hue(색상), Saturation(채도), Lightness(명도))을 임의로 변경하는 방법에 대하여 예를 들어보겠습니다.

HSL (hue, saturation, lightness)

HSL (Hue, Saturation, Lightness)은 RGB 색 모델의 다른 표현 방법입니다. 원기둥이 모태인 곡면기하형 색 구조를 하고 있는데, 명도, 채도는 직선이고 색도는 원형을 띠고 있습니다.

HSL 모델

Hue (색상)은 색상을 의미하는 것으로, 원기둥을 기반으로 한 HSL의 각을 담당합니다. 0도는 빨간색, 120도는 초록색, 그리고 240도는 파란색을 나타냅니다. 0 ~ 360(도)의 값을 가집니다.

Hue 깂 변화에 따른 색상 변화

Saturation (채도) 색이 보다 선명할수록 채도가 높다고 말하며 회색이나 흰색 또는 검정과 같은 무채색에 가까울수록 채도가 낮다고 말합니다. 채도가 높은 색을 말할 때는 흔히 '짙다'고 표현하고, 반대로 채도가 낮은 색을 말할 때는 흔히 '흐리다'는 표현을 사용합니다. 0 ~ 100% 사이의 값을 가집니다.

채도 값 변화에 따른 색의 변화. S가 0으로 갈수록 점점 흐려지는 모습을 알 수 있음.

Lightness은 그 뜻처럼 색의 밝기를 의미합니다. 0 ~ 100%의 값을 가집니다.

Brightness 변화에 따른 색의 변화.

Converting RGB into HSL, HSL into RGB

대부분의 이미지들은 RGB로 표현되어 있습니다. 따라서 HSL를 통해 Color jitter을 하기 위해서는 RGB 코드를 HSL로 변경하고, HSL 값들을 약간 변경한 후에 다시 RGB로 변경하는 것 입니다. RGB를 HSL로 변경하는 것은 다음 식을 활용하면 됩니다.

RGB to HSL
HSL to RGB

다음은 HSL과 RGB 간 변환의 예시입니다.

References

https://docs.nvidia.com/deeplearning/dali/user-guide/docs/examples/image_processing/hsv_example.html

en.wikipedia.org/wiki/Color_appearance_model#Color_appearance_parameters

 

Color appearance model - Wikipedia

From Wikipedia, the free encyclopedia Jump to navigation Jump to search Any mathematical model describing human perception of colors A color appearance model (CAM) is a mathematical model that seeks to describe the perceptual aspects of human color vision,

en.wikipedia.org

en.wikipedia.org/wiki/Hue

 

Hue - Wikipedia

From Wikipedia, the free encyclopedia Jump to navigation Jump to search Property of a color indicating balance of color perceived by the normal human eye All colors on this color wheel should appear to have the same lightness and the same saturation, diffe

en.wikipedia.org

en.wikipedia.org/wiki/HSL_and_HSV

 

HSL and HSV - Wikipedia

From Wikipedia, the free encyclopedia Jump to navigation Jump to search Alternative representations of the RGB color model HSL (hue, saturation, lightness) and HSV (hue, saturation, value, also known as HSB or hue, saturation, brightness) are alternative r

en.wikipedia.org

namu.wiki/w/HSV#s-3

 

HSV - 나무위키

이 저작물은 CC BY-NC-SA 2.0 KR에 따라 이용할 수 있습니다. (단, 라이선스가 명시된 일부 문서 및 삽화 제외) 기여하신 문서의 저작권은 각 기여자에게 있으며, 각 기여자는 기여하신 부분의 저작권

namu.wiki

en.wikipedia.org/wiki/Lightness

 

Lightness - Wikipedia

Property of a color Three hues in the Munsell color model. Each color differs in value from top to bottom in equal perception steps. The right column undergoes a dramatic change in perceived color. In colorimetry and color theory, lightness, also known as

en.wikipedia.org

www.rapidtables.com/convert/color/rgb-to-hsl.html