แ„‚ ๐Ÿ˜„ [21 ์ผ์ฐจ] : EXPLORATION 7. ์ธ๋ฌผ์‚ฌ์ง„์„ ๋งŒ๋“ค๊ธฐ

๋ฐฑ๊ฑดยท2022๋…„ 1์›” 25์ผ
0

์‚ฌ์ง„ ์กฐ์ •ํ•˜๊ธฐ

์šฉ์–ด์ •๋ฆฌ

  • ์–•์€ ํ”ผ์‚ฌ๊ณ„ ์‹ฌ๋„(shallow depth of field : DOF) :์…ธ๋กœ์šฐ ํฌ์ปค์Šค(shallow focus)
    - ๋ฐฐ๊ฒฝ์„ ํ๋ฆฌ๊ฒŒ ํ•˜๋Š” ๊ธฐ์ˆ 

๋ฐ์ดํ„ฐ ์ค€๋น„ํ•˜๊ธฐ

  1. ๋ฐฐ๊ฒฝ์ด ์žˆ๋Š” ์…€์นด๋ฅผ ์ดฌ์˜ํ•ฉ๋‹ˆ๋‹ค. (๋ฐฐ๊ฒฝ๊ณผ ์‚ฌ๋žŒ์˜ ๊ฑฐ๋ฆฌ๊ฐ€ ์•ฝ๊ฐ„ ๋ฉ€๋ฆฌ ์žˆ์œผ๋ฉด ์ข‹์Šต๋‹ˆ๋‹ค.)
  2. ์‹œ๋งจํ‹ฑ ์„ธ๊ทธ๋ฉ˜ํ…Œ์ด์…˜(Semantic segmentation)์œผ๋กœ ํ”ผ์‚ฌ์ฒด(์‚ฌ๋žŒ)์™€ ๋ฐฐ๊ฒฝ์„ ๋ถ„๋ฆฌํ•ฉ๋‹ˆ๋‹ค.
  3. ๋ธ”๋Ÿฌ๋ง(blurring) ๊ธฐ์ˆ ๋กœ ๋ฐฐ๊ฒฝ์„ ํ๋ฆฌ๊ฒŒ ํ•ฉ๋‹ˆ๋‹ค.
  4. ํ”ผ์‚ฌ์ฒด๋ฅผ ๋ฐฐ๊ฒฝ์˜ ์›๋ž˜ ์œ„์น˜์— ํ•ฉ์„ฑํ•ฉ๋‹ˆ๋‹ค.

์ด๋ฏธ์ง€์—์„œ ๋ฐฐ๊ฒฝ๊ณผ ์‚ฌ๋žŒ ๋ถ„๋ฆฌํ•˜๊ธฐ

import os
import urllib
import cv2
import numpy as np
from pixellib.semantic import semantic_segmentation
from matplotlib import pyplot as plt

print('์Š=3')
  • urllib๋Š” ์›น์—์„œ ๋ฐ์ดํ„ฐ๋ฅผ ๋‹ค์šด๋กœ๋“œํ•  ๋•Œ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
  • cv2๋Š” OpenCV ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋กœ ์ด๋ฏธ์ง€๋ฅผ ์ฒ˜๋ฆฌํ•˜๊ธฐ ์œ„ํ•ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.
  • pixellib๋Š” ์‹œ๋งจํ‹ฑ ์„ธ๊ทธ๋ฉ˜ํ…Œ์ด์…˜์„ ํŽธํ•˜๊ฒŒ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ
# ๋ณธ์ธ์ด ์„ ํƒํ•œ ์ด๋ฏธ์ง€์˜ ๊ฒฝ๋กœ์— ๋งž๊ฒŒ ๋ฐ”๊ฟ” ์ฃผ์„ธ์š”.
img_path = '.human_segmentation/images/my_image.png'  
img_orig = cv2.imread(img_path) 

print(img_orig.shape)
plt.imshow(cv2.cvtColor(img_orig, cv2.COLOR_BGR2RGB))
plt.show()

