콘텐츠로 건너뛰기

이미지 분류

이미지 분류 예시

이미지 분류는 세 가지 작업 중 가장 간단한 작업으로, 전체 이미지를 미리 정의된 클래스 세트 중 하나로 분류하는 작업입니다.

이미지 분류기의 출력은 단일 클래스 레이블과 신뢰도 점수입니다. 이미지 분류는 이미지가 속한 클래스만 알고 싶고 해당 클래스의 객체가 어디에 있는지 또는 정확한 모양이 무엇인지 알 필요가 없을 때 유용합니다.



Watch: Ultralytics YOLO 작업 살펴보기: Ultralytics HUB를 사용한 이미지 분류

YOLO11 모델 분류는 -cls 접미사, 즉 yolo11n-cls.pt 에 대해 사전 교육을 받았으며 이미지넷.

모델

YOLO11 사전 학습된 분류 모델이 여기에 나와 있습니다. 감지, 세그먼트 및 포즈 모델은 COCO 데이터 세트에서 사전 학습된 반면, 분류 모델은 ImageNet 데이터 세트에서 사전 학습되었습니다.

모델은 처음 사용할 때 최신 Ultralytics 릴리스에서 자동으로 다운로드됩니다.

모델 크기
(픽셀)
acc
top1
ACC
TOP5
속도
CPU ONNX
(ms)
속도
T4TensorRT10
(ms)
매개변수
(M)
플롭
(B) at 224
YOLO11n-cls 224 70.0 89.4 5.0 ± 0.3 1.1 ± 0.0 1.6 0.5
YOLO11s-cls 224 75.4 92.7 7.9 ± 0.2 1.3 ± 0.0 5.5 1.6
YOLO11m-cls 224 77.3 93.9 17.2 ± 0.4 2.0 ± 0.0 10.4 5.0
YOLO11l-cls 224 78.3 94.3 23.2 ± 0.3 2.8 ± 0.0 12.9 6.2
YOLO11x-cls 224 79.5 94.9 41.4 ± 0.9 3.8 ± 0.0 28.4 13.7
  • acc 값은 모델 정확도입니다. 이미지넷 데이터 세트 유효성 검사 집합.
    복제 대상 yolo val classify data=path/to/ImageNet device=0
  • 속도 이미지넷 값 이미지에 대해 평균을 구합니다. Amazon EC2 P4d 인스턴스입니다.
    복제 대상 yolo val classify data=path/to/ImageNet batch=1 device=0|cpu

기차

이미지 크기 64에서 100개의 에포크에 대해 MNIST160 데이터 세트에서 YOLO11n-cls를 훈련합니다. 사용 가능한 인수의 전체 목록은 구성 페이지를 참조하세요.

from ultralytics import YOLO

# Load a model
model = YOLO("yolo11n-cls.yaml")  # build a new model from YAML
model = YOLO("yolo11n-cls.pt")  # load a pretrained model (recommended for training)
model = YOLO("yolo11n-cls.yaml").load("yolo11n-cls.pt")  # build from YAML and transfer weights

# Train the model
results = model.train(data="mnist160", epochs=100, imgsz=64)
# Build a new model from YAML and start training from scratch
yolo classify train data=mnist160 model=yolo11n-cls.yaml epochs=100 imgsz=64

# Start training from a pretrained *.pt model
yolo classify train data=mnist160 model=yolo11n-cls.pt epochs=100 imgsz=64

# Build a new model from YAML, transfer pretrained weights to it and start training
yolo classify train data=mnist160 model=yolo11n-cls.yaml pretrained=yolo11n-cls.pt epochs=100 imgsz=64

데이터 집합 형식

YOLO 분류 데이터셋 형식은 데이터셋 가이드에서 자세히 확인할 수 있습니다.

Val

학습된 YOLO11n-cls 모델 검증하기 정확성 로 설정합니다. 인수가 필요하지 않으므로 model 교육 유지 data 및 인수를 모델 속성으로 사용합니다.

from ultralytics import YOLO

# Load a model
model = YOLO("yolo11n-cls.pt")  # load an official model
model = YOLO("path/to/best.pt")  # load a custom model

# Validate the model
metrics = model.val()  # no arguments needed, dataset and settings remembered
metrics.top1  # top1 accuracy
metrics.top5  # top5 accuracy
yolo classify val model=yolo11n-cls.pt  # val official model
yolo classify val model=path/to/best.pt # val custom model

예측

학습된 YOLO11n-cls 모델을 사용하여 이미지에 대한 예측을 실행합니다.

from ultralytics import YOLO

# Load a model
model = YOLO("yolo11n-cls.pt")  # load an official model
model = YOLO("path/to/best.pt")  # load a custom model

# Predict with the model
results = model("https://ultralytics.com/images/bus.jpg")  # predict on an image
yolo classify predict model=yolo11n-cls.pt source='https://ultralytics.com/images/bus.jpg'  # predict with official model
yolo classify predict model=path/to/best.pt source='https://ultralytics.com/images/bus.jpg' # predict with custom model

전체 보기 predict 모드 세부 정보에서 예측 페이지로 이동합니다.

내보내기

ONNX, CoreML 등과 같은 다른 형식으로 YOLO11n-cls 모델을 내보냅니다.

from ultralytics import YOLO

# Load a model
model = YOLO("yolo11n-cls.pt")  # load an official model
model = YOLO("path/to/best.pt")  # load a custom trained model

# Export the model
model.export(format="onnx")
yolo export model=yolo11n-cls.pt format=onnx  # export official model
yolo export model=path/to/best.pt format=onnx # export custom trained model

사용 가능한 YOLO11-cls 내보내기 형식은 아래 표에 나와 있습니다. 다음을 사용하여 모든 형식으로 내보낼 수 있습니다. format 인수, 즉 format='onnx' 또는 format='engine'. 내보낸 모델에서 직접 예측하거나 검증할 수 있습니다. yolo predict model=yolo11n-cls.onnx. 내보내기가 완료된 후 모델에 대한 사용 예가 표시됩니다.

형식 format 인수 모델 메타데이터 인수
PyTorch - yolo11n-cls.pt -
TorchScript torchscript yolo11n-cls.torchscript imgsz, optimize, nms, batch
ONNX onnx yolo11n-cls.onnx imgsz, half, dynamic, simplify, opset, nms, batch
OpenVINO openvino yolo11n-cls_openvino_model/ imgsz, half, dynamic, int8, nms, batch, data
TensorRT engine yolo11n-cls.engine imgsz, half, dynamic, simplify, workspace, int8, nms, batch, data
CoreML coreml yolo11n-cls.mlpackage imgsz, half, int8, nms, batch
TF SavedModel saved_model yolo11n-cls_saved_model/ imgsz, keras, int8, nms, batch
TF GraphDef pb yolo11n-cls.pb imgsz, batch
TF Lite tflite yolo11n-cls.tflite imgsz, half, int8, nms, batch, data
TF Edge TPU edgetpu yolo11n-cls_edgetpu.tflite imgsz
TF.js tfjs yolo11n-cls_web_model/ imgsz, half, int8, nms, batch
PaddlePaddle paddle yolo11n-cls_paddle_model/ imgsz, batch
MNN mnn yolo11n-cls.mnn imgsz, batch, int8, half
NCNN ncnn yolo11n-cls_ncnn_model/ imgsz, half, batch
IMX500 imx yolo11n-cls_imx_model/ imgsz, int8, data
RKNN rknn yolo11n-cls_rknn_model/ imgsz, batch, name

전체 보기 export 세부 정보에서 내보내기 페이지로 이동합니다.

자주 묻는 질문

이미지 분류에서 YOLO11 의 목적은 무엇인가요?

YOLO11 모델과 같은 yolo11n-cls.pt는 효율적인 이미지 분류를 위해 설계되었습니다. 신뢰도 점수와 함께 전체 이미지에 단일 클래스 레이블을 할당합니다. 이는 이미지 내 물체의 위치나 모양을 식별하는 대신 이미지의 특정 클래스만 알면 충분한 애플리케이션에 특히 유용합니다.

이미지 분류를 위해 YOLO11 모델을 어떻게 훈련하나요?

YOLO11 모델을 훈련하려면 Python 또는 CLI 명령을 사용할 수 있습니다. 예를 들어 yolo11n-cls 모델을 이미지 크기 64의 100개 에포크에 대해 MNIST160 데이터 세트에 적용했습니다:

from ultralytics import YOLO

# Load a model
model = YOLO("yolo11n-cls.pt")  # load a pretrained model (recommended for training)

# Train the model
results = model.train(data="mnist160", epochs=100, imgsz=64)
yolo classify train data=mnist160 model=yolo11n-cls.pt epochs=100 imgsz=64

더 많은 구성 옵션을 보려면 구성 페이지를 방문하세요.

사전 학습된 YOLO11 분류 모델은 어디에서 찾을 수 있나요?

사전 학습된 YOLO11 분류 모델은 다음에서 찾을 수 있습니다. 모델 섹션으로 이동합니다. 다음과 같은 모델 yolo11n-cls.pt, yolo11s-cls.pt, yolo11m-cls.pt등에 대해 사전 교육을 받은 후 이미지넷 데이터 세트를 쉽게 다운로드하여 다양한 이미지 분류 작업에 사용할 수 있습니다.

학습된 YOLO11 모델을 다른 형식으로 내보내려면 어떻게 해야 하나요?

학습된 YOLO11 모델을 Python 또는 CLI 명령을 사용하여 다양한 형식으로 내보낼 수 있습니다. 예를 들어 모델을 ONNX 형식으로 내보내려면 다음과 같이 하세요:

from ultralytics import YOLO

# Load a model
model = YOLO("yolo11n-cls.pt")  # load the trained model

# Export the model to ONNX
model.export(format="onnx")
yolo export model=yolo11n-cls.pt format=onnx # export the trained model to ONNX format

내보내기 옵션에 대한 자세한 내용은 내보내기 페이지를 참조하세요.

훈련된 YOLO11 분류 모델의 유효성을 검사하려면 어떻게 해야 하나요?

MNIST160과 같은 데이터 세트에서 학습된 모델의 정확도를 검증하려면 다음 Python 또는 CLI 명령을 사용할 수 있습니다:

from ultralytics import YOLO

# Load a model
model = YOLO("yolo11n-cls.pt")  # load the trained model

# Validate the model
metrics = model.val()  # no arguments needed, uses the dataset and settings from training
metrics.top1  # top1 accuracy
metrics.top5  # top5 accuracy
yolo classify val model=yolo11n-cls.pt # validate the trained model

자세한 내용은 유효성 검사 섹션을 참조하세요.

📅1 년 전 생성됨 ✏️ 업데이트 4 일 전

댓글