Meet YOLO26: next-gen vision AI.

Link to this section지식 증류 (Knowledge Distillation)#

Link to this section퀵스타트#

distill_model 인자를 추가하여 더 큰 교사 모델의 지도로 더 작은 학생 모델을 학습시키십시오:

예시
from ultralytics import YOLO

model = YOLO("yolo26n.pt")
model.train(data="coco8.yaml", epochs=100, distill_model="yolo26s.pt")

Link to this section지식 증류(Knowledge Distillation)란 무엇입니까?#

지식 증류는 크고 정확도가 높은 **교사 모델(teacher model)**에서 더 작은 **학생 모델(student model)**로 지식을 전달합니다. 학생 모델은 교사의 내부 특징 표현을 모방하도록 학습하며, 종종 처음부터 학습하는 것보다 더 나은 정확도를 달성합니다.

증류를 사용해야 하는 경우:

  • 배포를 위해 더 작고 빠른 모델이 필요한 경우
  • 동일한 데이터로 학습된 정확도가 높은 교사 모델이 있는 경우
  • 표준 학습보다 더 높은 정확도를 원하는 경우
참고

지식 증류는 detect, segment, pose, obb 작업에 구현되어 있습니다. 현재는 detect 작업에 대해서만 정확도 향상이 실험적으로 검증되었습니다.

Link to this section성능#

Knowledge distillation improves student mAP across the entire YOLO26 family on COCO, with no added inference cost. The table below compares the standard YOLO26 models (baseline) against the same models trained with distillation from their recommended teacher.

모델크기
(픽셀)
mAPval
50-95

baseline
mAPval
50-95

distilled
mAPval
50-95 (e2e)

baseline
mAPval
50-95 (e2e)

distilled
YOLO26n-distill64040.941.540.140.9
YOLO26s-distill64048.649.247.848.6
YOLO26m-distill64053.153.952.553.3
YOLO26l-distill64055.056.054.455.5
YOLO26x-distill64057.557.956.957.4
  • mAPval 값은 COCO val2017 데이터셋에서의 단일 모델 단일 스케일 기준입니다.
    재현하려면 yolo val detect data=coco.yaml device=0을 사용하십시오.
  • e2e 값은 기본 NMS-free 추론 경로를 사용하며, non-e2e 값은 기존 NMS 후처리(end2end=False)를 사용합니다. 자세한 내용은 End-to-End Detection을 참조하십시오.

Link to this section사전 요구 사항#

시작하기 전에 다음 요구 사항을 충족하는지 확인하십시오:

  • 학습된 교사 모델: 학생 모델과 동일한 YOLO 제품군(예: YOLO26)에서 사전 학습된 고정밀 교사 모델.
  • 일치하는 데이터셋 및 작업: 교사 모델과 학생 모델 모두 정확히 동일한 데이터셋 및 작업 구성을 사용해야 합니다.
  • GPU 리소스: 학습 중 두 모델을 동시에 로드하고 실행할 수 있는 충분한 GPU 메모리(VRAM)가 필요합니다(일반적인 VRAM 오버헤드는 FAQ 참조).

Link to this section권장 모델 조합#

학생 모델권장 교사 모델
yolo26n.ptyolo26s.pt
yolo26s.ptyolo26m.pt
yolo26m.ptyolo26x.pt
yolo26l.ptyolo26x.pt

교차 제품군 증류(예: YOLO11 교사와 YOLO26 학생)는 지원되지 않습니다.

Link to this section주요 매개변수#

파라미터유형기본값설명
distill_modelstrNone교사 모델 파일 경로(예: yolo26x.pt). 이를 설정하면 지식 증류가 활성화됩니다.
disfloat6.0증류 손실 가중치. 전체 학습 손실에 증류 손실이 기여하는 정도를 제어합니다.

Link to this section작동 원리#

  1. 교사 모델eval 모드에서 고정된 상태로 유지되며 각 배치에서 추론을 수행합니다.
  2. 학생 모델은 표준 작업 손실과 증류 지도를 함께 사용하여 학습합니다.
  3. 특징은 Detect 제품군 헤드로 전달되는 세 개의 넥 레이어에서 두 모델 모두로부터 추출됩니다.
  4. 프로젝터 네트워크(경량 MLP)는 학생의 특징 차원을 교사와 일치하도록 조정합니다.
  5. **점수 가중 L2 손실(score-weighted L2 loss)**은 교사의 분류 신뢰도로 가중치가 적용된, 투영된 학생 특징과 교사 특징을 비교합니다.
  6. 증류 손실은 dis 가중치를 사용하여 표준 손실과 결합됩니다.
flowchart TD
    A[Input Image Batch] --> T[Teacher Model<br/>frozen, eval mode]
    A --> S[Student Model<br/>trainable]

    T --> |Detect head inputs| TF[Teacher Features]
    S --> |Detect head inputs| SF[Student Features]

    SF --> P[1×1 Conv Projector<br/>with ReLU]
    P --> AF[Aligned Student Features]

    TF --> SW[Score-weighted L2 Loss]
    AF --> SW

    S --> D[Detection Head]
    D --> DL[box_loss + cls_loss + dfl_loss]

    SW --> |× dis| DIS[distillation loss]
    DL --> TOTAL[Total Loss]
    DIS --> TOTAL

    TOTAL --> BP[Backpropagate<br/>Student + Projector only]

