์ด ๊ธ€์€ ์ •๋ฆฌ๋ฅผ ์œ„ํ•ด ๊ฐœ์ธ์ ์ธ ์šฉ๋„๋กœ ์ž‘์„ฑ๋œ ํฌ์ŠคํŠธ์ž…๋‹ˆ๋‹ค. ์ง€์ ๊ณผ ์กฐ์–ธ์€ ์–ธ์ œ๋‚˜ ํ™˜์˜์ž…๋‹ˆ๋‹ค ใ…Žใ…Ž

3 minute read

์ด ๊ธ€์€ ์ •๋ฆฌ๋ฅผ ์œ„ํ•ด ๊ฐœ์ธ์ ์ธ ์šฉ๋„๋กœ ์ž‘์„ฑ๋œ ํฌ์ŠคํŠธ์ž…๋‹ˆ๋‹ค. ์ง€์ ๊ณผ ์กฐ์–ธ์€ ์–ธ์ œ๋‚˜ ํ™˜์˜์ž…๋‹ˆ๋‹ค ใ…Žใ…Ž



Aliasing์ด๋ž€?

Aliasing์€ ์ปดํ“จํ„ฐ ๊ทธ๋ž˜ํ”ฝ์—์„œ ๋ฌผ์ฒด์˜ ๊ฐ€์žฅ์ž๋ฆฌ ๋ถ€๋ถ„์ด ๋งค๋„๋Ÿฝ์ง€ ์•Š๊ณ  ๊ณ„๋‹จ์ฒ˜๋Ÿผ ๋ณด์ด๋Š” ํ˜„์ƒ์„ ๋งํ•œ๋‹ค.

Aliasing ํ˜„์ƒ์€ ๊ทธ๋ฆผ์˜ ๊ฐ€์žฅ์ž๋ฆฌ์—์„œ ๊ฐ€์žฅ ์‹ฌํ•˜๊ฒŒ ๋ถ€๊ฐ๋œ๋‹ค.

์ด๋Ÿฐ Aliasing์„ ์ฒ˜๋ฆฌํ•˜๊ธฐ ์œ„ํ•ด Anti-Aliasing ๊ธฐ๋ฒ•์„ ์‚ฌ์šฉํ•˜๊ฒŒ ๋œ๋‹ค.

์ผ๋ฐ˜์ ์œผ๋กœ๋Š” ๊ณ„๋‹จ์˜ ์‚ฌ์ด์‚ฌ์ด ํ”ฝ์…€์— โ€œ๊ทธ๋ฆผ์˜ ๊ฐ€์žฅ์ž๋ฆฌ ์ƒ‰๊ณผ ๋ฐฐ๊ฒฝ๊ฐ’์˜ ์ค‘๊ฐ„๊ฐ’โ€์„ ๋ถ€์—ฌํ•˜๋Š” ๋ฐฉ์‹์„ ์‚ฌ์šฉํ•œ๋‹ค.

๋‹ค๋งŒ, Anti-Aliasing์„ ์ ์šฉํ•˜๊ฒŒ ๋˜๋ฉด, ๋ชจ์„œ๋ฆฌ๋Š” ๋งค๋„๋Ÿฌ์›Œ์ง€์ง€๋งŒ, ๊ทธ๋งŒํผ ์ถ”๊ฐ€์ ์ธ ์ปดํ“จํŒ… ์—ฐ์‚ฐ์„ ์š”๊ตฌํ•œ๋‹ค.


Aliasing์„ ์ข€๋” formalํ•˜๊ฒŒ ์ •์˜ํ•œ ๊ฒƒ์€ ์•„๋ž˜์™€ ๊ฐ™๋‹ค.

๋””์ง€ํ„ธ ์ƒ˜ํ”Œ๋ง์—์„œ (์ƒ˜ํ”Œ๋ง ์ฃผํŒŒ์ˆ˜)๊ฐ€ (์›๋ณธ ์‹ ํ˜ธ์˜ ์ตœ๋Œ€ ์ฃผํŒŒ์ˆ˜)์˜ 2๋ฐฐ ๋ณด๋‹ค ๋‚ฎ์€ ๊ฒฝ์šฐ, ์ธ์ ‘ํ•œ ์ŠคํŽ™ํŠธ๋Ÿผ์ด ๊ฒน์ณ์„œ ์ถœ๋ ฅ์ด ์™œ๊ณก๋˜๋Š” ํ˜„์ƒ

โ€œFor a given sampling frequency, the maximum frequency you can accurately represent without aliasing is the Nyquist frequency. The Nyquist frequency equals one-half the sampling frequency, as shown by the following equation.โ€

\[f_N = \frac{f_s}{2}\]

์‚ฌ์‹ค ์ปดํ“จํ„ฐ ๊ทธ๋ž˜ํ”ฝ์Šค์—์„œ ๋ฐœ์ƒํ•˜๋Š” Aliasing์€ limited granularity์— ์˜ํ•ด ๋ฐœ์ƒํ•œ๋‹ค.

