이미지 기초(Image Fundamentals) — 픽셀, 채널, 색 공간

이미지는 빛의 표본(sample)으로 이루어진 텐서(tensor)입니다. 앞으로 사용할 모든 비전 모델(vision model)은 이 사실에서 출발합니다.

유형: Build 언어: Python 선수 학습: Phase 1 Lesson 12 Tensor Operations, Phase 3 Lesson 11 Intro to PyTorch 소요 시간: 약 45분

학습 목표

  • 연속적인 장면(scene)이 어떻게 픽셀(pixel)로 이산화(discretization)되는지, 표본화(sampling)와 양자화(quantization)가 이후 모델 성능의 상한을 어떻게 정하는지 설명합니다.
  • 이미지를 NumPy 배열(array)로 읽고, 잘라서(slice) 검사하며 HWC와 CHW 레이아웃(layout)을 자유롭게 오갑니다.
  • RGB, 그레이스케일(grayscale), HSV, YCbCr 사이를 변환하고 각 색 공간(color space)이 왜 존재하는지 설명합니다.
  • torchvision이 기대하는 방식으로 픽셀 수준 전처리(pixel-level preprocessing; 정규화·표준화·크기 조정·채널 우선 배치)를 정확히 적용합니다.

문제

논문, 사전 학습 가중치(pretrained weight), 비전 API는 모두 입력 이미지의 특정 인코딩(encoding)을 가정합니다. 모델이 float32를 기대하는데 uint8 이미지를 넣어도 실행은 될 수 있습니다. 하지만 결과는 조용히 망가집니다. RGB로 학습한 신경망(network)에 BGR을 넣으면 정확도(accuracy)가 크게 떨어질 수 있고, 채널 우선(channels-first) 배치를 기대하는 모델에 채널 마지막(channels-last) 입력을 넣으면 첫 합성곱 층(convolution layer)이 높이(height)를 채널처럼 해석합니다.

문제는 "이미지"라는 말이 카메라(camera), JPEG 디코더(decoder), PIL, OpenCV, torchvision, CUDA 커널(kernel)에서 조금씩 다르다는 점입니다. 각 스택(stack)은 축 순서(axis order), 바이트 범위(byte range), 채널 규약(channel convention)이 다릅니다. 비전 파이프라인(vision pipeline)을 제대로 만들려면 이 차이를 정확히 다뤄야 합니다.

이 lesson은 Phase 4의 기반입니다. 픽셀이 무엇인지, 왜 픽셀마다 세 숫자가 있는지, "ImageNet 통계로 정규화한다"는 말이 실제로 무엇을 하는지, 다른 lesson들이 가정할 레이아웃 사이를 어떻게 오가는지 다룹니다.

사전 테스트

2문제 · 이 강의를 시작하기 전에 얼마나 알고 있는지 확인해보세요

1.디스크의 파일을 디코딩(decode)했더니 모양(shape)이 (224, 224, 3)이고 자료형(dtype)이 uint8인 NumPy 배열이 나왔습니다. 각 숫자는 무엇을 의미합니까?

2.Pillow로 이미지를 읽어 모양 (480, 640, 3)의 배열을 얻었습니다. 이것을 배치 텐서 (1, 480, 640, 3)로 만들어 in_channels=3인 PyTorch Conv2d에 넣으면 어떻게 됩니까?

0/2 답변 완료

개념

전체 전처리 파이프라인(preprocessing pipeline)

실제 운영(production) 환경의 비전 시스템은 대체로 같은 순서의 변환을 거칩니다. 한 단계만 어긋나도 모델은 학습 때와 다른 입력을 보게 됩니다.

flowchart LR
    A["Image file<br/>(JPEG/PNG)"] --> B["Decode<br/>uint8 HWC"]
    B --> C["Convert<br/>colorspace<br/>(RGB/BGR/YCbCr)"]
    C --> D["Resize<br/>shorter side"]
    D --> E["Center crop<br/>model size"]
    E --> F["Divide by 255<br/>float32 [0,1]"]
    F --> G["Subtract mean<br/>Divide by std"]
    G --> H["Transpose<br/>HWC -> CHW"]
    H --> I["Batch<br/>CHW -> NCHW"]
    I --> J["Model"]

    style A fill:#fef3c7,stroke:#d97706
    style J fill:#ddd6fe,stroke:#7c3aed
    style G fill:#fecaca,stroke:#dc2626
    style H fill:#bfdbfe,stroke:#2563eb

