New YOLOv8 Results() class for prediction outputs (#314)
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com> Co-authored-by: Laughing-q <1185102784@qq.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Laughing <61612323+Laughing-q@users.noreply.github.com> Co-authored-by: Viet Nhat Thai <60825385+vietnhatthai@users.noreply.github.com> Co-authored-by: Paula Derrenger <107626595+pderrenger@users.noreply.github.com>
This commit is contained in:
parent
0cb87f7dd3
commit
c6985da9de
32 changed files with 813 additions and 259 deletions
|
|
@ -1,6 +1,6 @@
|
|||
# Ultralytics YOLO 🚀, GPL-3.0 license
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
from ultralytics.yolo.utils import ROOT, SETTINGS
|
||||
|
|
@ -9,30 +9,35 @@ MODEL = Path(SETTINGS['weights_dir']) / 'yolov8n'
|
|||
CFG = 'yolov8n'
|
||||
|
||||
|
||||
def run(cmd):
|
||||
# Run a subprocess command with check=True
|
||||
subprocess.run(cmd.split(), check=True)
|
||||
|
||||
|
||||
def test_checks():
|
||||
os.system('yolo mode=checks')
|
||||
run('yolo mode=checks')
|
||||
|
||||
|
||||
# Train checks ---------------------------------------------------------------------------------------------------------
|
||||
def test_train_det():
|
||||
os.system(f'yolo mode=train task=detect model={CFG}.yaml data=coco8.yaml imgsz=32 epochs=1')
|
||||
run(f'yolo mode=train task=detect model={CFG}.yaml data=coco8.yaml imgsz=32 epochs=1')
|
||||
|
||||
|
||||
def test_train_seg():
|
||||
os.system(f'yolo mode=train task=segment model={CFG}-seg.yaml data=coco8-seg.yaml imgsz=32 epochs=1')
|
||||
run(f'yolo mode=train task=segment model={CFG}-seg.yaml data=coco8-seg.yaml imgsz=32 epochs=1')
|
||||
|
||||
|
||||
def test_train_cls():
|
||||
os.system(f'yolo mode=train task=classify model={CFG}-cls.yaml data=mnist160 imgsz=32 epochs=1')
|
||||
run(f'yolo mode=train task=classify model={CFG}-cls.yaml data=mnist160 imgsz=32 epochs=1')
|
||||
|
||||
|
||||
# Val checks -----------------------------------------------------------------------------------------------------------
|
||||
def test_val_detect():
|
||||
os.system(f'yolo mode=val task=detect model={MODEL}.pt data=coco8.yaml imgsz=32 epochs=1')
|
||||
run(f'yolo mode=val task=detect model={MODEL}.pt data=coco8.yaml imgsz=32 epochs=1')
|
||||
|
||||
|
||||
def test_val_segment():
|
||||
os.system(f'yolo mode=val task=segment model={MODEL}-seg.pt data=coco8-seg.yaml imgsz=32 epochs=1')
|
||||
run(f'yolo mode=val task=segment model={MODEL}-seg.pt data=coco8-seg.yaml imgsz=32 epochs=1')
|
||||
|
||||
|
||||
def test_val_classify():
|
||||
|
|
@ -41,11 +46,11 @@ def test_val_classify():
|
|||
|
||||
# Predict checks -------------------------------------------------------------------------------------------------------
|
||||
def test_predict_detect():
|
||||
os.system(f"yolo mode=predict model={MODEL}.pt source={ROOT / 'assets'}")
|
||||
run(f"yolo mode=predict task=detect model={MODEL}.pt source={ROOT / 'assets'}")
|
||||
|
||||
|
||||
def test_predict_segment():
|
||||
os.system(f"yolo mode=predict model={MODEL}-seg.pt source={ROOT / 'assets'}")
|
||||
run(f"yolo mode=predict task=segment model={MODEL}-seg.pt source={ROOT / 'assets'}")
|
||||
|
||||
|
||||
def test_predict_classify():
|
||||
|
|
@ -54,12 +59,12 @@ def test_predict_classify():
|
|||
|
||||
# Export checks --------------------------------------------------------------------------------------------------------
|
||||
def test_export_detect_torchscript():
|
||||
os.system(f'yolo mode=export model={MODEL}.pt format=torchscript')
|
||||
run(f'yolo mode=export model={MODEL}.pt format=torchscript')
|
||||
|
||||
|
||||
def test_export_segment_torchscript():
|
||||
os.system(f'yolo mode=export model={MODEL}-seg.pt format=torchscript')
|
||||
run(f'yolo mode=export model={MODEL}-seg.pt format=torchscript')
|
||||
|
||||
|
||||
def test_export_classify_torchscript():
|
||||
pass
|
||||
run(f'yolo mode=export model={MODEL}-cls.pt format=torchscript')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue