Skip to content

Commit 043d20e

Browse files
Chizkiyahunaushir
authored andcommitted
devices: imx500: Fix IMX500.get_kpi_info()
Pull the KPI values directly from the tuple instead of decoding a byte array. Signed-off-by: Chizkiyahu Raful
1 parent 98a0d46 commit 043d20e

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

picamera2/devices/imx500/imx500.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -581,14 +581,11 @@ def __get_input_tensor_info(self, tensor_info) -> tuple[str, int, int, int]:
581581

582582
@staticmethod
583583
def get_kpi_info(metadata: dict) -> Optional[tuple[float, float]]:
584-
"""Return the KPI parameters in the form (dnn_runtime, dsp_runtime)."""
584+
"""Return the KPI parameters in the form (dnn_runtime, dsp_runtime) in milliseconds."""
585585
kpi_info = metadata.get('CnnKpiInfo')
586586
if kpi_info is None:
587587
return None
588-
if type(kpi_info) not in [bytes, bytearray]:
589-
kpi_info = bytes(kpi_info)
590-
591-
dnn_runtime, dsp_runtime = struct.unpack('II', kpi_info)
588+
dnn_runtime, dsp_runtime = kpi_info[0], kpi_info[1]
592589
return dnn_runtime / 1000, dsp_runtime / 1000
593590

594591
def __set_network_firmware(self, network_filename: str):

0 commit comments

Comments
 (0)