Image Segmentation (์ด๋ฏธ์ง€ ์„ธ๊ทธ๋ฉ˜ํ…Œ์ด์…˜)

  • ์ด๋ฏธ์ง€์—์„œ ํ”ฝ์…€ ๋‹จ์œ„๋กœ ๊ด€์‹ฌ ๊ฐ์ฒด๋ฅผ ์ถ”์ถœํ•˜๋Š” ๋ฐฉ๋ฒ•

์‹œ๋งจํ‹ฑ ์„ธ๊ทธ๋ฉ˜ํ…Œ์ด์…˜(semantic segmentation)

  • ๋ฌผ๋ฆฌ์  ์˜๋ฏธ ๋‹จ์œ„๋กœ ์ธ์‹ํ•˜๋Š” ์„ธ๊ทธ๋ฉ˜ํ…Œ์ด์…˜
  • ์ด๋ฏธ์ง€์—์„œ ํ”ฝ์…€์„ ์‚ฌ๋žŒ, ์ž๋™์ฐจ, ๋น„ํ–‰๊ธฐ ๋“ฑ์˜ ๋ฌผ๋ฆฌ์  ๋‹จ์œ„๋กœ ๋ถ„๋ฅ˜(classification)ํ•˜๋Š” ๋ฐฉ๋ฒ•
  • ์‹œ๋งจํ‹ฑ ์„ธ๊ทธ๋ฉ˜ํ…Œ์ด์…˜์€ '์‚ฌ๋žŒ'์ด๋ผ๋Š” ์ถ”์ƒ์ ์ธ ์ •๋ณด๋ฅผ ์ด๋ฏธ์ง€์—์„œ ์ถ”์ถœํ•ด ๋‚ด๋Š” ๋ฐฉ๋ฒ•

์ธ์Šคํ„ด์Šค ์„ธ๊ทธ๋ฉ˜ํ…Œ์ด์…˜(Instance segmentation)

  • ์ธ์Šคํ„ด์Šค ์„ธ๊ทธ๋ฉ˜ํ…Œ์ด์…˜์€ ์‚ฌ๋žŒ ๊ฐœ๊ฐœ์ธ๋ณ„๋กœ ๋‹ค๋ฅธ ๋ผ๋ฒจ์„ ๊ฐ€์ง€๊ฒŒ
  • ์—ฌ๋Ÿฌ ์‚ฌ๋žŒ์ด ํ•œ ์ด๋ฏธ์ง€์— ๋“ฑ์žฅํ•  ๋•Œ ๊ฐ ๊ฐ์ฒด๋ฅผ ๋ถ„ํ• ํ•ด์„œ ์ธ์‹ํ•˜์ž๋Š” ๊ฒƒ์ด ๋ชฉํ‘œ

CFCF ๋”ฅ๋Ÿฌ๋‹์ด์ „์˜ ์ด๋ฏธ์ง€ ์„ธ๊ทธ๋ฉ˜ํ…Œ์ด์…˜ ๋ฐฉ๋ฒ•

  • ์›Œํ„ฐ์‰๋“œ ์„ธ๊ทธ๋ฉ˜ํ…Œ์ด์…˜(watershed segmentation)
    - ์ด๋ฏธ์ง€์—์„œ ์˜์—ญ์„ ๋ถ„ํ• ํ•˜๋Š” ๊ฐ€์žฅ ๊ฐ„๋‹จํ•œ ๋ฐฉ๋ฒ•์€ ๋ฌผ์ฒด์˜ '๊ฒฝ๊ณ„'๋ฅผ ๋‚˜๋ˆ„๋Š” ๊ฒƒ
    - ์ด๋ฏธ์ง€๋Š” ๊ทธ๋ ˆ์ด์Šค์ผ€์ผ(grayscale)๋กœ ๋ณ€ํ™˜ํ•˜๋ฉด 0~255์˜ ๊ฐ’
    • ํ”ฝ์…€ ๊ฐ’์„ ์ด์šฉํ•ด์„œ ๊ฐ ์œ„์น˜์˜ ๋†’๊ณ  ๋‚ฎ์Œ์„ ๊ตฌ๋ถ„
    • ๋‚ฎ์€ ๋ถ€๋ถ„๋ถ€ํ„ฐ ์„œ์„œํžˆ '๋ฌผ'์„ ์ฑ„์›Œ ๋‚˜๊ฐ„๋‹ค๊ณ  ์ƒ๊ฐํ•˜๋ฉด ๊ฐ ์˜์—ญ์—์„œ ์ ์  ๋ฌผ์ด ์ฐจ์˜ค๋ฅด๋‹ค๊ฐ€ ๋„˜์น˜๋Š” ์‹œ์ 
    • ๊ทธ ๋ถ€๋ถ„์„ ๊ฒฝ๊ณ„์„ ์œผ๋กœ ๋งŒ๋“ค๋ฉด ๋ฌผ์ฒด๋ฅผ ์„œ๋กœ ๊ตฌ๋ถ„