Link to this section작업 지원#

증류 구현은 모델의 Detect 제품군 헤드로 전달되는 세 개의 넥 레이어에서 특징을 추출합니다. segment, pose, obb 헤드는 동일한 Detect 아키텍처를 상속받으므로 기술적으로는 해당 작업들도 증류와 호환됩니다.

경고

현재 detect 작업에 대해서만 실험적 벤치마킹 및 검증이 완료되었습니다. segment, pose, obb에 대해서도 증류를 실행할 수 있으나, 해당 작업에 대한 정확도 향상은 아직 검증되지 않았습니다.

기타 작업에 대한 지식 증류
from ultralytics import YOLO

# Segment
model = YOLO("yolo26n-seg.pt")
model.train(data="coco8-seg.yaml", epochs=100, distill_model="yolo26s-seg.pt")

# Pose
model = YOLO("yolo26n-pose.pt")
model.train(data="coco8-pose.yaml", epochs=100, distill_model="yolo26s-pose.pt")

# OBB
model = YOLO("yolo26n-obb.pt")
model.train(data="dota8.yaml", epochs=100, distill_model="yolo26s-obb.pt")

Link to this section학습#

Link to this section기본 학습#

증류를 포함한 학습은 표준 학습과 동일합니다. distill_model 경로를 제공하여 활성화하십시오:

지식 증류 학습
from ultralytics import YOLO

# Load a student model
student = YOLO("yolo26m.pt")

# Train with knowledge distillation from a larger teacher model
results = student.train(data="coco8.yaml", epochs=100, distill_model="yolo26x.pt")

Link to this section증류 손실 가중치 조정#

dis 매개변수(기본값: 6.0)는 증류 손실 기여도를 제어합니다:

사용자 지정 증류 가중치
from ultralytics import YOLO

student = YOLO("yolo26n.pt")
results = student.train(data="coco8.yaml", epochs=100, distill_model="yolo26s.pt", dis=10.0)

Link to this section증류 학습 재개#

증류 학습은 체크포인트로부터 재개를 지원합니다. 교사 모델은 distill_model 경로로부터 자동으로 재구성됩니다:

증류 학습 재개
from ultralytics import YOLO

student = YOLO("runs/detect/train/weights/last.pt")
results = student.train(resume=True)

Link to this section학습 출력#

증류가 활성화되면 학습 로그에 추가적인 dis_loss 열이 나타납니다:

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss   dis_loss  Instances       Size
      1/80      46.2G      1.566      5.404    0.003249      6.658        231        640

내보내진 모델은 학생 모델 가중치만 포함합니다. 파일 크기와 추론 속도는 일반적인 방식으로 학습된 학생 모델과 동일합니다.

Link to this sectionFAQ#

Link to this section증류 손실이 감소하지 않는 이유는 무엇입니까?#

  • 교사와 학생이 동일한 YOLO 세대인지 확인하십시오.
  • distill_model 경로가 올바르고 파일이 로드되는지 확인하십시오.
  • 손실 값이 매우 작다면 dis 값을 높여보십시오.
  • 교사 모델이 동일한 데이터셋으로 학습되었는지 확인하십시오.

Link to this section증류는 표준 학습과 어떻게 다릅니까?#

distill_model 매개변수를 추가하는 것 외에는 모든 것이 동일하게 작동합니다. 학습 중에 추가적인 증류 손실이 계산되지만, 저장된 모델은 오버헤드가 없는 표준 YOLO 모델입니다.

Link to this section지식 증류가 학습 속도를 늦춥니까?#

그렇습니다. 각 배치마다 교사 모델이 추론을 수행하므로 학습 속도가 1.2-1.5배 느려지고 GPU 메모리 사용량이 약 1.1배 증가할 수 있습니다. 교사 모델은 그래디언트 없이 eval 모드에서 실행되므로 오버헤드를 관리 가능한 수준으로 유지합니다. 영향을 줄이려면 amp=True를 사용하십시오.

Link to this section어떤 작업과 모델이 지원됩니까?#

지식 증류는 Detect 제품군 헤드로 전달되는 세 개의 넥 레이어에서 특징을 증류하므로 detect, segment, pose, obb 작업에서 작동합니다. Classifysemantic 작업은 지원되지 않습니다.

detect 작업에 대해서만 정확도 향상이 실험적으로 검증되었습니다. Segment, pose, obb는 기술적으로 호환되지만 아직 벤치마킹되지 않았습니다.

교사와 학생은 반드시 동일한 YOLO 제품군(예: YOLOv8, YOLO11, 또는 YOLO26)에 속해야 합니다. 교차 제품군 증류(예: YOLO11 교사와 YOLO26 학생)는 지원되지 않습니다.

기여자

댓글