โ€œDigital imprecision generated in the process of converting analog information into digital space is due to the limited granularity of digital numbering space. In computer graphics, aliasing is seen as pixelation.โ€

- from Wikipedia

Digital Artifact

โ€œDigital Artifact is any undesired or unintended alteration in data introduced in a digital process.โ€

Aliasing๋ฅผ ์ด๋Ÿฐ Artifact์— ์˜ํ•œ ํ˜„์ƒ ์ค‘ ํ•˜๋‚˜๋กœ ๊ฐ„์ฃผํ•œ๋‹ค.

Anti-Aliasing

Anti-Aliasing์€ ๊ณ„๋‹จํ˜„์ƒ์ธ Aliasing์„ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•œ ๋ฐฉ๋ฒ•์ด๋‹ค.

Anti-Aliasing์€ ์œ„ ์‚ฌ์ง„์ฒ˜๋Ÿผ ๊ฐ™์€ ํƒ€์ผ์ด ์ˆ˜์—…์ด ๋ฐ˜๋ณต๋˜๋Š” ๊ฒƒ์„ ๋ฉ€๋ฆฌ์„œ ๋ฐ”๋ผ๋ณผ ๋•Œ, ํฐ ํšจ๊ณผ๋ฅผ ๋ณผ ์ˆ˜ ์žˆ๋‹ค.

๊ฐ€์žฅ ์™ผ์ชฝ์ด Anti-Aliasing์„ ์ ์šฉํ•˜์ง€ ์•Š์•˜์„ ๋•Œ๊ณ , ๊ฐ€์šด๋ฐ์™€ ์šฐ์ธก์˜ ๊ทธ๋ฆผ์ด Anti-Aliasing์„ ์ ์šฉํ•œ ๊ทธ๋ฆผ์ด๋‹ค.

Anti-Aliasing Filter (AAF)

๊ฒฐ๊ตญ ์ด๋ฏธ์ง€ ๊ด€์ ์—์„œ ๋ฐœ์ƒํ•˜๋Š” Aliasing ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๋ ค๋ฉด, ์ค‘๊ฐ„๊ฐ’์„ ์ทจํ•˜๋Š” ๊ฒƒ๊ณผ ๊ฐ™์ด bluring ์ž‘์—…์ด ํ•„์š”ํ•˜๋‹ค.

๊ฐ€์žฅ ๊ฐ„๋‹จํ•œ ๋ฐฉ๋ฒ•์œผ๋กœ๋Š” ๊ณ„๋‹จ ํ˜„์ƒ์„ ์™„ํ™”ํ•  ๋ถ€๋ถ„์— Gaussian Kernel์„ ์ ์šฉํ•˜๋Š” ๊ฒƒ์ด๋‹ค.

Image from here

์ฐธ๊ณ ๋กœ 2D Filter๋Š” ๋‘ ๊ฐœ์˜ 1D Filter๋กœ ๋ถ„ํ•ด ๊ฐ€๋Šฅํ•˜๋‹ค.

๊ทธ๋ž˜์„œ (2D Filter๋ฅผ ํ•œ๋ฒˆ ์ ์šฉ)ํ•˜๋Š” ๊ฒƒ๊ณผ (1D Filter๋ฅผ ๋‘๋ฒˆ ์ ์šฉ)ํ•˜๋Š” ๊ฒƒ์€ ๊ฐ™์€ ๊ฒฐ๊ณผ๋ฅผ ๋ฑ‰๋Š”๋‹ค.

์ฐธ๊ณ ๋กœ Anti-Aliasing Filter(AAF)๋‚˜ Low-pass Filter(LPF)๋‚˜ blur Filter๋‚˜ ๋ชจ๋‘ ๋™์ผํ•œ ๋ง์ด๋‹ค.

torchvision.transform.GaussianBlue()

code-level์—์„œ๋Š” ์ด๋ฏธ์ง€๋ฅผ ์–ด๋–ป๊ฒŒ Bluring ํ•  ์ˆ˜ ์žˆ๋Š”์ง€ ์‚ดํŽด๋ณด์ž.

PyTorch์—์„œ๋Š” Gaussian Blur๋ฅผ ํ•  ์ˆ˜ ์žˆ๋Š” transform์„ ์ œ๊ณตํ•œ๋‹ค.

๊ทธ๋ž˜์„œ torch.utils.data.Dataset์„ ์ •์˜ํ•  ๋•Œ, transform ํ•ญ๋ชฉ์˜ ์ธ์ž๋กœ GaussianBlur()๋ฅผ ๋„˜๊ธธ ์ˆ˜ ์žˆ๋‹ค.

torchvision.transform.GaussianBlur(kernel_size, sigma=(0.1, 2.0))

- PyTorch doc/GaussianBlur()