opencv-python tutorial

DeepLab ์„ธ๊ทธ๋ฉ˜ํ…Œ์ด์…˜ ๋ชจ๋ธ

DeepLab V3+: Encoder-Decoder with Atrous Separable Convolution for Semantic Image Segmentation

  • DeepLab์—์„œ atrous convolution์„ ์‚ฌ์šฉํ•œ ์ด์œ 
    - receptive field๋ฅผ ๋„“๊ฒŒ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉ
    • ์ ์€ ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ ํ•„ํ„ฐ๊ฐ€ ๋” ๋„“์€ ์˜์—ญ์„ ๋ณด๊ฒŒ ํ•˜๊ธฐ ์œ„ํ•ด
  • Depthwise separable convolution
    - 3x3 conv layer ์˜ receptive field๋ฅผ 1/9 ์ˆ˜์ค€์˜ ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ ๊ตฌํ˜„ํ•  ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ํšจ์œจ์ 

DeepLab ๋ชจ๋ธ์„ ์ค€๋น„

  • PixelLib๋ฅผ ์ด์šฉํ•˜๋ฉด ํŽธํ•˜๊ฒŒ ์‚ฌ์šฉ

PixelLib์—์„œ ์ œ๊ณตํ•ด ์ฃผ๋Š” ๋ชจ๋ธ์„ ๋‹ค์šด๋กœ๋“œ

# ์ €์žฅํ•  ํŒŒ์ผ ์ด๋ฆ„์„ ๊ฒฐ์ •ํ•ฉ๋‹ˆ๋‹ค
model_dir = os.getenv('HOME')+'/aiffel/human_segmentation/models'
model_file = os.path.join(model_dir, 'deeplabv3_xception_tf_dim_ordering_tf_kernels.h5')

# PixelLib๊ฐ€ ์ œ๊ณตํ•˜๋Š” ๋ชจ๋ธ์˜ url์ž…๋‹ˆ๋‹ค
model_url = 'https://github.com/ayoolaolafenwa/PixelLib/releases/download/1.1/deeplabv3_xception_tf_dim_ordering_tf_kernels.h5'

# ๋‹ค์šด๋กœ๋“œ๋ฅผ ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค
urllib.request.urlretrieve(model_url, model_file)

๋‹ค์šด๋กœ๋“œํ•œ ๋ชจ๋ธ์„ ์ด์šฉํ•ด PixelLib๋กœ ์šฐ๋ฆฌ๊ฐ€ ์‚ฌ์šฉํ•  ์„ธ๊ทธ๋ฉ˜ํ…Œ์ด์…˜ ๋ชจ๋ธ์„ ์ƒ์„ฑ

model = semantic_segmentation()
model.load_pascalvoc_model(model_file)

๋ชจ๋ธ์— ์ด๋ฏธ์ง€๋ฅผ ์ž…๋ ฅ

