yolo val classify data=path/to/ImageNet device=0
yolo val classify data=path/to/ImageNet batch=1 device=0|cpu
Train YOLO11n-cls on the MNIST160 dataset for 100 epochs at image size 64. For a full list of available arguments see the Configuration page.
예
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 분류 데이터셋 형식은 데이터셋 가이드에서 자세히 확인할 수 있습니다.
Validate trained YOLO11n-cls model accuracy on the MNIST160 dataset. No arguments are needed as the 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
Use a trained YOLO11n-cls model to run predictions on images.
예
전체 보기 predict
모드 세부 정보에서 예측 페이지로 이동합니다.
Export a YOLO11n-cls model to a different format like ONNX, CoreML, etc.
예
Available YOLO11-cls export formats are in the table below. You can export to any format using the format
인수, 즉 format='onnx'
또는 format='engine'
. 내보낸 모델에서 직접 예측하거나 유효성을 검사할 수 있습니다. yolo predict model=yolo11n-cls.onnx
. 내보내기가 완료된 후 모델에 대한 사용 예가 표시됩니다.
형식 | format 인수 | 모델 | 메타데이터 | 인수 |
---|---|---|---|---|
PyTorch | - | yolo11n-cls.pt | ✅ | - |
TorchScript | torchscript | yolo11n-cls.torchscript | ✅ | imgsz , optimize , batch |
ONNX | onnx | yolo11n-cls.onnx | ✅ | imgsz , half , dynamic , simplify , opset , batch |
OpenVINO | openvino | yolo11n-cls_openvino_model/ | ✅ | imgsz , half , int8 , batch |
TensorRT | engine | yolo11n-cls.engine | ✅ | imgsz , half , dynamic , simplify , workspace , int8 , batch |
CoreML | coreml | yolo11n-cls.mlpackage | ✅ | imgsz , half , int8 , nms , batch |
TF SavedModel | saved_model | yolo11n-cls_saved_model/ | ✅ | imgsz , keras , int8 , batch |
TF GraphDef | pb | yolo11n-cls.pb | ❌ | imgsz , batch |
TF Lite | tflite | yolo11n-cls.tflite | ✅ | imgsz , half , int8 , batch |
TF Edge TPU | edgetpu | yolo11n-cls_edgetpu.tflite | ✅ | imgsz |
TF.js | tfjs | yolo11n-cls_web_model/ | ✅ | imgsz , half , int8 , batch |
PaddlePaddle | paddle | yolo11n-cls_paddle_model/ | ✅ | imgsz , batch |
NCNN | ncnn | yolo11n-cls_ncnn_model/ | ✅ | imgsz , half , batch |
전체 보기 export
세부 정보에서 내보내기 페이지로 이동합니다.
YOLO11 models, such as yolo11n-cls.pt
는 효율적인 이미지 분류를 위해 설계되었습니다. 신뢰도 점수와 함께 전체 이미지에 단일 클래스 레이블을 할당합니다. 이는 이미지 내 물체의 위치나 모양을 식별하는 대신 이미지의 특정 클래스만 알면 충분한 애플리케이션에 특히 유용합니다.
To train a YOLO11 model, you can use either Python or CLI commands. For example, to train a yolo11n-cls
모델을 이미지 크기 64의 100개 에포크에 대해 MNIST160 데이터 세트에 적용했습니다:
예
더 많은 구성 옵션을 보려면 구성 페이지를 방문하세요.
Pretrained YOLO11 classification models can be found in the 모델 섹션으로 이동합니다. 다음과 같은 모델 yolo11n-cls.pt
, yolo11s-cls.pt
, yolo11m-cls.pt
등에 대해 사전 교육을 받은 후 이미지넷 데이터 세트를 쉽게 다운로드하여 다양한 이미지 분류 작업에 사용할 수 있습니다.
You can export a trained YOLO11 model to various formats using Python or CLI commands. For instance, to export a model to ONNX format:
예
내보내기 옵션에 대한 자세한 내용은 내보내기 페이지를 참조하세요.
MNIST160과 같은 데이터 세트에서 학습된 모델의 정확도를 검증하려면 다음 Python 또는 CLI 명령을 사용할 수 있습니다:
예
자세한 내용은 유효성 검사 섹션을 참조하세요.