Skip to content

Commit 3bdea72

Browse files
committed
fix
1 parent 0c7f439 commit 3bdea72

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

main.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def __init__(self, model: str, model_precision: str, model_dir: str, model_expor
8989
try:
9090
is_gpu = device != "cpu"
9191
model_path = Path(model_dir) / model
92-
exported_model_path = Path(model_export_dir) / model_path.with_suffix(f'_{model_precision}.engine').name
92+
exported_model_path = Path(model_export_dir) / model_path.with_suffix(f'.{model_precision}.engine').name
9393

9494
if is_gpu and not Path(exported_model_path).exists():
9595
logging.info(f"Exporting model for GPU usage: {exported_model_path}")
@@ -102,7 +102,9 @@ def __init__(self, model: str, model_precision: str, model_dir: str, model_expor
102102
os.makedirs(os.path.dirname(exported_model_path), exist_ok=True)
103103
shutil.move(temp_export_path, exported_model_path)
104104

105-
self.model = YOLO(exported_model_path if is_gpu else model_path)
105+
self.model = YOLO(
106+
model=exported_model_path if is_gpu else model_path,
107+
)
106108
logging.info(f"Successfully loaded model from {exported_model_path if is_gpu else model_path}")
107109
except Exception as e:
108110
logging.error(f"Failed to load YOLO model: {e}")

0 commit comments

Comments
 (0)