์ฝ˜ํ…์ธ ๋กœ ๊ฑด๋„ˆ๋›ฐ๊ธฐ

์ด๋ฏธ์ง€ ๋ถ„๋ฅ˜

์ด๋ฏธ์ง€ ๋ถ„๋ฅ˜ ์˜ˆ์‹œ

์ด๋ฏธ์ง€ ๋ถ„๋ฅ˜๋Š” ์„ธ ๊ฐ€์ง€ ์ž‘์—… ์ค‘ ๊ฐ€์žฅ ๊ฐ„๋‹จํ•œ ์ž‘์—…์œผ๋กœ, ์ „์ฒด ์ด๋ฏธ์ง€๋ฅผ ๋ฏธ๋ฆฌ ์ •์˜๋œ ํด๋ž˜์Šค ์„ธํŠธ ์ค‘ ํ•˜๋‚˜๋กœ ๋ถ„๋ฅ˜ํ•˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค.

์ด๋ฏธ์ง€ ๋ถ„๋ฅ˜๊ธฐ์˜ ์ถœ๋ ฅ์€ ๋‹จ์ผ ํด๋ž˜์Šค ๋ ˆ์ด๋ธ”๊ณผ ์‹ ๋ขฐ๋„ ์ ์ˆ˜์ž…๋‹ˆ๋‹ค. ์ด๋ฏธ์ง€ ๋ถ„๋ฅ˜๋Š” ์ด๋ฏธ์ง€๊ฐ€ ์†ํ•œ ํด๋ž˜์Šค๋งŒ ์•Œ๊ณ  ์‹ถ๊ณ  ํ•ด๋‹น ํด๋ž˜์Šค์˜ ๊ฐ์ฒด๊ฐ€ ์–ด๋””์— ์žˆ๋Š”์ง€ ๋˜๋Š” ์ •ํ™•ํ•œ ๋ชจ์–‘์ด ๋ฌด์—‡์ธ์ง€ ์•Œ ํ•„์š”๊ฐ€ ์—†์„ ๋•Œ ์œ ์šฉํ•ฉ๋‹ˆ๋‹ค.



Watch: Ultralytics YOLO ์ž‘์—… ์‚ดํŽด๋ณด๊ธฐ: ์ด๋ฏธ์ง€ ๋ถ„๋ฅ˜

ํŒ

YOLOv8 ๋ชจ๋ธ ๋ถ„๋ฅ˜๋Š” -cls ์ ‘๋ฏธ์‚ฌ, ์ฆ‰ yolov8n-cls.pt ์— ๋Œ€ํ•œ ์‚ฌ์ „ ๊ต์œก์„ ๋ฐ›์•˜์œผ๋ฉฐ ์ด๋ฏธ์ง€๋„ท.

๋ชจ๋ธ

YOLOv8 ์‚ฌ์ „ ํ•™์Šต๋œ Classify ๋ชจ๋ธ์ด ์—ฌ๊ธฐ์— ๋‚˜์™€ ์žˆ์Šต๋‹ˆ๋‹ค. ๊ฐ์ง€, ์„ธ๊ทธ๋จผํŠธ ๋ฐ ํฌ์ฆˆ ๋ชจ๋ธ์€ COCO ๋ฐ์ดํ„ฐ ์„ธํŠธ์— ๋Œ€ํ•ด ์‚ฌ์ „ ํ•™์Šต๋œ ๋ฐ˜๋ฉด, ๋ถ„๋ฅ˜ ๋ชจ๋ธ์€ ImageNet ๋ฐ์ดํ„ฐ ์„ธํŠธ์— ๋Œ€ํ•ด ์‚ฌ์ „ ํ•™์Šต๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

๋ชจ๋ธ์€ ์ฒ˜์Œ ์‚ฌ์šฉํ•  ๋•Œ ์ตœ์‹  Ultralytics ๋ฆด๋ฆฌ์Šค์—์„œ ์ž๋™์œผ๋กœ ๋‹ค์šด๋กœ๋“œ๋ฉ๋‹ˆ๋‹ค.

๋ชจ๋ธ ํฌ๊ธฐ
(ํ”ฝ์…€)
ACC
TOP1
ACC
TOP5
์†๋„
CPU ONNX
(ms)
์†๋„
A100 TensorRT
(ms)
params
(M)
FLOPs
(B) at 640
YOLOv8n-cls 224 69.0 88.3 12.9 0.31 2.7 4.3
YOLOv8s-cls 224 73.8 91.7 23.4 0.35 6.4 13.5
YOLOv8m-cls 224 76.8 93.5 85.4 0.62 17.0 42.7
YOLOv8l-cls 224 76.8 93.5 163.0 0.87 37.5 99.7
YOLOv8x-cls 224 79.0 94.6 232.0 1.01 57.4 154.8
  • 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 ๋ฐ์ดํ„ฐ ์„ธํŠธ์— YOLOv8n-cls๋ฅผ ํ›ˆ๋ จํ•ฉ๋‹ˆ๋‹ค. ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ์ธ์ˆ˜์˜ ์ „์ฒด ๋ชฉ๋ก์€ ๊ตฌ์„ฑ ํŽ˜์ด์ง€๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”.

์˜ˆ์ œ

from ultralytics import YOLO

