feat: display fps
This commit is contained in:
parent
54977ee4e3
commit
4ec2aef409
@ -5,6 +5,7 @@ import abc
|
|||||||
import datetime
|
import datetime
|
||||||
import logging
|
import logging
|
||||||
import pathlib
|
import pathlib
|
||||||
|
import time
|
||||||
import typing
|
import typing
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
@ -344,6 +345,10 @@ class PipelineController:
|
|||||||
q_nn = dev.getOutputQueue(name=self._object_node.get_stream_name(), maxSize=queue_size, # type: ignore
|
q_nn = dev.getOutputQueue(name=self._object_node.get_stream_name(), maxSize=queue_size, # type: ignore
|
||||||
blocking=False)
|
blocking=False)
|
||||||
|
|
||||||
|
start_time = time.time()
|
||||||
|
counter = 0
|
||||||
|
fps = 0
|
||||||
|
display_time = time.time()
|
||||||
self._stop = False
|
self._stop = False
|
||||||
while True:
|
while True:
|
||||||
if self._stop:
|
if self._stop:
|
||||||
@ -355,6 +360,16 @@ class PipelineController:
|
|||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
logger.exception("unexpected error: %s", str(ex))
|
logger.exception("unexpected error: %s", str(ex))
|
||||||
|
|
||||||
|
counter += 1
|
||||||
|
if (time.time() - start_time) > 1:
|
||||||
|
fps = counter / (time.time() - start_time)
|
||||||
|
counter = 0
|
||||||
|
start_time = time.time()
|
||||||
|
if (time.time() - display_time) >= 10:
|
||||||
|
display_time = time.time()
|
||||||
|
logger.info("fps: %s", fps)
|
||||||
|
|
||||||
|
|
||||||
def _loop_on_camera_events(self, q_nn: dai.DataOutputQueue, q_rgb: dai.DataOutputQueue) -> None:
|
def _loop_on_camera_events(self, q_nn: dai.DataOutputQueue, q_rgb: dai.DataOutputQueue) -> None:
|
||||||
logger.debug("wait for new frame")
|
logger.debug("wait for new frame")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user