segvalues, output = model.segmentAsPascalvoc(img_path)
  • segmentAsPascalvoc๋ผ๋Š” ํ•จ์ˆ˜
    - PASCAL VOC ๋ฐ์ดํ„ฐ๋กœ ํ•™์Šต๋œ ๋ชจ๋ธ์„ ์ด์šฉํ•œ๋‹ค๋Š” ์˜๋ฏธ
  • PASCAL VOC ๋ฐ์ดํ„ฐ์˜ ๋ผ๋ฒจ ์ข…๋ฅ˜
LABEL_NAMES = [
    'background', 'aeroplane', 'bicycle', 'bird', 'boat', 'bottle', 'bus',
    'car', 'cat', 'chair', 'cow', 'diningtable', 'dog', 'horse', 'motorbike',
    'person', 'pottedplant', 'sheep', 'sofa', 'train', 'tv'
]
len(LABEL_NAMES)

21

background๋ฅผ ์ œ์™ธํ•˜๋ฉด 20๊ฐœ์˜ ํด๋ž˜์Šค
20 ์˜ ์˜๋ฏธ๋Š” tv

๋ชจ๋ธ์—์„œ ๋‚˜์˜จ ์ถœ๋ ฅ๊ฐ’ ํ™•์ธ

plt.imshow(output)
plt.show()

segvalues

{'class_ids': array([ 0, 9, 15]),
'masks': array([[False, False, False, ..., False, False, False],
[False, False, False, ..., False, False, False],
[False, False, False, ..., False, False, False],
...,
[False, False, False, ..., False, False, False],
[False, False, False, ..., False, False, False],
[False, False, False, ..., False, False, False]])}

for class_id in segvalues['class_ids']:
    print(LABEL_NAMES[class_id])

background
chair
person

  • output์—๋Š” ์„ธ๊ทธ๋ฉ˜ํ…Œ์ด์…˜์ด ๋œ ๊ฒฐ๊ณผ๊ฐ€ ๊ฐ๊ฐ ๋‹ค๋ฅธ ์ƒ‰์ƒ์œผ๋กœ ๋‹ด๊ฒจ ์žˆ์Œ
  • segvalues์—๋Š” class_ids์™€ masks๊ฐ€ ์žˆ์Œ
  • class_ids๋ฅผ ํ†ตํ•ด ์–ด๋–ค ๋ฌผ์ฒด๊ฐ€ ๋‹ด๊ฒจ ์žˆ๋Š”์ง€ ํ™•์ธ ๊ฐ€๋Šฅ

๋ฌผ์ฒด๋งˆ๋‹ค output์— ์–ด๋–ค ์ƒ‰์ƒ์œผ๋กœ ๋‚˜ํƒ€๋‚˜ ์žˆ๋Š”์ง€ ํ™•์ธ

# ์•„๋ž˜ ์ฝ”๋“œ๋ฅผ ์ดํ•ดํ•˜์ง€ ์•Š์•„๋„ ์ข‹์Šต๋‹ˆ๋‹ค
# PixelLib์—์„œ ๊ทธ๋Œ€๋กœ ๊ฐ€์ ธ์˜จ ์ฝ”๋“œ์ž…๋‹ˆ๋‹ค
# ์ฃผ๋ชฉํ•ด์•ผ ํ•  ๊ฒƒ์€ ์ƒ์ƒ ์ฝ”๋“œ ๊ฒฐ๊ณผ๋ฌผ์ด์˜ˆ์š”!
colormap = np.zeros((256, 3), dtype = int)
ind = np.arange(256, dtype=int)

for shift in reversed(range(8)):
    for channel in range(3):
        colormap[:, channel] |= ((ind >> channel) & 1) << shift
    ind >>= 3

colormap[:20]

array([[ 0, 0, 0],
[128, 0, 0],
[ 0, 128, 0],
[128, 128, 0],
[ 0, 0, 128],
[128, 0, 128],
[ 0, 128, 128],
[128, 128, 128],
[ 64, 0, 0],
[192, 0, 0],
[ 64, 128, 0],
[192, 128, 0],
[ 64, 0, 128],
[192, 0, 128],
[ 64, 128, 128],
[192, 128, 128],
[ 0, 64, 0],
[128, 64, 0],
[ 0, 192, 0],
[128, 192, 0]])

 

PixelLib์— ๋”ฐ๋ฅด๋ฉด ์œ„์™€ ๊ฐ™์€ ์ƒ‰์„ ์‚ฌ์šฉ

์‚ฌ๋žŒ์„ ๋‚˜ํƒ€๋‚ด๋Š” 15๋ฒˆ์งธ ์ƒ‰์ƒ์€

colormap[15]

array([192, 128, 128])

๋ฌผ์ฒด๋ฅผ ์ฐพ์•„๋‚ด๊ณ  ์‹ถ๋‹ค๋ฉด colormap[class_id] ์‚ฌ์šฉ

  • output ์ด๋ฏธ์ง€๊ฐ€ BGR ์ˆœ์„œ๋กœ ์ฑ„๋„ ๋ฐฐ์น˜๊ฐ€ ๋˜์–ด ์žˆ๋‹ค
  • colormap์€ RGB ์ˆœ์„œ

์ถ”์ถœํ•ด์•ผ ํ•˜๋Š” ์ƒ‰์ƒ ๊ฐ’์€ ์ˆœ์„œ๋ฅผ ์•„๋ž˜์ฒ˜๋Ÿผ ๋ฐ”๊ฟ” ์ค˜์•ผ

seg_color = (128,128,192)

seg_color๋กœ๋งŒ ์ด๋ฃจ์–ด์ง„ ๋งˆ์Šคํฌ๋ฅผ ๋งŒ๋“ค๊ธฐ

# output์˜ ํ”ฝ์…€ ๋ณ„๋กœ ์ƒ‰์ƒ์ด seg_color์™€ ๊ฐ™๋‹ค๋ฉด 1(True), ๋‹ค๋ฅด๋‹ค๋ฉด 0(False)์ด ๋ฉ๋‹ˆ๋‹ค
seg_map = np.all(output==seg_color, axis=-1)
print(seg_map.shape)
plt.imshow(seg_map, cmap='gray')
plt.show()

(731, 579)

  • 3์ฑ„๋„ ๊ฐ€์กŒ๋˜ ์›๋ณธ๊ณผ๋Š” ๋‹ค๋ฅด๊ฒŒ ์ฑ„๋„ ์ •๋ณด๊ฐ€ ์‚ฌ๋ผ์ง

๊ฒน์ณ์„œ ๋ณด๊ธฐ(์„ธ๊ทธ๋ฉ˜ํ…Œ์ด์…˜์ด ์ž˜๋˜์—ˆ๋Š”์ง€ ํ™•์ธ)

addWeighted
applyColorMap
img_show = img_orig.copy()

# True๊ณผ False์ธ ๊ฐ’์„ ๊ฐ๊ฐ 255๊ณผ 0์œผ๋กœ ๋ฐ”๊ฟ”์ค๋‹ˆ๋‹ค
img_mask = seg_map.astype(np.uint8) * 255

# 255์™€ 0์„ ์ ๋‹นํ•œ ์ƒ‰์ƒ์œผ๋กœ ๋ฐ”๊ฟ”๋ด…๋‹ˆ๋‹ค
color_mask = cv2.applyColorMap(img_mask, cv2.COLORMAP_JET)

# ์›๋ณธ ์ด๋ฏธ์ง€์™€ ๋งˆ์ŠคํŠธ๋ฅผ ์ ๋‹นํžˆ ํ•ฉ์ณ๋ด…๋‹ˆ๋‹ค
# 0.6๊ณผ 0.4๋Š” ๋‘ ์ด๋ฏธ์ง€๋ฅผ ์„ž๋Š” ๋น„์œจ์ž…๋‹ˆ๋‹ค.
img_show = cv2.addWeighted(img_show, 0.6, color_mask, 0.4, 0.0)

plt.imshow(cv2.cvtColor(img_show, cv2.COLOR_BGR2RGB))
plt.show()

์ž˜ ํ™•์ธ์ด ์•ˆ๋˜์„œ OCEAN์œผ๋กœ ๋ณ€๊ฒฝ

cfcf Colormap Types ๋ณ€๊ฒฝ

๋ฐฐ๊ฒฝ ํ๋ฆฌ๊ฒŒ

blur() ํ•จ์ˆ˜๋ฅผ ์ด์šฉ

# (13,13)์€ blurring kernel size๋ฅผ ๋œปํ•ฉ๋‹ˆ๋‹ค
# ๋‹ค์–‘ํ•˜๊ฒŒ ๋ฐ”๊ฟ”๋ณด์„ธ์š”
img_orig_blur = cv2.blur(img_orig, (13,13))  
plt.imshow(cv2.cvtColor(img_orig_blur, cv2.COLOR_BGR2RGB))
plt.show()

  • ํ๋ ค์ง„ ์ด๋ฏธ์ง€์—์„œ ๋ฐฐ๊ฒฝ๋งŒ ์ถ”์ถœ
img_mask_color = cv2.cvtColor(img_mask, cv2.COLOR_GRAY2BGR)
img_bg_mask = cv2.bitwise_not(img_mask_color)
img_bg_blur = cv2.bitwise_and(img_orig_blur, img_bg_mask)
plt.imshow(cv2.cvtColor(img_bg_blur, cv2.COLOR_BGR2RGB))
plt.show()

bitwise_not ํ•จ์ˆ˜๋ฅผ ์ด์šฉํ•˜๋ฉด ์ด๋ฏธ์ง€๊ฐ€ ๋ฐ˜์ „

  • ์›๋ž˜ ๋งˆ์Šคํฌ์—์„œ๋Š” ๋ฐฐ๊ฒฝ์ด 0, ์‚ฌ๋žŒ์ด 255
  • bitwise_not ์—ฐ์‚ฐ์„ ํ•˜๊ณ  ๋‚˜๋ฉด ๋ฐฐ๊ฒฝ์€ 255, ์‚ฌ๋žŒ์€ 0

    cfcf
    ๋ฐ˜์ „๋œ ์„ธ๊ทธ๋ฉ˜ํ…Œ์ด์…˜ ๊ฒฐ๊ณผ๋ฅผ ์ด์šฉํ•ด์„œ ์ด๋ฏธ์ง€์™€ bitwise_and ์—ฐ์‚ฐ์„ ์ˆ˜ํ–‰ํ•˜๋ฉด ๋ฐฐ๊ฒฝ๋งŒ ์žˆ๋Š” ์˜์ƒ์„ ์–ป์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. 0๊ณผ ์–ด๋–ค ์ˆ˜๋ฅผ bitwise_and ์—ฐ์‚ฐ์„ ํ•ด๋„ 0์ด ๋˜๊ธฐ ๋•Œ๋ฌธ์— ์‚ฌ๋žŒ์ด 0์ธ ๊ฒฝ์šฐ์—๋Š” ์‚ฌ๋žŒ์ด ์žˆ๋˜ ๋ชจ๋“  ํ”ฝ์…€์ด 0์ด ๋ฉ๋‹ˆ๋‹ค. ๊ฒฐ๊ตญ ์‚ฌ๋žŒ์ด ์‚ฌ๋ผ์ง€๊ฒŒ ๋˜๋Š” ๊ฑฐ์ฃ .

ํ๋ฆฐ ๋ฐฐ๊ฒฝ๊ณผ ์›๋ณธ ์˜์ƒ ํ•ฉ์„ฑ

img_concat = np.where(img_mask_color==255, img_orig, img_bg_blur)
plt.imshow(cv2.cvtColor(img_concat, cv2.COLOR_BGR2RGB))
plt.show()

์„ธ๊ทธ๋ฉ˜ํ…Œ์ด์…˜ ๋งˆ์Šคํฌ๊ฐ€ 255์ธ ๋ถ€๋ถ„๋งŒ ์›๋ณธ ์ด๋ฏธ์ง€ ๊ฐ’์„ ๊ฐ€์ง€๊ณ  ์˜ค๊ณ  ์•„๋‹Œ ์˜์—ญ์€ ๋ธ”๋Ÿฌ๋œ ์ด๋ฏธ์ง€ ๊ฐ’์„ ์‚ฌ์šฉ
np.where(์กฐ๊ฑด, ์ฐธ์ผ๋•Œ, ๊ฑฐ์ง“์ผ๋•Œ)์˜ ํ˜•์‹์˜ ์ฝ”๋“œ๋ฅผ ์‚ฌ์šฉ

numpy.where

๋น„๊ต

์›๋ณธ๋ณ€ํ™˜
  • ์ธ๋ฌผ๊ณผ ๋ฐฐ๊ฒฝ์˜ ๊ฑฐ๋ฆฌ ์ฐจ์ด๊ฐ€ ์žˆ๊ณ  ๊ฑฐ๋ฆฌ๊ฐ€ ์ผ์ •ํ• ์ˆ˜๋ก ๋” ์ž์—ฐ์Šค๋Ÿฌ์›Œ ๋ณด์ž„

๋ฌธ์ œ์  ์ฐพ๊ธฐ

STEP 1.

  • ์—ฌ๋Ÿฌ๋ถ„์˜ ์…€์นด๋ฅผ ์ด์šฉํ•ด์„œ ์˜ค๋Š˜ ๋ฐฐ์šด ๋‚ด์šฉ์„ ์ˆ˜ํ–‰ํ•ด ๋ด…์‹œ๋‹ค. ์•„๋ž˜์™€ ๊ฐ™์€ ์ด๋ฏธ์ง€๋ฅผ ์–ป์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์ตœ์†Œ 3์žฅ ์ด์ƒ์˜ ์ธ๋ฌผ๋ชจ๋“œ ์‚ฌ์ง„์„ ๋งŒ๋“ค์–ด ๋ด…์‹œ๋‹ค.
  • ์ธ๋ฌผ์ด ์ฃผ์ธ๊ณต์ด ์•„๋‹Œ, ๊ท€์—ฌ์šด ๊ณ ์–‘์ด์— ๋Œ€ํ•œ ์•„์›ƒํฌ์ปค์‹ฑ ์‚ฌ์ง„๋„ ๋งŒ๋“ค์–ด ๋ณผ ์ˆ˜ ์žˆ์„ ๊ฒƒ์ž…๋‹ˆ๋‹ค. ์‹œ๋งจํ‹ฑ ์„ธ๊ทธ๋ฉ˜ํ…Œ์ด์…˜ ์Šคํ…์—์„œ ํžŒํŠธ๋ฅผ ์ฐพ์•„๋ด…์‹œ๋‹ค.
  • ๋ฐฐ๊ฒฝ์„ blurํ•˜๋Š” ์ธ๋ฌผ๋ชจ๋“œ ์‚ฌ์ง„์ด ์•„๋‹ˆ๋ผ ๋ฐฐ๊ฒฝ์‚ฌ์ง„์„ ๋‹ค๋ฅธ ์ด๋ฏธ์ง€๋กœ ๊ต์ฒดํ•˜๋Š” ํฌ๋กœ๋งˆํ‚ค ๋ฐฐ๊ฒฝ ํ•ฉ์„ฑ์„ ์‹œ๋„ํ•ด ๋ณผ ์ˆ˜๋„ ์žˆ์„ ๊ฒƒ์ž…๋‹ˆ๋‹ค. ์—ฌ๋Ÿฌ๋ถ„๋งŒ์˜ ํ™˜์ƒ์ ์ธ ์‚ฌ์ง„์„ ๋งŒ๋“ค์–ด ๋ณด๋ฉด ์–ด๋–จ๊นŒ์š”?

