Module ivit_i.common.performance_metrics

Copyright (C) 2020-2023 Intel Corporation

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

 <http://www.apache.org/licenses/LICENSE-2.0>

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2023 Innodisk Corporation

This software is released under the MIT License.

<https://opensource.org/licenses/MIT>

Functions

def put_highlighted_text(frame, message, position, font_face, font_scale, color, thickness)

Classes

class Metric (update_times: int = 30)

Performace Metric to get FPS

Args

update_times : int, optional
every N time to update FPS. Defaults to 30.

Methods

def get_exec_time(self) ‑> Union[int, float]

Return total execute time

def get_fps(self) ‑> Union[int, float]

Return Average FPS

def get_latency(self) ‑> Union[int, float]

Return Average Latency

def log_total(self) ‑> None

Log out total information

def paint_metrics(self, frame: numpy.ndarray, position: Tuple[int, int] = (15, 30), font_scale: float = 0.75, color: Tuple[int, int, int] = (200, 10, 10), thickness: int = 2)

Draw performance stats (Latency, FPS) over frame

def reset(self) ‑> None

Setup parameters

def update(self) ‑> Union[int, float]

Return the execution time ( latency ) between the current and last call

Returns

Union[int, float]
current latency
class Timer

Simple Timer to calculate execute time

Methods

def get_time(self) ‑> Union[int, float]

Return the latest execution time

Returns

Union[int, float]
the latest execution time
def update(self) ‑> Union[int, float]

Return the execution time between the current and last call

Returns

Union[int, float]
the execution time