mirror of
https://github.com/iperov/DeepFaceLive
synced 2025-08-19 13:09:58 -07:00
upd BackendBase.py
This commit is contained in:
parent
27e6e98acd
commit
932edfe875
1 changed files with 14 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
import pickle
|
import pickle
|
||||||
from typing import List, Union
|
from typing import List, Union, Tuple
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from xlib import mp as lib_mp
|
from xlib import mp as lib_mp
|
||||||
|
@ -62,7 +62,19 @@ class BackendConnectionData:
|
||||||
"""
|
"""
|
||||||
self.set_file(name, image.data)
|
self.set_file(name, image.data)
|
||||||
self._weak_heap_image_infos[name] = (image.shape, image.dtype)
|
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]:
|
def get_image(self, name : str) -> Union[np.ndarray, None]:
|
||||||
if name is None:
|
if name is None:
|
||||||
return None
|
return None
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue