Override fixes and general updates (#129)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Kalen Michael <kalenmike@gmail.com>
This commit is contained in:
Glenn Jocher
2023-01-02 15:55:32 +01:00
committed by GitHub
parent d76d7af566
commit af6e3c536b
10 changed files with 64 additions and 50 deletions

View File

@ -6,16 +6,11 @@ from ultralytics import YOLO
def test_model_init():
model = YOLO("yolov8n.yaml")
model.info()
try:
YOLO()
except Exception:
print("Successfully caught constructor assert!")
raise Exception("constructor error didn't occur")
def test_model_forward():
model = YOLO("yolov8n.yaml")
img = torch.rand(512 * 512 * 3).view(1, 3, 512, 512)
img = torch.rand(1, 3, 320, 320)
model.forward(img)
model(img)
@ -23,24 +18,24 @@ def test_model_forward():
def test_model_info():
model = YOLO("yolov8n.yaml")
model.info()
model = model.load("best.pt")
model = YOLO("yolov8n.pt")
model.info(verbose=True)
def test_model_fuse():
model = YOLO("yolov8n.yaml")
model.fuse()
model.load("best.pt")
model = YOLO("yolov8n.pt")
model.fuse()
def test_visualize_preds():
model = YOLO("best.pt")
model = YOLO("yolov8n.pt")
model.predict(source="ultralytics/assets")
def test_val():
model = YOLO("best.pt")
model = YOLO("yolov8n.pt")
model.val(data="coco128.yaml", imgsz=32)
@ -54,11 +49,11 @@ def test_model_resume():
def test_model_train_pretrained():
model = YOLO("best.pt")
model = YOLO("yolov8n.pt")
model.train(data="coco128.yaml", epochs=1, imgsz=32)
model = model.new("yolov8n.yaml")
model = YOLO("yolov8n.yaml")
model.train(data="coco128.yaml", epochs=1, imgsz=32)
img = torch.rand(512 * 512 * 3).view(1, 3, 512, 512)
img = torch.rand(1, 3, 320, 320)
model(img)
@ -78,7 +73,6 @@ def test_exports():
10 TensorFlow.js tfjs _web_model False False
11 PaddlePaddle paddle _paddle_model True True
"""
from ultralytics import YOLO
from ultralytics.yolo.engine.exporter import export_formats
print(export_formats())