STEP 2.

  • ์ธ๋ฌผ ์˜์—ญ์— ํฌํ•จ๋˜์–ด blur๋˜์ง€ ์•Š๊ณ  ๋‚˜์˜จ๋‹ค
  • ์ธ๋ฌผ ๋ชจ๋“œ ์‚ฌ์ง„ ์ค‘ ํ•˜๋‚˜์—์„œ๋„ ์ด์ƒํ•œ ์œ„์น˜๋ฅผ ์ฐพ์•„ ํ‘œ์‹œ

STEP 3. ์†”๋ฃจ์…˜ ์ œ์•ˆ

  • ์„ ํƒํ•œ ๊ธฐ์ˆ ์ด DeepLab ๋ชจ๋ธ์˜ Semantic Segmentation ์ด ๋งŒ๋“ค์–ด ๋‚ธ Mask ์˜์—ญ์— ์–ด๋–ป๊ฒŒ ์ ์šฉ๋˜์–ด ๋ฌธ์ œ์ ์„ ๋ณด์™„ํ•˜๊ฒŒ ๋˜๋Š”์ง€์˜ ๋ฉ”์ปค๋‹ˆ์ฆ˜์ด ํฌํ•จ๋œ ์†”๋ฃจ์…˜

์„ธ๊ทธ๋ฉ˜ํ…Œ์ด์…˜์˜ ํ•œ๊ณ„

  • Semantic segmentation์˜ ๋ถ€์ •ํ™•์„ฑ์ด ์—ฌ๋Ÿฌ ๊ฐ€์ง€ ๋ฌธ์ œ๋ฅผ ๋ฐœ์ƒ์‹œํ‚ค๋Š” ์ฃผ์š” ์›์ธ
  • ํ”ผ์‚ฌ๊ณ„์‹ฌ๋„๋ฅผ ์ด์šฉํ•œ ๋ณด์ผ€(์•„์›ƒํฌ์ปค์‹ฑ) ํšจ๊ณผ๋Š” ๋ง ๊ทธ๋Œ€๋กœ ์‹ฌ๋„๋ฅผ ํ‘œํ˜„ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์ดˆ์ ์ด ์žกํžŒ ๊ฑฐ๋ฆฌ๋ฅผ ๊ด‘ํ•™์ ์œผ๋กœ ์•„์ฃผ ์„ฌ์„ธํ•˜๊ฒŒ ๊ตฌ๋ณ„(segmentation)
  • ์ด๋ฅผ ๋ชจ๋ฐฉํ•œ semantic segmentation ๋ชจ๋“ˆ์€ ์ •ํ™•๋„๊ฐ€ 1.00 ์ด ๋˜์ง€ ์•Š๋Š” ํ•œ ์™„๋ฒฝํžˆ ๊ตฌํ˜„ํ•˜๊ธฐ ์–ด๋ ค์›€

ํ”ผ์‚ฌ๊ณ„ ์‹ฌ๋„ ์ดํ•ด.

3D Camera ํ™œ์šฉ

์†Œํ”„ํŠธ์›จ์–ด ๊ธฐ์ˆ  ํ™œ์šฉํ•˜๊ธฐ

๋‹ค๋ฅธ ๊ธฐ์ˆ ๊ณผ ์œตํ•ฉ

  • ๋ฌผ์ฒด์˜ ์˜จ๋„๋ฅผ ์ธก์ •ํ•˜๋Š” IR ์นด๋ฉ”๋ผ์™€ 3D ์ด๋ฏธ์ง€
  • ์ด๋ฅผ ํ†ตํ•ด ๋ณด๋‹ค ๋ฉ‹์ง„ 3d depth sensing์ด ๊ฐ€๋Šฅ
    uDepth: Real-time 3D Depth Sensing on the Pixel 4

Reference

Segmetation ์ฐธ๊ณ ์ž๋ฃŒ

profile
๋งˆ์ผ€ํŒ…์„ ์œ„ํ•œ ์ธ๊ณต์ง€๋Šฅ ์„ค๊ณ„์™€ ์Šคํƒ€ํŠธ์—… Log

0๊ฐœ์˜ ๋Œ“๊ธ€