Link to this sectionYOLO 아키텍처 설명: YOLOv3부터 YOLO26까지#
모든 Ultralytics YOLO 모델은 세 가지 단계로 구성됩니다: 특징을 추출하는 백본(backbone), 특징을 규모별로 융합하는 넥(neck), 그리고 상자와 클래스를 예측하는 **헤드(head)**입니다. 이 가이드는 각 단계를 구성하는 모듈과 YOLOv3에서 YOLO26으로 어떻게 변경되었는지 문서화하며, ultralytics/cfg/models/의 설정 파일과 ultralytics/nn/modules/의 모듈 클래스에 정의된 모든 구성 요소를 추적합니다.
각 모델은 YAML 파일에 레이어의 순서 목록으로 선언적으로 정의되며, 모든 레이어는 [from, repeats, module, args] 형식을 따릅니다: 어떤 레이어로부터 입력을 받는지, 모듈이 몇 번 반복되는지, 레이어 클래스(Conv, C3k2, SPPF, Detect 등), 그리고 생성자 인자입니다. 모델 YAML 설정 가이드는 repeats와 args가 모델 변형의 깊이와 너비 배수에 따라 어떻게 확장되는지를 포함한 이 형식과 전체 모듈 해석 시스템을 문서화합니다. 이 가이드는 모듈 자체와 버전별 변경 사항에 중점을 둡니다.
Link to this section세 가지 단계#
모든 Ultralytics YOLO 모델은 이미지를 순차적인 세 단계를 거쳐 처리하며, 각 단계는 고유한 역할을 수행합니다:
| 단계 | 작업 | 출력 |
|---|---|---|
| 백본 | 입력 이미지로부터 다중 해상도로 특징 추출 | 스트라이드 8, 16, 32(P3, P4, P5)에서의 특징 맵 |
| 넥 | 작은 객체와 큰 객체 모두 문맥을 가질 수 있도록 규모별 특징 융합 | 다중 규모 융합 특징 맵 |
| 헤드 | 융합된 특징으로부터 경계 상자 및 클래스 점수 예측 | 앵커 포인트당 탐지 |
기본 단위는 Conv 블록(conv.py에 정의됨)으로, 2D 컨볼루션, 배치 정규화, SiLU 활성화 함수가 순차적으로 적용됩니다. 아래의 모든 더 큰 모듈은 Conv 블록을 조합하여 구축됩니다.
Link to this section아키텍처 다이어그램#
Each version keeps the same backbone → neck → head skeleton and changes specific stages. The tabs below show the per-version structure: the backbone and neck stages follow the configs in ultralytics/cfg/models/, while the YOLOv3 and YOLOv5 heads are drawn in their original anchor-based form rather than the anchor-free u-variant head their package configs actually ship. Stepping through the tabs shows what each generation added. In short, the progression is: YOLOv3 is an FPN-only, anchor-based detector; YOLOv5 adds the bottom-up PAN path and SPPF; YOLOv8 switches to the C2f block with an anchor-free, DFL head; YOLO11 inserts C2PSA attention and the C3k2 block; and YOLO26 adds an SPPF residual and makes the head NMS-free and DFL-free. Node colors follow the documentation diagram convention: green input, blue backbone, slate spatial pooling and attention, orange neck, purple head and output.
flowchart TD
IN[Input 640x640]:::start --> ST[Conv stem<br/>5x stride-2 down to P1-P5]:::proc
ST --> BB[Darknet-53 backbone<br/>stacked Bottleneck]:::proc
BB --> FPN[Neck FPN only<br/>top-down Upsample + Concat]:::decide
FPN --> HD[Detect head<br/>3 scales, anchor-based]:::out
HD --> O[Predictions + NMS]:::out
classDef start fill:#4CAF50,color:#fff
classDef proc fill:#2196F3,color:#fff
classDef decide fill:#FF9800,color:#fff
classDef out fill:#9C27B0,color:#fffThe YOLOv3 and YOLOv5 diagrams show the original anchor-based head. The ultralytics package ships the anchor-free YOLOv3u and YOLOv5u configs — the same Darknet-53 and C3 backbones with YOLOv8's Detect head — described under Detection Head.
Link to this section백본 블록: Bottleneck → C3 → C2f → C3k2#
백본은 스트라이드-2 Conv 다운샘플링 레이어 사이에 반복되는 CSP(Cross-Stage Partial) 블록을 쌓습니다. 버전마다 가장 많이 변경된 부분이 바로 이 반복 블록입니다. 아래의 모든 블록은 block.py에 위치하며, c1/c2는 입력/출력 채널이고 c = 0.5 * c2는 숨겨진 너비입니다.
Link to this sectionBottleneck (YOLOv3)#
The base unit is Bottleneck: two Conv layers (default kernels (3, 3)) with an optional residual add when shortcut=True and c1 == c2. YOLOv3's Darknet-53 backbone stacks these directly, with no CSP split, and detects at three scales (strides 8, 16, 32).
Link to this sectionC3 (YOLOv5)#
YOLOv5의 C3는 입력을 두 개의 1x1 컨볼루션으로 나눕니다: cv1은 n개의 순차적 Bottleneck 블록(커널 (1, 1) 후 (3, 3))에 공급되고, cv2는 이를 우회합니다. 두 경로는 연결된 후 세 번째 1x1 Conv에 의해 융합됩니다:
def forward(self, x):
# C3: bottleneck path m(cv1(x)) concatenated with bypass cv2(x), then fused by cv3
return self.cv3(torch.cat((self.m(self.cv1(x)), self.cv2(x)), 1))최종 보틀넥 출력만 융합 컨볼루션에 도달하므로 cv3는 2개의 특징 맵을 봅니다.
Link to this sectionC2f (YOLOv8)#
YOLOv8의 C2f("CSP Bottleneck with 2 convolutions, faster")는 융합 컨볼루션에 도달하는 특징을 변경합니다:
cv1 = Conv(c1, 2 * c, 1)후chunk(2)가 출력을 두 개의c-채널 텐서로 분할합니다.n개의Bottleneck(c, c)블록(커널(3, 3),(3, 3))이 순차적으로 실행되며, 각 블록은 이전 블록의 출력을 입력으로 받습니다.- 모든
n + 2개의 중간 텐서가 연결된 후cv2 = Conv((2 + n) * c, c2, 1)에 의해 융합됩니다.
C3가 2개의 특징 맵을 융합 컨볼루션에 전달하는 반면, C2f는 n + 2개를 전달하여 모든 중간 보틀넥 출력을 재사용합니다.
Link to this sectionC3k2 (YOLO11 및 YOLO26)#
YOLO11 and YOLO26 use C3k2, a subclass of C2f that swaps the repeating unit. Each of the n blocks becomes, depending on the constructor flags:
- 일반
Bottleneck(기본값,c3k=False), C3k블록 (c3k=True) — 구성 가능한 커널 크기를 가진C3변형, 또는Bottleneck+PSABlock쌍 (attn=True).
두 번째 YAML 인자는 c3k를 설정합니다; 예를 들어 [-1, 2, C3k2, [512, True]]는 출력 채널 512에서 하나의 C3k2 모듈을 빌드하며, 내부 블록은 C3k입니다( c3k=True이므로). CSP 모듈의 경우 repeats 필드는(여기서는 2, 변형의 깊이 배수로 스케일링되기 전) 별도의 모듈을 쌓는 대신 블록의 내부 반복 횟수가 됩니다.
Link to this section공간 풀링: SPP → SPPF#
백본 끝에서 공간 피라미드 풀링 블록은 수용 영역(receptive field)을 넓힙니다. YOLOv5는 기존의 다중 커널 SPP를 SPPF(Spatial Pyramid Pooling - Fast)로 교체했습니다: 이는 MaxPool2d(kernel_size=5, stride=1, padding=2)를 n = 3번 순차적으로 적용하고, 입력과 세 개의 풀링 출력을 모두 연결하여 1x1 Conv로 융합합니다. 이는 수학적으로 SPP(k=(5, 9, 13))와 동일하지만 체인 형태의 5x5 풀이 더 큰 커널의 수용 영역을 커버하므로 더 효율적입니다.
YOLO26은 숏컷 플래그(SPPF, [1024, 5, 3, True])를 전달하며, 가장 깊은 레이어에서 c1 == c2 == 1024이므로 SPPF는 레지듀얼 연결(return y + x)을 추가합니다.
Link to this section공간 어텐션: C2PSA (YOLO11+)#
YOLO11 added C2PSA after SPPF. It is a CSP block whose active branch is a stack of n PSABlock (Position-Sensitive Attention) modules: cv1 = Conv(c1, 2 * c, 1) splits the features, one half passes through the PSABlock stack, and cv2 = Conv(2 * c, c1, 1) fuses the concatenation. Each PSABlock applies multi-head attention followed by a two-layer feed-forward network (Conv(c, 2 * c, 1) → Conv(2 * c, c, 1)), each with a residual connection. YOLO26 keeps the same C3k2 + C2PSA backbone.
Link to this section넥: FPN + PAN#
넥은 하향식 FPN(Feature Pyramid Network)과 상향식 PAN(Path Aggregation Network)을 사용하여 백본의 P3/P4/P5 특징 맵을 융합합니다. YAML 헤드 섹션에서 FPN은 nn.Upsample + Concat(의미론적 정보를 더 높은 해상도로 전달)이며, PAN은 스트라이드-2 Conv + Concat(위치 정보를 다시 상위로 전달)입니다:
# YOLO11 head (FPN top-down, then PAN bottom-up)
- [-1, 1, nn.Upsample, [None, 2, "nearest"]]
- [[-1, 6], 1, Concat, [1]] # cat backbone P4
- [-1, 2, C3k2, [512, False]] # 13
# ... second upsample + concat to P3 ...
- [-1, 1, Conv, [256, 3, 2]]
- [[-1, 13], 1, Concat, [1]] # cat head P4 (PAN)
- [-1, 2, C3k2, [512, False]] # 19넥은 해당 세대의 백본 블록(YOLOv5의 C3, YOLOv8의 C2f, YOLO11 및 YOLO26의 C3k2)을 재사용하므로, 각 병합 지점은 백본이 사용하는 동일한 모듈을 실행합니다. 세 개의 융합된 출력이 헤드로 전달됩니다. YOLOv3는 예외로, 넥이 상향식 PAN 경로 없이 하향식 FPN만으로 구성됩니다(YAML 헤드에 스트라이드-2 다운샘플링이 없음).
Link to this section탐지 헤드: 앵커 기반 → 앵커 프리 → NMS 프리#
헤드는 세 개의 융합된 특징 맵을 탐지 작업을 위한 예측값으로 변환합니다. 그 설계는 앵커 기반에서 앵커 프리, 다시 NMS 프리로 버전마다 변경되었습니다.
Link to this section앵커 프리, 디커플드 Detect#
The original YOLOv3 and YOLOv5 used an anchor-based, coupled head: predefined anchor boxes and a shared branch for box and class predictions. The standalone ultralytics/yolov3 and ultralytics/yolov5 repositories keep that anchor-based design. The main ultralytics package instead ships the anchor-free YOLOv3u and YOLOv5u variants — the same Darknet-53 and C3 backbones with YOLOv8's anchor-free Detect head — and the yolov3.yaml and yolov5.yaml configs documented here are these u variants, not the historical design.
Detect 헤드(head.py)는 앵커 프리이며 디커플드(decoupled)되어 있습니다: 피라미드 레벨당 두 개의 병렬 브랜치를 실행하며, 앵커 상자가 아닌 그리드 포인트에서 직접 예측합니다.
- 상자 브랜치 (
cv2):Conv(x, c2, 3)→Conv(c2, c2, 3)→Conv2d(c2, 4 * reg_max, 1). - 클래스 브랜치 (
cv3): YOLO11 및 YOLO26에서는 두 개의 뎁스 와이즈 분리 가능 블록(DWConv+1x1 Conv) →Conv2d(c3, nc, 1); YOLOv8은 레거시 변형을 사용하여 두 개의3x3 Conv레이어 →Conv2d(c3, nc, 1)를 사용합니다.
따라서 각 앵커 포인트는 no = nc + 4 * reg_max개의 출력을 내보냅니다. 사전 정의된 앵커를 제거함으로써 튜닝해야 하는 하이퍼파라미터에서 앵커 상자의 크기와 종횡비가 삭제됩니다.
Link to this sectionDFL (Distribution Focal Loss)#
YOLOv8 and YOLO11 regress each of the 4 box coordinates as a distribution over reg_max = 16 bins rather than a single scalar (the integral form from Generalized Focal Loss). The DFL module reshapes the 4 * reg_max box channels to (4, reg_max), applies a softmax over the reg_max bins, and takes the expected bin index — each bin index weighted by its softmax probability, then summed — as the predicted coordinate. This is implemented as a fixed 1x1 convolution whose weights are the bin indices arange(reg_max), so the weighted sum is a single dot product.
Link to this sectionYOLO26: NMS 프리, DFL 프리#
YOLO26은 헤드가 직접 읽는 두 가지 YAML 파라미터를 설정합니다:
end2end: True—Detect가 브랜치를 일대일 헤드(one2one_cv2/one2one_cv3)로 깊은 복사하여 객체당 단일 예측을 생성함으로써 NMS(Non-Maximum Suppression) 후처리 단계를 제거합니다. 내보내기 및 마이그레이션 세부 정보는 엔드투엔드 탐지 가이드를 참조하십시오.reg_max: 1— 하나의 빈을 사용할 때self.dfl은nn.Identity()가 되고no = nc + 4가 됩니다; 헤드는 좌표를 직접 회귀하며 내보낸 ONNX 그래프에 DFL 연산이 나타나지 않습니다.
Across its five model sizes (n/s/m/l/x), YOLO26 reaches 40.9-57.5 mAP on COCO at 1.7-11.8 ms T4 TensorRT latency, as reported in the YOLO26 paper.
Link to this section버전별 요약#
| 버전 | 백본 블록 | 공간 풀링 | 어텐션 | 탐지 헤드 | DFL |
|---|---|---|---|---|---|
| YOLOv3 | Darknet-53 (Bottleneck) | 기본 설정에 없음 | 없음 | 원본: 앵커 기반; u 변형: 앵커 프리 | 아니요 / 예 (u) |
| YOLOv5 | C3 (CSP) | SPPF | 없음 | 원본: 앵커 기반; u 변형: 앵커 프리 | 아니요 / 예 (u) |
| YOLOv8 | C2f | SPPF | 없음 | 앵커 프리, 디커플드 | 예 (reg_max=16) |
| YOLO11 | C3k2 | SPPF | C2PSA | 앵커 프리, 디커플드 | 예 (reg_max=16) |
| YOLO26 | C3k2 | SPPF + 숏컷 | C2PSA | 앵커 프리, NMS 프리 (end2end) | 제거됨 (reg_max=1) |
모델별 세부 정보, 성능 표, 사용 예시는 YOLOv3, YOLOv5, YOLOv8, YOLO11, YOLO26의 개별 페이지를 참조하십시오.
Link to this section직접 아키텍처 검사하기#
model.info() 메서드는 레이어, 파라미터 및 FLOPs 요약을 출력하며, 파싱된 모듈 목록은 model.model.model에서 확인할 수 있습니다.
from ultralytics import YOLO
# Load a pretrained model
model = YOLO("yolo11n.pt")
# Fuse Conv + BatchNorm layers so counts match the published specs
model.fuse()
# Print a summary: layers, parameters, gradients, GFLOPs
model.info()
# Inspect the detection head (the last module in the network)
head = model.model.model[-1]
print(type(head).__name__, "| reg_max:", head.reg_max, "| end2end:", head.end2end)Running the snippet across three generations shows the changes numerically. These are real fused-model outputs from the ultralytics package, matching the parameter and FLOPs counts published on each model page:
| 모델 | 레이어 | 매개변수 | GFLOPs | reg_max | end2end | DFL 레이어 |
|---|---|---|---|---|---|---|
| YOLOv8n | 72 | 3,151,904 | 8.7 | 16 | False | DFL |
| YOLO11n | 100 | 2,616,248 | 6.5 | 16 | False | DFL |
| YOLO26n | 122 | 2,408,932 | 5.4 | 1 | True | Identity |
YOLO26n은 reg_max=1, end2end=True, Identity DFL 레이어를 보고하며, 이는 NMS 프리 및 DFL 프리 헤드의 아키텍처적 특징입니다.
Parameter and FLOPs values are reported for the fused model (model.fuse()), which merges each Conv and its batch normalization layer. This matches the published specifications; a freshly loaded checkpoint reports slightly higher counts before fusing.
Link to this section결론#
Across versions, the YOLO architecture changed one stage at a time: the backbone moved from Darknet-53 to CSP-based C3, C2f, and C3k2 blocks with C2PSA attention; the neck kept its FPN + PAN structure while SPP became SPPF; and the head moved from anchor-based to anchor-free, then to YOLO26's NMS-free, DFL-free end-to-end design.
사용자 정의 아키텍처를 정의하려면 모델 YAML 구성 가이드를 참조하거나 모델 페이지에서 모델을 비교하십시오. 질문이 있으시면 GitHub 또는 Discord를 통해 문의해 주십시오.
Link to this sectionFAQ#
Link to this sectionYOLO 아키텍처의 세 가지 단계는 무엇입니까?#
YOLO 모델에는 스트라이드 8, 16, 32에서 이미지의 특징을 추출하는 백본(backbone), FPN과 PAN을 사용하여 스케일 전반에 걸쳐 해당 특징을 융합하는 넥(neck), 그리고 바운딩 박스와 클래스 점수를 예측하는 **헤드(head)**가 있습니다. YOLOv3부터 YOLO26까지의 모든 Ultralytics YOLO 모델은 이러한 3단계 설계를 따릅니다.
Link to this sectionC2f 블록과 C3k2 블록의 차이점은 무엇입니까?#
C2f (YOLOv8) is a CSP block that concatenates the outputs of every internal Bottleneck — n + 2 feature maps — before its fusion convolution, where the older C3 passes only 2. C3k2 (YOLO11 and YOLO26) is a subclass of C2f that can replace each Bottleneck with a C3k block (a C3 variant with a configurable kernel size) when its c3k flag is set. Both are defined in block.py.
Link to this sectionYOLOv8과 YOLO11 사이의 아키텍처 변경 사항은 무엇입니까?#
YOLO11 makes three structural changes to YOLOv8: it replaces the C2f backbone and neck block with C3k2, inserts a C2PSA self-attention block after SPPF, and switches the head's classification branch to lighter depthwise-separable convolutions. Both keep the same anchor-free, decoupled Detect head with reg_max=16 DFL regression, so the changes lower parameter and FLOPs counts while raising accuracy rather than redesigning the detection interface.
Link to this sectionYOLO는 앵커 프리(anchor-free) 모델입니까?#
최신 Ultralytics YOLO 모델은 앵커 프리입니다. YOLOv8, YOLO11 및 YOLO26은 박스 회귀와 분류를 위한 별도의 브랜치가 있는 앵커 프리, 분리형 Detect 헤드를 사용합니다. 원래의 YOLOv3와 YOLOv5는 앵커 기반이었지만, Ultralytics는 이를 YOLOv3u 및 YOLOv5u 변형으로 제공하며, 이들의 설정은 YOLOv8과 동일한 앵커 프리 헤드를 사용합니다.
Link to this sectionYOLO26에서 NMS가 제거되었습니까?#
네, YOLO26은 end2end=True를 설정합니다. 이는 Detect에 객체당 하나의 예측을 생성하는 일대일(one-to-one) 헤드를 제공하며 이전 모델에서 필요했던 Non-Maximum Suppression 후처리 단계를 제거합니다. 자세한 내용은 엔드투엔드 탐지 가이드를 참조하십시오.
Link to this sectionDFL(Distribution Focal Loss)이란 무엇이며, 왜 YOLO26에서 제거되었습니까?#
DFL은 단일 스칼라를 예측하는 대신 각 박스 좌표를 reg_max 빈(YOLOv8 및 YOLO11에서는 기본값 16)에 대한 소프트맥스 분포로 회귀하고 기대값을 좌표로 취합니다. YOLO26은 reg_max=1로 설정하므로 DFL 레이어는 항등 연산이 되고, 헤드는 좌표를 직접 회귀하며, 내보낸 ONNX 또는 TensorRT 그래프에 DFL 연산이 나타나지 않습니다.
Link to this section특정 YOLO 모델의 아키텍처를 확인하려면 어떻게 해야 합니까?#
Python에서 모델을 로드하고 model.info()를 호출하여 레이어, 매개변수 및 GFLOPs 요약을 확인하십시오. 구문 분석된 레이어는 model.model.model에 있습니다. 예를 들어, model.model.model[-1]은 Detect 헤드이며 reg_max 및 end2end와 같은 속성을 노출합니다. 전체 아키텍처는 모델의 YAML 구성 파일에 정의되어 있습니다.