From 932edfe8750666304979ce3cbd0783e2ce3c89a5 Mon Sep 17 00:00:00 2001 From: iperov Date: Thu, 30 Sep 2021 18:20:24 +0400 Subject: [PATCH] upd BackendBase.py --- apps/DeepFaceLive/backend/BackendBase.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/apps/DeepFaceLive/backend/BackendBase.py b/apps/DeepFaceLive/backend/BackendBase.py index 6dba976..fc7a6bd 100644 --- a/apps/DeepFaceLive/backend/BackendBase.py +++ b/apps/DeepFaceLive/backend/BackendBase.py @@ -1,6 +1,6 @@ import multiprocessing import pickle -from typing import List, Union +from typing import List, Union, Tuple import numpy as np from xlib import mp as lib_mp @@ -62,7 +62,19 @@ class BackendConnectionData: """ self.set_file(name, image.data) self._weak_heap_image_infos[name] = (image.shape, image.dtype) - + + def get_image_shape_dtype(self, name:str) -> Union[None, Tuple[List, np.dtype]]: + """ + returns (image shape, dtype) or (None, None) if file does not exist + """ + if name is None: + return None + image_info = self._weak_heap_image_infos.get(name, None) + if image_info is not None: + shape, dtype = image_info + return shape, dtype + return (None, None) + def get_image(self, name : str) -> Union[np.ndarray, None]: if name is None: return None