๐งญ AI Study - ์ปดํจํฐ ๋น์
๐ฉ ์ฃผ์ : Image Segmentation
๐งฉ 2023 OUTTA AI ๋ถํธ์บ ํ ๋ฅ๋ฌ๋๋ฐ Lecture 6
2023 OUTTA AI ๋ถํธ์บ ํ์ ์ฐธ์ฌํ๋ฉฐ, ๊ฐ์๋ก ์๊ฐํ ์ฃผ์ ์ธ Image Segmentation์ ๋ด์ฉ์ ๋ํด ๋ค์ ์ ๋ฆฌํด๋ณด์๋ค.
์ด๋ฏธ์ง๋ ํฝ์ ๋ก ์ด๋ฃจ์ด์ง๋ค. ์ปดํจํฐ๋น์ ๋ถ์ผ์์ Segmentation์ ์ด๋ฏธ์ง์ ๋ชจ๋ ํฝ์ ์ class ํน์ ๊ฐ์ฒด๋ก ๋ถ๋ฅ ๋ฐ ํ์ง๋ฅผ ํ๋ task๋ฅผ ๋งํ๋ค. ๊ฐ ํฝ์ ์ label์ ํ ๋นํ์ฌ ๋ชจ๋ ํฝ์ ์ด ์ฌ๋ฐ๋ฅธ class ํน์ object์ ์ํ๋๋ก ๋ถ๋ฅํ๋ค. ์ด๋ฌํ ๋ถ๋ฅ๋ฅผ ํตํด ํฝ์ ๊ณผ label์ ์ฐ๊ฒฐํ segment map์ด ์์ฑ๋๋ค.
Image Classification vs Image Segmentation
- Image Classification : ์ด๋ฏธ์ง ์ ์ฒด๊ฐ ์ด๋ค label ํน์ class์ ์ํ๋์ง ๋ถ๋ฅํ๋ task์ด๋ค. ์๋ฅผ ๋ค์ด ๊ณ ์์ด ์ฌ์ง์ด ์์ ๋ ๊ทธ๊ฒ์ด ๊ณ ์์ด๊ฐ ๋ง๋์ง ์๋์ง ๋ถ๋ฅํ๋ ์์ ์ด๋ค.
- Image Segmentation : ์ด๋ฏธ์ง ๋ด์ ์ด๋ค ํฝ์ ์ด ์ด๋ค ์ข ๋ฅ์ object ํน์ class์ ์ํ๋์ง ๋ผ๋ฒจ๋งํ๋ค. ์๋ฅผ ๋ค์ด ์๋์ฐจ์ ์ฌ๋์ด ์๋ ์ด๋ฏธ์ง๊ฐ ์์ ๋ ์ด๋ฏธ์ง์์ ์๋์ฐจ์ ์ฌ๋์ด ์๋ ํฝ์ ์ ๋ถ๋ฅํด ๋ด๋ ์์ ์ด๋ค.
Image Segmentation์ ์ข ๋ฅ๋ Sementic Segmentation๊ณผ Instance Segmentation์ด ์๋ค. Sementic Segmentation์ class๋ ๊ตฌ๋ณํ์ง๋ง ๊ฐ์ class๋ด์ ์ํ๋ instance๋ฅผ ๋ถ๋ฅํ์ง๋ ์๋๋ค. Instance Segmentation์ class์ instance๋ฅผ ๋ถ๋ฅํ๋ค.
++ ์ ์ด๋ฏธ์ง ์ถ๊ฐ ์ค๋ช
Classification + Localization
์ด๋ฏธ์ง ๋ด์์ ๊ฐ์ฒด์ class๋ฅผ ๋ถ๋ฅํ๊ณ ํด๋น ๊ฐ์ฒด๊ฐ ์ด๋ฏธ์ง์ ์ด๋ ๋ถ๋ถ์ ์์นํ๋์ง๋ฅผ ๋ํ๋ด๋ bounding box๋ฅผ ์์ฑํ๋ ๊ฒ์ด๋ค. ์ด๋ ๊ฐ์ฒด๋ ํ ์ข
๋ฅ์ ๊ฐ์ฒด์ผ ๊ฒฝ์ฐ์๋ง ์ํ์ด ๊ฐ๋ฅํ๋ค.
Object Detection
์ด๋ฏธ์ง ๋ด์์ ๊ฐ์ฒด์ class๋ฅผ ๋ถ๋ฅํ๊ณ ํด๋น ๊ฐ์ฒด์ ์์น๋ฅผ ์ฐพ์ ์ ์๋ค. ์ด๋ ์ฌ๋ฌ ๊ฐ์ฒด๊ฐ ์๋ค๋ฉด ๊ฐ์ฒด์ ์ข
๋ฅ๊น์ง ๋ถ๋ฅํ ์ ์๋ค.
Sementic Segmentation์ ์ํํ๋ ค๋ฉด ์ด๋ป๊ฒ ํด์ผํ ๊น? ๋ชจ๋ ํฝ์
์ ๋ถ๋ฅํ๋ ๋ชจ๋ธ์ ์ฌ์ฉํ ์ ์์ ๊ฒ์ด๋ค. ๊ทธ๋ฌ๋ ์ด๋ฌํ ๋ฐฉ๋ฒ์ ์ฐ์ฐ์ ํ์๊ฐ ๋๋ฌด ๋ง์์ ธ์ ๋นํจ์จ์ ์ด๋ค. ๊ทธ๋์ Bilinear Interpolation์ ์ฌ์ฉํ๋ค.
์ฌ๊ธฐ์ Interpolation์ด๋ ์๋ ค์ง ๊ฐ์ ์ด์ฉํ์ฌ ๋ค๋ฅธ ๊ฐ์ ์ถ์ ํ๋ ๊ฒ์ด๋ค. ์ด๋ฅผ Segmentation์ ์ ์ฉํ๋ฉด, ํน์ ํฝ์
์ ํ์ตํ๊ณ ํ์ต๋์ง ์์ ํฝ์
๋ค์ ๋ณด๊ฐ๋ฒ์ผ๋ก ๊ฐ์ ์ถ์ ํ๋ ๋ฐฉ์์ ์ฌ์ฉํ ์ ์๋ค. ๋ณด๊ฐ๋ฒ์ ์ฌ์ฉํ๋ฉด ์ฐ์ฐ๋๊ณผ ํ์ต์๊ฐ์ ์ค์ผ ์ ์์ด์ ํจ์จ์ ์ด๋ค.
Linear Interpolation
https://ko.wikipedia.org/wiki/%EC%84%A0%ED%98%95_%EB%B3%B4%EA%B0%84%EB%B2%95
Bilinear Interpolation
https://en.wikipedia.org/wiki/Bilinear_interpolation
๋ชจ๋ธ์ ๋ง์ง๋ง Layer์ Fully Connected Layer๋ฅผ ์ฌ์ฉํ๋ฉด Tensor๋ฅผ 1์ฐจ์ ๋ฒกํฐ๋ก Flatten ํด์ผํ๊ธฐ ๋๋ฌธ์ Object์ ์์น์ ๋ณด๋ฅผ ์๊ฒ๋๋ค. ๋ฐ๋ผ์ VGG, Resnet ๋ฑ์ Fully Connected Layer๋ฅผ ์ฌ์ฉํ๋ Classification ๋ชจ๋ธ์ Sementic Segmentation์ ์ ํฉํ์ง ์๋ค.
์์น์ ๋ณด ์์ค๋ฌธ์ ๋ฅผ ๊ทน๋ณตํ๊ธฐ ์ํด Downsampling(์ธ์ฝ๋)๊ณผ Upsampling(๋์ฝ๋) ๊ธฐ์ ์ ํ์ฉํ๋ค. Downsampling์ ์ ๋ ฅ๋ฐ์ ์ด๋ฏธ์ง ๋ฐ์ดํฐ์ ์ฐจ์์ ๋ฒกํฐ๋ก ์ค์ด๋ ๊ณผ์ ์ผ๋ก, Convolution๊ณผ Pooling์ ์ฌ์ฉํ๋ค. Upsampling์ Downsampling์ผ๋ก ์ค์ด๋ ๋ฐ์ดํฐ์ ์ฐจ์์ ๋ค์ ์๋ํฌ๊ธฐ๋ก ํ์ฅํ๋ ๊ณผ์ ์ผ๋ก, Transpose Convolution์ ์ฌ์ฉํ๋ค.
Downsampling, Upsampling ๊ตฌ์กฐ๋ฅผ ์ฌ์ฉํ๋ ๋ชจ๋ธ์ FCN, DeepLab, U-Net์ด ์๋ค.
Transpose Convolution
Transpose Convolution์ ์ฌ์ฉํ๋ฉด ์์ ์ฌ์ด์ฆ์ input ๋ฐ์ดํฐ์ ํฌ๊ธฐ๋ฅผ ๋๋ฆด ์ ์๋ค. ์๋ ์์ ์ฒ๋ผ input์ ํ ํฝ์
๊ณผ kernel์ ๊ฐ์ ๊ณฑํ๊ณ ๊ฒฐ๊ณผ๋ฅผ ๋ํด์ ์ฐจ์์ ๋๋ฆฌ๋ ๋ฐฉ์์ด๋ค.
https://d2l.ai/chapter_computer-vision/transposed-conv.html
https://medium.com/@mohit_gaikwad/overview-fully-convolutional-network-for-semantic-segmentation-b4ef92eeb8c4
AlexNet, VGG16 ๋ฑ์ CNN๊ธฐ๋ฐ ๋ชจ๋ธ์์ Sementic Segmentation์ ์ํด ๋ณํ์ํจ ๋ชจ๋ธ์ด๋ค. ํน์ง์ ์๋์ ๊ฐ์ด ์ ๋ฆฌํ ์ ์๋ค.
Transfer Learning
Transfer Learning(์ ์ด ํ์ต)์ ์ด๋ค ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๊ธฐ ์ํด ์ฌ์ฉํ ๋คํธ์ํฌ๋ฅผ ๋ค๋ฅธ task ๋ฐ ๋ฐ์ดํฐ์ ์ ์์์ ์ผ๋ก ์ฌ์ฌ์ฉํ๋ ํ์ต ๋ฐฉ๋ฒ์ด๋ค. ์ ์ดํ์ต์ ์ํํ๋ฉด ์ด์ ์ ๋น์ทํ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๊ธฐ ์ํด ์ฌ์ฉํ ๋ชจ๋ธ์ ํจํด ๋ฑ์ ์ฌ์ฌ์ฉํ ์ ์๊ธฐ ๋๋ฌธ์ ์๋์ ์ ํ๋๋ฅผ ๋์ผ ์ ์๋ค.
Skip Connection
๋ฎ์ layer์ ๋งต์ upsamplingํ ๋ ๊ฒฐํฉํด์ ์์ค๋ ์ ๋ณด๋ฅผ ๋ณต๊ตฌํ๋ ๋ฐฉ์์ด๋ค.
https://tjmachinelearning.com/lectures/1718/fcn/
https://medium.com/@mohit_gaikwad/overview-fully-convolutional-network-for-semantic-segmentation-b4ef92eeb8c4
์ฐธ๊ณ ์๋ฃ
image task ์ข ๋ฅ
image classification
image segmentation
segmentation
Interpolation
Linear Interpolation
Transpose Convolution
Transfer Learning1
Transfer Learning2
Transfer Learning3
Skip Connection
๊ธ ์ ๋ดค์ต๋๋ค, ๊ฐ์ฌํฉ๋๋ค.