-
Notifications
You must be signed in to change notification settings - Fork 192
Expand file tree
/
Copy path__main__.py
More file actions
37 lines (31 loc) · 1.83 KB
/
__main__.py
File metadata and controls
37 lines (31 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# ==============================================================================
# Copyright (C) 2025-2026 Intel Corporation
#
# SPDX-License-Identifier: MIT
# ==============================================================================
import argparse
import logging
from optimizer import get_optimized_pipeline # pylint: disable=no-name-in-module
parser = argparse.ArgumentParser(
prog="DLStreamer Pipeline Optimization Tool",
description="Use this tool to try and find versions of your pipeline that will run with increased performance."
)
parser.add_argument("--search-duration", default=300,
help="Duration in seconds of time which should be spent searching for optimized pipelines (default: %(default)s)")
parser.add_argument("--sample-duration", default=10,
help="Duration in seconds of sampling individual pipelines. Longer duration should offer more stable results (default: %(default)s)")
parser.add_argument("--log-level", default="INFO", choices=["CRITICAL", "FATAL", "ERROR" ,"WARN", "INFO", "DEBUG"],
help="Minimum used log level (default: %(default)s)")
parser.add_argument("pipeline", nargs="+",
help="Pipeline to be analyzed")
args=parser.parse_args()
logging.basicConfig(level=args.log_level, format="[%(name)s] [%(levelname)8s] - %(message)s")
logger = logging.getLogger(__name__)
pipeline = " ".join(args.pipeline)
try:
best_pipeline, best_fps = get_optimized_pipeline(pipeline,
float(args.search_duration),
float(args.sample_duration))
logger.info("\nBest found pipeline: %s \nwith fps: %.2f", best_pipeline, best_fps)
except Exception as e: # pylint: disable=broad-exception-caught
logger.error("Failed to optimize pipeline: %s", e)