조용한 실패(silent failure)의 대부분은 표준화(standardization) 누락과 잘못된 레이아웃에서 발생합니다.

픽셀은 사각형이 아니라 표본입니다

카메라 센서(sensor)는 작은 검출기(detector) 격자(grid)에 들어오는 광자(photon)를 셉니다. 각 검출기는 짧은 시간 동안 빛을 적분하고, 광자 수에 비례하는 전압(voltage)을 냅니다. 이 전압을 정수(integer)로 이산화하면 하나의 검출기가 하나의 픽셀이 됩니다.

Continuous scene                 Sensor grid                     Digital image
(infinite detail)                (H x W detectors)               (H x W integers)

    ~~~~~                        +--+--+--+--+--+                 210 198 180 155 120
   ~   ~   ~                     |  |  |  |  |  |                 205 195 178 152 118
  ~ light ~      ---->           +--+--+--+--+--+     ---->       200 190 175 150 115
   ~~~~~                         |  |  |  |  |  |                 195 185 170 148 112
                                 +--+--+--+--+--+                 188 180 165 145 108

이 단계에서 두 가지 선택이 이후 품질의 상한을 정합니다.

  • 공간 표본화(Spatial Sampling): 장면의 각도당 검출기 수를 정합니다. 너무 적으면 가장자리(edge)가 들쭉날쭉(jagged)해지고 에일리어싱(aliasing)이 생깁니다. 너무 많으면 저장 공간과 연산량이 커집니다.
  • 강도 양자화(Intensity Quantization): 전압을 얼마나 세밀한 구간(bucket)으로 나눌지 정합니다. 8비트(bit)는 256단계이며 디스플레이(display)에서 표준입니다. 10/12/16비트는 의료 영상(medical imaging), HDR, 원시 센서 파이프라인(raw sensor pipeline)에서 중요합니다.

픽셀은 면적을 가진 색칠된 사각형이 아니라 하나의 측정값입니다. 크기 조정(resize)이나 회전(rotate)은 이 측정 격자를 다시 표본화하는 일입니다.

왜 세 채널인가

하나의 검출기는 가시광선(visible spectrum) 전체의 광자를 셉니다. 이것이 그레이스케일입니다. 색을 얻기 위해 센서는 빨강·초록·파랑(red, green, blue) 필터 모자이크(filter mosaic)를 사용합니다. 디모자이킹(demosaicing) 후 각 공간 위치에는 R, G, B 검출기 응답값이 들어갑니다. 세 정수가 하나의 RGB 삼중값(triplet)입니다.

One pixel in memory:

    (R, G, B) = (210, 140, 30)   <- reddish-orange

An H x W RGB image:

    shape (H, W, 3)     stored as   H rows of W pixels of 3 values
                                    each in [0, 255] for uint8

채널 수가 항상 3인 것은 아닙니다. 깊이 카메라(depth camera)는 Z 채널을 추가하고, 위성 영상(satellite)은 적외선·자외선(infrared/ultraviolet) 대역(band)을 추가합니다. 엑스선(X-ray)이나 CT는 보통 채널 하나이고, 초분광 영상(hyperspectral image)은 많은 채널을 가집니다. 채널 수는 마지막 축(HWC) 또는 첫 축(CHW)에 놓이며 합성곱 층이 이를 섞어 학습합니다.

두 가지 레이아웃 규약: HWC와 CHW

같은 텐서라도 축 순서는 다를 수 있습니다.

HWC (height, width, channels)           CHW (channels, height, width)

   W ->                                    H ->
  +-----+-----+-----+                     +-----+-----+
H |R G B|R G B|R G B|                   C |R R R R R R|
| +-----+-----+-----+                   | +-----+-----+
v |R G B|R G B|R G B|                   v |G G G G G G|
  +-----+-----+-----+                     +-----+-----+
                                          |B B B B B B|
                                          +-----+-----+

   PIL, OpenCV, matplotlib,              PyTorch, 대부분의 딥러닝
   디스크의 image file                    프레임워크, cuDNN kernel

CHW는 합성곱 커널(convolution kernel)이 H와 W 위를 미끄러질(sliding) 때 채널별 2차원 평면(plane)을 연속(contiguous)된 메모리로 다루기 좋습니다. 디스크 포맷은 센서 스캔라인(scanline)과 잘 맞는 HWC를 많이 씁니다.

자주 쓰는 변환은 다음과 같습니다.

img_chw = img_hwc.transpose(2, 0, 1)      # NumPy
img_chw = img_hwc.permute(2, 0, 1)        # PyTorch tensor
flowchart TB
    subgraph HWC["HWC — pixels stored interleaved(PIL, OpenCV, JPEG)"]
        H1["row 0: R G B | R G B | R G B ..."]
    end
    subgraph CHW["CHW — channels stored as stacked planes(PyTorch, cuDNN)"]
        C1["plane R: entire H x W of red values"]
        C2["plane G: entire H x W of green values"]
        C3["plane B: entire H x W of blue values"]
    end
    HWC -->|"transpose(2, 0, 1)"| CHW
    CHW -->|"transpose(1, 2, 0)"| HWC

바이트 범위와 자료형(dtype)

표현 방식자료형(dtype)값 범위주로 보이는 곳
원시(Raw)uint8[0, 255]파일, PIL, OpenCV 출력
정규화(Normalized)float32[0.0, 1.0]img.astype("float32") / 255 이후
표준화(Standardized)float32대략 [-2, +2]평균을 빼고 표준편차로 나눈 후

합성곱 신경망(Convolutional Network)은 표준화된 입력으로 학습된 경우가 많습니다. ImageNet 통계 mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]는 [0, 1]로 정규화된 ImageNet 학습 집합(training set)에서 채널별 평균(mean)과 표준편차(standard deviation)를 계산한 값입니다. 표준화된 부동소수점(float)을 기대하는 모델에 원시 uint8를 넣는 것은 응용 비전(applied vision) 분야에서 가장 흔한 조용한 실패입니다.

색 공간과 존재 이유

RGB는 촬영(capture) 단계의 형식이지만 항상 모델에 가장 유용한 표현은 아닙니다.

RGB                 HSV                         YCbCr / YUV

R red               H hue(angle 0-360)          Y luminance(brightness)
G green             S saturation(0-1)           Cb chroma blue-yellow
B blue              V value/brightness(0-1)     Cr chroma red-green

 Linear to          Separates color from        Separates brightness from
 sensor output      brightness. Useful for      color. JPEG and most video
                    color thresholding, UI      codecs compress the chroma
                    sliders, simple filters     channels harder because the
                                                human eye is less sensitive
                                                to chroma detail than to Y.

대부분의 현대 CNN은 RGB를 입력으로 받습니다. 다른 색 공간은 다음 상황에서 만납니다.

  • HSV: 전통적 컴퓨터 비전(classical CV), 색 기반 분할(color-based segmentation), 화이트 밸런싱(white balancing).
  • YCbCr: JPEG 내부 구조, 비디오 파이프라인, Y 채널만 다루는 초해상도(super-resolution) 모델.
  • 그레이스케일(Grayscale): OCR, 문서 처리 모델, 색이 신호(signal)가 아니라 방해 변수(nuisance variable)인 경우.

RGB에서 그레이스케일로 바꿀 때는 단순 평균이 아니라 가중합(weighted sum)을 씁니다. 사람 눈이 초록색에 더 민감하기 때문입니다.

Y = 0.299 R + 0.587 G + 0.114 B  # ITU-R BT.601

종횡비(aspect ratio), 크기 조정, 보간

모델은 보통 고정된 입력 크기를 가집니다. ImageNet 분류기(classifier)는 224x224가 흔하고, 검출기(detector)는 384x384 또는 512x512를 쓸 수 있습니다. 원본 이미지와 모델 입력 크기가 다르므로 크기 조정 정책이 필요합니다.

  • 짧은 변을 맞추고 가운데 자르기(Resize shorter side, then center crop): ImageNet 표준 방식(recipe)입니다. 종횡비를 보존하지만 가장자리 픽셀 일부를 버립니다.
  • 크기 조정 후 여백 채우기(Resize and pad): 종횡비와 모든 픽셀을 보존하고 여백(padding)을 추가합니다. 검출(detection)과 OCR에서 흔합니다.
  • 목표 크기로 바로 변환(Resize directly to target): 이미지를 늘리거나 줄여 목표 크기에 맞춥니다. 비용은 낮지만 기하 구조(geometry)가 왜곡됩니다.

