Aliasing 이란??

이승화·2022년 3월 14일
0

stylegan3의 제목은 'Alias-Free Generative Adversarial Network'이다.
이 글은 aliasing이 무엇인지 알기 위한 지식들을 순서대로 기록했다.

In signal processing, aliasing is an effect that causes different signals to become indistinguishable when sampled. It also often refers to the distortion or artifact that results when a signal reconstructed from samples is different from the original continuous signal.

위키피디아의 정의에 따르면 신호처리의 과정에서 샘플링을 할때 어떠한 연유로 인해 왜곡이 생겨 원본과 다른것을 aliasing 이라고 두루뭉실하게 이해했다.

1. Signal Processing

In signal processing, a signal is a function that conveys information about a phenomenon

즉 signal은 정보를 갖는 모든 것들을 말한다. (소리, 사진, 영상..)
그리고 signal을 input으로 받아 분석,가공해 output을 내는 것이 system이다.

가장 기본적으로 1D signal인 음성을 예로 들어보자.

가로축은 시간, 세로축은 크기로 signal을 표현하는 방법중 하나인 time domain에서의 표현이다.
이런 time domain에서의 signal processing의 여러개의 소리 signal을 합성할 수 있다.
3명이 각자 집에서 피아노, 바이올린, 첼로를 녹음해 time domain에서 합치면 합주가 완성된다.
피아노 소리를 크게 하고 싶으면 피아노 signal에 amplitude를 높이면 되고 비올라를 추후에 넣을 수도 있다.
여기서 만약 바이올린에 원치않는 노이즈가 섞여 있으면 문제가 발생한다. time domain에서는 바이올린 소리와 노이즈를 따로 분리할 수 없다. 그래서 등장한 것이 frequency domain이다.
frequency는 signal이 얼마나 빠르게 바뀌는 지를 뜻한다.
time과 frequency는 역관계를 갖는데 time-domain에서 폭이 좁으면 그만큼 signal이 빠르게
바뀌는 것을 뜻하여 frequency는 크게 된다.

frequency domain에서는 time domain에서 한 파동으로 표현된 바이올린과 노이즈를 쉽게 구분할 수 있다. frequency가 다르기 때문에 바이올린 frequency만 살려서 다시 time domain으로 보내면 문제를 해결 할 수 있는 것이다.

그렇다면 time domain과 frequency domain을 왔다갔다 해주는 것은 무엇일까?
그것은 바로 Fourier Transformation이다.

fourier transformation을 설명하기 전에 time domain에서 중요한 개념 몇개를 설명하고 넘어간다.

  1. unit impulse
    continuous time domain의 경우
    discrete time domain의 경우

unit impulse의 중요한 점은 sifting property 이다.

δ(xy)f(x)dx=f(y)\int_{-\infty}^{\infty} \delta(x-y)f(x) dx = f(y)
  1. LTI system
    Linear Time-invariant systme을 뜻한다.
    linear은 말 그대로 vector space와 같은 특징이고
    time invariant는 x(t)가 input으로 들어가면 똑같은 시점인 y(t)가 ouput으로 나오는 것이다.

  2. Impulse response (h(t))
    Impulse response는 LTI system에 unit inpulse를 input으로 넣었을때 나온 output을 말한다. 정의보다 중요한 것은 아래 성질로

Since the impulse function contains all frequencies, the impulse response defines the response of a linear time-invariant system for all frequencies.

unit impulse 를 frequency domain에서 보면 constant function이다. 이는 모든 frequency를 갖고있다고 생각할 수 있다.

Any system in a large class known as linear, time-invariant (LTI) is completely characterized by its impulse response. That is, for any input, the output can be calculated in terms of the input and the impulse response.

따라서 black-box인 system에 x(t)의 output은

x(t)h(t)x(t)*h(t)

처럼 x(t)와 impulse response를 convolution하면 알 수 있다.

2. Fourier series to Fourier Transform

위에서 말한 time-domain에서 frequency-domain으로 넘어가게 해주는 Fourier transform을 알기 위해서 먼저 Fourier series를 설명한다.

In mathematics, a Fourier series is a periodic function composed of harmonically related sinusoids combined by a weighted summation.

f(x)=a0+n=1Nakcos(nx)+bksin(nx)f(x) = a_0 + \sum_{n=1}^{N}{a_{k} cos(nx) +b_k sin(nx)}

즉 fourier series는 주기함수를 sin과 cos의 가중합으로 표현하는 것을 말한다.

특징으로는 basis인 sin(nx)와 cos(nx)들이 orthogonal basis라는 것이다.
여기에 오일러 식을 적용하면,

f(x)=n=NNcnexp(inx)f(x) = \sum_{n=-N}^{N} c_n exp(inx)

가 나온다.

ck=1Tf(x)exp(inx)dxc_k = \frac{1}{T} \int f(x) exp(-inx) dx

cos, sin, exp의 n은 서로다른 frequency를 뜻한다.

Fourier Transform은 periodic function만 가능했던 fourier series를 non-periodic function까지 확장하는 것이다. 확장하는 방법은 간단하다. non-periodic function의 주기 T를 무한대라고 가정하고 fourier series를 적용하면 된다.

X(w)=x(t)eiwtdtX(w) = \int x(t)e^{iwt}dt
x(t)=12πX(w)eiwtdwx(t) = \frac{1}{2\pi}\int X(w)e^{-iwt}dw

fourier transform 을 적용하면 time-domain과 frequency-domain 의 변환을 알 수 있다.
여기서는 aliasing을 이해하기 위해 sampling과 관련된 변환만을 살펴본다.

Fourier transform of convolution is multiplication.
Fourier transform of impulse train is impulse train.

먼저 sampling의 개념은 다음과 같다.

sampling is the reduction of a continuous-time signal to a discrete-time signal. A common example is the conversion of a sound wave to a sequence of "samples".

sampling을 하는 이유는 정보의 손실 없이 저장량을 줄일 수 있기 때문이다.
즉 특정 조건하에서, 변환한 discrete signal을 정보의 손실없이 다시 continuous signal로 복원할 수 있다는 것이다. 이를 위한 최소의 sampling rate가 nyquist rate이다.

과정을 간단히 설명하면 다음과 같다.
1. time-domain에서 sampling은 signal을 sampling time T 간격인 impulse train과 곱한다.
2. 1을 fourier transform하면 frequency domain에서 각각의 fourier transform 을 convolution한다.
impulse train의 fourier transform은 impulse train임으로 convolution의 결과는 fourier transform된 signal을 일정 간격으로 복사한 것이다.
3. continuous signal을 복원하기 위해 frequency domain에서 low-pass filtering을 적용한다.
이때 signal의 maximum frequency가 sampling rate의 절반보다 작아야 한다. 그렇지 않으면 frequency domain에서 복사된 signal사이에 곂침이 발생하는데 이것이 continuous signal로 복원됐을때 발생하는 것이 aliasing이다.

번외) wavelet transform, laplace transform

fourier transform을 공부하다가 부가적으로 알게된 것들이다.
둘다 fourier transform의 확장이라고 볼 수 있다.

먼저 wavelet은 fourier transform의 정보의 한계를 보완하는 방법이다. time-domain에서 fourier transform을 적용하면 특정 frequency가 어떤 time에 발생했는지는 알 수가 없다.

이를 해결하기 위해 기존에 basis로 사용했던 sin, cos대신 다양한 wavelet함수를 사용한다.
이 wavelet함수의 특징은 sin, cos과 달리 localized 돼있다.
parameter로 scale, location parameter가 존재해 각 time-zone에 맞게 조절된다.

다음으로 laplace transform은 fourier transform에서 signal이 양/음 무한대로 갈때 0으로 수렴하지 않는 함수를 fourier transform하는 변환이다.

L{f}(s)=0f(t)estdtL\{f\}(s) = \int_{0}^{\infty} f(t) e^{-st} dt

기존 함수 f(t)에 exp(-st), step function H(t)를 곱해 각각 양의 무한대, 음의 무한대로 갈때 0으로 수렴하게 만든 뒤 fourier transform을 적용하는 것이다.

0개의 댓글