# Load a model
model = YOLO('yolov8n-cls.yaml')  # build a new model from YAML
model = YOLO('yolov8n-cls.pt')  # load a pretrained model (recommended for training)
model = YOLO('yolov8n-cls.yaml').load('yolov8n-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=yolov8n-cls.yaml epochs=100 imgsz=64

# Start training from a pretrained *.pt model
yolo classify train data=mnist160 model=yolov8n-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=yolov8n-cls.yaml pretrained=yolov8n-cls.pt epochs=100 imgsz=64

๋ฐ์ดํ„ฐ ์ง‘ํ•ฉ ํ˜•์‹

YOLO ๋ถ„๋ฅ˜ ๋ฐ์ดํ„ฐ์…‹ ํ˜•์‹์€ ๋ฐ์ดํ„ฐ์…‹ ๊ฐ€์ด๋“œ์—์„œ ์ž์„ธํžˆ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Val

ํ›ˆ๋ จ๋œ YOLOv8n-cls ๋ชจ๋ธ ์ •ํ™•๋„๋ฅผ MNIST160 ๋ฐ์ดํ„ฐ ์„ธํŠธ์—์„œ ๊ฒ€์ฆํ•ฉ๋‹ˆ๋‹ค. ์ธ์ˆ˜๋ฅผ ์ „๋‹ฌํ•  ํ•„์š”๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. model ๊ต์œก ์œ ์ง€ data ๋ฐ ์ธ์ˆ˜๋ฅผ ๋ชจ๋ธ ์†์„ฑ์œผ๋กœ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

์˜ˆ์ œ

from ultralytics import YOLO

# Load a model
model = YOLO('yolov8n-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=yolov8n-cls.pt  # val official model
yolo classify val model=path/to/best.pt  # val custom model

์˜ˆ์ธก

ํ•™์Šต๋œ YOLOv8n-cls ๋ชจ๋ธ์„ ์‚ฌ์šฉํ•˜์—ฌ ์ด๋ฏธ์ง€์— ๋Œ€ํ•œ ์˜ˆ์ธก์„ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

์˜ˆ์ œ

from ultralytics import YOLO

# Load a model
model = YOLO('yolov8n-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=yolov8n-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 ๋ชจ๋“œ ์„ธ๋ถ€ ์ •๋ณด์—์„œ ์˜ˆ์ธก ํŽ˜์ด์ง€๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.

๋‚ด๋ณด๋‚ด๊ธฐ

YOLOv8n-cls ๋ชจ๋ธ์„ ONNX, CoreML ๋“ฑ๊ณผ ๊ฐ™์€ ๋‹ค๋ฅธ ํ˜•์‹์œผ๋กœ ๋‚ด๋ณด๋ƒ…๋‹ˆ๋‹ค.

์˜ˆ์ œ

from ultralytics import YOLO

# Load a model
model = YOLO('yolov8n-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=yolov8n-cls.pt format=onnx  # export official model
yolo export model=path/to/best.pt format=onnx  # export custom trained model

์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ YOLOv8-cls ๋‚ด๋ณด๋‚ด๊ธฐ ํ˜•์‹์€ ์•„๋ž˜ ํ‘œ์— ๋‚˜์™€ ์žˆ์Šต๋‹ˆ๋‹ค. ๋‚ด๋ณด๋‚ธ ๋ชจ๋ธ์—์„œ ์ง์ ‘ ์˜ˆ์ธกํ•˜๊ฑฐ๋‚˜ ๊ฒ€์ฆํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. yolo predict model=yolov8n-cls.onnx. ๋‚ด๋ณด๋‚ด๊ธฐ๊ฐ€ ์™„๋ฃŒ๋œ ํ›„ ๋ชจ๋ธ์— ๋Œ€ํ•œ ์‚ฌ์šฉ ์˜ˆ๊ฐ€ ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค.

ํ˜•์‹ format ์ธ์ˆ˜ ๋ชจ๋ธ ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ ์ธ์ˆ˜
PyTorch - yolov8n-cls.pt โœ… -
TorchScript torchscript yolov8n-cls.torchscript โœ… imgsz, optimize
ONNX onnx yolov8n-cls.onnx โœ… imgsz, half, dynamic, simplify, opset
OpenVINO openvino yolov8n-cls_openvino_model/ โœ… imgsz, half, int8
TensorRT engine yolov8n-cls.engine โœ… imgsz, half, dynamic, simplify, workspace
CoreML coreml yolov8n-cls.mlpackage โœ… imgsz, half, int8, nms
TF SavedModel saved_model yolov8n-cls_saved_model/ โœ… imgsz, keras
TF GraphDef pb yolov8n-cls.pb โŒ imgsz
TF Lite tflite yolov8n-cls.tflite โœ… imgsz, half, int8
TF Edge TPU edgetpu yolov8n-cls_edgetpu.tflite โœ… imgsz
TF.js tfjs yolov8n-cls_web_model/ โœ… imgsz, half, int8
PaddlePaddle paddle yolov8n-cls_paddle_model/ โœ… imgsz
ncnn ncnn yolov8n-cls_ncnn_model/ โœ… imgsz, half

์ „์ฒด ๋ณด๊ธฐ export ์„ธ๋ถ€ ์ •๋ณด์—์„œ ๋‚ด๋ณด๋‚ด๊ธฐ ํŽ˜์ด์ง€๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.



์ƒ์„ฑ 2023-11-12, ์—…๋ฐ์ดํŠธ 2024-02-03
์ž‘์„ฑ์ž: glenn-jocher (8), fcakyon (1), chr043416@gmail.com (1), Laughing-q (1), AyushExel (1)

๋Œ“๊ธ€