mirror of
https://github.com/iperov/DeepFaceLive
synced 2025-07-05 20:42:12 -07:00
add missing file
This commit is contained in:
parent
84f3407198
commit
5298a68581
1 changed files with 17 additions and 0 deletions
17
xlib/image/misc.py
Normal file
17
xlib/image/misc.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
import numpy as np
|
||||
|
||||
def get_NHWC_shape(img : np.ndarray):
|
||||
"""
|
||||
returns NHWC shape where missed dims are 1
|
||||
"""
|
||||
ndim = img.ndim
|
||||
if ndim not in [2,3,4]:
|
||||
raise ValueError(f'img.ndim must be 2,3,4, not {ndim}.')
|
||||
|
||||
if ndim == 2:
|
||||
N, (H,W), C = 1, img.shape, 1
|
||||
elif ndim == 3:
|
||||
N, (H,W,C) = 1, img.shape
|
||||
else:
|
||||
N,H,W,C = img.shape
|
||||
return N,H,W,C
|
Loading…
Add table
Add a link
Reference in a new issue