보간(interpolation)은 새 격자가 기존 격자와 맞지 않을 때 출력 픽셀을 계산하는 규칙입니다.

방법특징사용처
최근접 이웃(Nearest neighbour)가장 빠르지만 블록 형태(blocky)로 보임마스크(mask)·레이블처럼 클래스 ID가 있는 데이터
양선형(Bilinear)빠르고 부드러움학습용 이미지 크기 조정의 기본값
양3차(Bicubic)느리지만 확대(upscaling)에서 더 또렷함표시용 자료(asset)
Lanczos가장 느리고 품질이 좋음최종 표시

경험칙(rule of thumb)으로는 학습용 이미지에는 양선형, 사람이 볼 자료에는 양3차 또는 Lanczos, 클래스 ID가 담긴 마스크에는 최근접 이웃을 씁니다.

만들어 보기

Step 1: 이미지를 불러오고 모양 확인하기

Pillow로 JPEG/PNG를 읽고 NumPy 배열로 바꿔 검사합니다. 오프라인에서도 실행되도록 합성 이미지(synthetic image)를 만들 수 있습니다.

import numpy as np
from PIL import Image

def synthetic_rgb(h=128, w=192, seed=0):
    rng = np.random.default_rng(seed)
    yy, xx = np.meshgrid(np.linspace(0, 1, h), np.linspace(0, 1, w), indexing="ij")
    r = (np.sin(xx * 6) * 0.5 + 0.5) * 255
    g = yy * 255
    b = (1 - yy) * xx * 255
    rgb = np.stack([r, g, b], axis=-1) + rng.normal(0, 6, (h, w, 3))
    return np.clip(rgb, 0, 255).astype(np.uint8)

arr = synthetic_rgb()
# 또는 디스크에서 불러옵니다.
# arr = np.asarray(Image.open("your_image.jpg").convert("RGB"))

print(f"type:   {type(arr).__name__}")
print(f"dtype:  {arr.dtype}")
print(f"shape:  {arr.shape}     # (H, W, C)")
print(f"min:    {arr.min()}")
print(f"max:    {arr.max()}")
print(f"pixel at (0, 0): {arr[0, 0]}")

기대되는 출력은 shape: (H, W, 3), dtype: uint8, 값 범위 [0, 255]입니다. 바이트가 카메라, JPEG 디코더, 합성 생성기 중 어디에서 왔든 디스크에 저장되는 표준(canonical) 표현입니다.

Step 2: 채널 분리와 레이아웃 변경

R = arr[:, :, 0]
G = arr[:, :, 1]
B = arr[:, :, 2]
print(f"R shape: {R.shape}, mean: {R.mean():.1f}")
print(f"G shape: {G.shape}, mean: {G.mean():.1f}")
print(f"B shape: {B.shape}, mean: {B.mean():.1f}")

arr_chw = arr.transpose(2, 0, 1)
print(f"\nHWC shape: {arr.shape}")
print(f"CHW shape: {arr_chw.shape}")

세 채널은 각각 그레이스케일 평면입니다. CHW는 축을 재배치한 것입니다. 메모리 레이아웃이 허용하면 데이터 복사 없이 뷰(view)만 바뀔 수도 있습니다.

Step 3: 그레이스케일과 HSV 변환

def rgb_to_grayscale(rgb):
    weights = np.array([0.299, 0.587, 0.114], dtype=np.float32)
    return (rgb.astype(np.float32) @ weights).astype(np.uint8)

def rgb_to_hsv(rgb):
    rgb_f = rgb.astype(np.float32) / 255.0
    r, g, b = rgb_f[..., 0], rgb_f[..., 1], rgb_f[..., 2]
    cmax = np.max(rgb_f, axis=-1)
    cmin = np.min(rgb_f, axis=-1)
    delta = cmax - cmin
    h = np.zeros_like(cmax)
    mask = delta > 0
    rmax = mask & (cmax == r)
    gmax = mask & (cmax == g)
    bmax = mask & (cmax == b)
    h[rmax] = ((g[rmax] - b[rmax]) / delta[rmax]) % 6
    h[gmax] = ((b[gmax] - r[gmax]) / delta[gmax]) + 2
    h[bmax] = ((r[bmax] - g[bmax]) / delta[bmax]) + 4
    h = h * 60.0
    s = np.where(cmax > 0, delta / cmax, 0)
    v = cmax
    return np.stack([h, s, v], axis=-1)

gray = rgb_to_grayscale(arr)
hsv = rgb_to_hsv(arr)
print(f"gray shape: {gray.shape}, range: [{gray.min()}, {gray.max()}]")
print(f"hsv   shape: {hsv.shape}")
print(f"hue range: [{hsv[..., 0].min():.1f}, {hsv[..., 0].max():.1f}] degrees")
print(f"sat range: [{hsv[..., 1].min():.2f}, {hsv[..., 1].max():.2f}]")
print(f"val range: [{hsv[..., 2].min():.2f}, {hsv[..., 2].max():.2f}]")

색상(Hue)은 각도(degree)로 나오고 채도(saturation)와 명도(value)는 [0, 1]입니다. OpenCV의 hsv_full 규약과 맞습니다.

Step 4: 정규화, 표준화, 역변환

원시 바이트에서 사전 학습된 ImageNet 모델이 기대하는 텐서로 바꾼 뒤 다시 되돌립니다.

mean = np.array([0.485, 0.456, 0.406], dtype=np.float32)
std = np.array([0.229, 0.224, 0.225], dtype=np.float32)

def preprocess_imagenet(rgb_uint8):
    x = rgb_uint8.astype(np.float32) / 255.0
    x = (x - mean) / std
    x = x.transpose(2, 0, 1)
    return x

def deprocess_imagenet(chw_float32):
    x = chw_float32.transpose(1, 2, 0)
    x = x * std + mean
    x = np.clip(x * 255.0, 0, 255).astype(np.uint8)
    return x

x = preprocess_imagenet(arr)
print(f"preprocessed shape: {x.shape}     # (C, H, W)")
print(f"preprocessed dtype: {x.dtype}")
print(f"preprocessed mean per channel:  {x.mean(axis=(1, 2)).round(3)}")
print(f"preprocessed std  per channel:  {x.std(axis=(1, 2)).round(3)}")

roundtrip = deprocess_imagenet(x)
max_diff = np.abs(roundtrip.astype(int) - arr.astype(int)).max()
print(f"roundtrip max pixel diff: {max_diff}    # should be 0 or 1")

채널별 평균은 0에 가깝고 표준편차는 1에 가까워야 합니다. 이 전처리/역전처리(preprocess/deprocess) 쌍은 torchvision의 transforms.Normalize가 내부에서 하는 일을 그대로 보여 줍니다.

Step 5: 보간 방법 비교

target = (arr.shape[0] * 3, arr.shape[1] * 3)

nearest = np.asarray(Image.fromarray(arr).resize(target[::-1], Image.NEAREST))
bilinear = np.asarray(Image.fromarray(arr).resize(target[::-1], Image.BILINEAR))
bicubic = np.asarray(Image.fromarray(arr).resize(target[::-1], Image.BICUBIC))

def local_roughness(x):
    gy = np.diff(x.astype(float), axis=0)
    gx = np.diff(x.astype(float), axis=1)
    return float(np.abs(gy).mean() + np.abs(gx).mean())

for name, out in [("nearest", nearest), ("bilinear", bilinear), ("bicubic", bicubic)]:
    print(f"{name:>8}  shape={out.shape}  roughness={local_roughness(out):6.2f}")

최근접 이웃은 날카로운 경계를 유지해 거칠기(roughness) 값이 높고, 양선형은 가장 부드러우며, 양3차는 그 중간에서 시각적 선명도를 유지합니다.

사용하기

torchvision.transforms는 위 과정을 하나의 파이프라인으로 묶습니다.

import torch
from torchvision import transforms
from PIL import Image

img = Image.fromarray(synthetic_rgb(256, 256))

pipeline = transforms.Compose([
    transforms.Resize(256),
    transforms.CenterCrop(224),
    transforms.ToTensor(),
    transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
])

x = pipeline(img)
print(f"tensor type:  {type(x).__name__}")
print(f"tensor dtype: {x.dtype}")
print(f"tensor shape: {tuple(x.shape)}      # (C, H, W)")
print(f"per-channel mean: {x.mean(dim=(1, 2)).tolist()}")
print(f"per-channel std:  {x.std(dim=(1, 2)).tolist()}")

