From 0c86fdea4da2abf6b11aa1c9e63099e339e82c9b Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Thu, 19 Sep 2024 20:05:32 +0200 Subject: [PATCH] Remove pandas from exports table (#16371) Signed-off-by: UltralyticsAssistant Co-authored-by: UltralyticsAssistant --- ultralytics/engine/exporter.py | 6 ++---- ultralytics/nn/autobackend.py | 6 +++--- ultralytics/utils/benchmarks.py | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/ultralytics/engine/exporter.py b/ultralytics/engine/exporter.py index df90e838d..d4987f90b 100644 --- a/ultralytics/engine/exporter.py +++ b/ultralytics/engine/exporter.py @@ -95,9 +95,7 @@ from ultralytics.utils.torch_utils import TORCH_1_13, get_latest_opset, select_d def export_formats(): - """YOLOv8 export formats.""" - import pandas # scope for faster 'import ultralytics' - + """Ultralytics YOLO export formats.""" x = [ ["PyTorch", "-", ".pt", True, True], ["TorchScript", "torchscript", ".torchscript", True, True], @@ -113,7 +111,7 @@ def export_formats(): ["PaddlePaddle", "paddle", "_paddle_model", True, True], ["NCNN", "ncnn", "_ncnn_model", True, True], ] - return pandas.DataFrame(x, columns=["Format", "Argument", "Suffix", "CPU", "GPU"]) + return dict(zip(["Format", "Argument", "Suffix", "CPU", "GPU"], zip(*x))) def gd_outputs(gd): diff --git a/ultralytics/nn/autobackend.py b/ultralytics/nn/autobackend.py index e5ef51c03..a0e2e43bb 100644 --- a/ultralytics/nn/autobackend.py +++ b/ultralytics/nn/autobackend.py @@ -398,8 +398,8 @@ class AutoBackend(nn.Module): from ultralytics.engine.exporter import export_formats raise TypeError( - f"model='{w}' is not a supported model format. " - f"See https://docs.ultralytics.com/modes/predict for help.\n\n{export_formats()}" + f"model='{w}' is not a supported model format. Ultralytics supports: {export_formats()['Format']}\n" + f"See https://docs.ultralytics.com/modes/predict for help." ) # Load external metadata YAML @@ -653,7 +653,7 @@ class AutoBackend(nn.Module): """ from ultralytics.engine.exporter import export_formats - sf = list(export_formats().Suffix) # export suffixes + sf = export_formats()["Suffix"] # export suffixes if not is_url(p) and not isinstance(p, str): check_suffix(p, sf) # checks name = Path(p).name diff --git a/ultralytics/utils/benchmarks.py b/ultralytics/utils/benchmarks.py index 212c2f7bf..89bcc66af 100644 --- a/ultralytics/utils/benchmarks.py +++ b/ultralytics/utils/benchmarks.py @@ -85,7 +85,7 @@ def benchmark( y = [] t0 = time.time() - for i, (name, format, suffix, cpu, gpu) in export_formats().iterrows(): # index, (name, format, suffix, CPU, GPU) + for i, (name, format, suffix, cpu, gpu) in enumerate(zip(*export_formats().values())): emoji, filename = "❌", None # export defaults try: # Checks