batch = x.unsqueeze(0)
print(f"\nbatched shape: {tuple(batch.shape)}   # (N, C, H, W) — ready for a model")

순서는 중요합니다. Resize(256)은 짧은 변을 256으로 맞추고, CenterCrop(224)는 중앙 224x224 영역(patch)을 자릅니다. ToTensor()/255와 HWC -> CHW 변환을 수행하고, Normalize는 ImageNet 평균·표준편차로 표준화합니다.

산출물 만들기

이 lesson의 최종 산출물은 다음 두 가지입니다.

  • outputs/prompt-vision-preprocessing-audit.md: 모델 카드(model card)나 데이터셋 카드(dataset card)에서 전처리 불변식(preprocessing invariant)을 체크리스트로 뽑아내는 프롬프트
  • outputs/skill-image-tensor-inspector.md: 이미지 형태의 텐서나 배열에 대해 자료형, 레이아웃, 값 범위, 원시·정규화·표준화 여부를 진단하는 스킬(skill)

연습문제

  1. 쉬움: OpenCV(cv2.imread)와 Pillow로 같은 JPEG를 읽습니다. 모양과 (0, 0) 픽셀을 출력합니다. 채널 순서 차이를 설명하고, OpenCV 배열을 Pillow 배열과 같게 만드는 한 줄 변환을 작성합니다.
  2. 중간: standardize(img, mean, std)와 그 역함수를 작성합니다. 어떤 uint8 이미지에서도 roundtrip_max_diff <= 1 검사를 통과해야 합니다. HWC 단일 이미지와 NCHW 배치(batch)를 같은 호출로 처리해야 합니다.
  3. 어려움: 3채널 ImageNet 표준화 텐서를 1x1 합성곱에 넣어 RGB를 단일 그레이스케일 채널로 섞습니다. 가중치를 [0.299, 0.587, 0.114]로 초기화하고 동결(freeze)한 뒤 수동 rgb_to_grayscale과 부동소수점 오차 범위에서 일치하는지 확인합니다. 또 어떤 전통적 색 공간 변환을 1x1 합성곱으로 표현할 수 있을지 생각합니다.

핵심 용어

용어흔한 설명실제 의미
픽셀(Pixel)색칠된 사각형격자 위치 하나에서 측정한 빛 세기 표본
채널(Channel)색상이미지 텐서에 쌓인 평행한 공간 격자 중 하나
HWC / CHW모양(shape)이미지 텐서의 축 순서. 디스크와 PIL은 HWC, PyTorch와 cuDNN은 CHW
정규화(Normalize)이미지 스케일 조정픽셀을 [0, 1]로 만들기 위해 255로 나누는 작업
표준화(Standardize)0 중심 맞추기(zero-center)학습 때의 입력 분포와 맞추기 위해 채널별 평균을 빼고 표준편차로 나누는 작업
그레이스케일 변환(Grayscale conversion)채널 평균사람의 휘도 지각에 맞춘 가중합
보간(Interpolation)크기 조정이 픽셀을 고르는 방식새 격자와 기존 격자가 어긋날 때 출력 값을 정하는 규칙
종횡비(Aspect ratio)너비 ÷ 높이크기 조정 후 여백을 둘지, 늘려서 채울지를 가르는 비율

더 읽을거리

실습 코드

이 강의의 실습 코드 1개

main
Code

산출물

이 강의에서 생성된 프롬프트, 스킬, 코드 산출물 2개

skill-image-tensor-inspector

Inspect any image-shaped tensor or array and report dtype, layout, range, and whether it looks raw, normalized, or standardized

Skill
prompt-vision-preprocessing-audit

Turn any model card or dataset card into a checklist of the preprocessing invariants a vision pipeline must honour

Prompt

확인 문제

3문제 · 모두 맞추면 완료 표시가 가능합니다

1.ImageNet 사전 학습 모델이 mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]로 표준화된 입력을 기대하는 이유는 무엇입니까?

2.정수 클래스 ID 0..20을 담은 분할 마스크(segmentation mask)를 500x500에서 224x224로 크기 조정합니다. 올바른 보간 방법은 무엇입니까?

3.RGB 그레이스케일 변환에서 0.333 R + 0.333 G + 0.333 B가 아니라 0.299 R + 0.587 G + 0.114 B를 쓰는 이유는 무엇입니까?

0/3 답변 완료