mirror of
https://github.com/iperov/DeepFaceLab.git
synced 2025-07-16 10:03:41 -07:00
minor fix
This commit is contained in:
parent
d3eadbf5f3
commit
029cabea3d
3 changed files with 6 additions and 6 deletions
|
@ -30,7 +30,7 @@ def ConvertFaceAvatar (cfg, prev_temporal_frame_infos, frame_info, next_temporal
|
||||||
prd_f = cfg.superres_func(cfg.super_resolution_mode, prd_f)
|
prd_f = cfg.superres_func(cfg.super_resolution_mode, prd_f)
|
||||||
|
|
||||||
if cfg.sharpen_mode != 0 and cfg.sharpen_amount != 0:
|
if cfg.sharpen_mode != 0 and cfg.sharpen_amount != 0:
|
||||||
prd_f = cfg.sharpen_func ( prd_f, cfg.sharpen_mode, 0.003, cfg.sharpen_amount)
|
prd_f = cfg.sharpen_func ( prd_f, cfg.sharpen_mode, 3, cfg.sharpen_amount)
|
||||||
|
|
||||||
out_img = np.clip(prd_f, 0.0, 1.0)
|
out_img = np.clip(prd_f, 0.0, 1.0)
|
||||||
|
|
||||||
|
|
|
@ -332,7 +332,7 @@ def ConvertMaskedFace (cfg, frame_info, img_bgr_uint8, img_bgr, img_face_landmar
|
||||||
out_face_bgr = imagelib.LinearMotionBlur (out_face_bgr, k_size , frame_info.motion_deg)
|
out_face_bgr = imagelib.LinearMotionBlur (out_face_bgr, k_size , frame_info.motion_deg)
|
||||||
|
|
||||||
if cfg.sharpen_mode != 0 and cfg.sharpen_amount != 0:
|
if cfg.sharpen_mode != 0 and cfg.sharpen_amount != 0:
|
||||||
out_face_bgr = cfg.sharpen_func ( out_face_bgr, cfg.sharpen_mode, 0.003, cfg.sharpen_amount)
|
out_face_bgr = cfg.sharpen_func ( out_face_bgr, cfg.sharpen_mode, 3, cfg.sharpen_amount)
|
||||||
|
|
||||||
new_out = cv2.warpAffine( out_face_bgr, face_mat, img_size, img_bgr.copy(), cv2.WARP_INVERSE_MAP | cv2.INTER_CUBIC, cv2.BORDER_TRANSPARENT )
|
new_out = cv2.warpAffine( out_face_bgr, face_mat, img_size, img_bgr.copy(), cv2.WARP_INVERSE_MAP | cv2.INTER_CUBIC, cv2.BORDER_TRANSPARENT )
|
||||||
out_img = np.clip( img_bgr*(1-img_face_mask_aaa) + (new_out*img_face_mask_aaa) , 0, 1.0 )
|
out_img = np.clip( img_bgr*(1-img_face_mask_aaa) + (new_out*img_face_mask_aaa) , 0, 1.0 )
|
||||||
|
|
|
@ -84,10 +84,10 @@ class ConvertSubprocessor(Subprocessor):
|
||||||
#therefore forcing active_DeviceConfig to CPU only
|
#therefore forcing active_DeviceConfig to CPU only
|
||||||
nnlib.active_DeviceConfig = nnlib.DeviceConfig (cpu_only=True)
|
nnlib.active_DeviceConfig = nnlib.DeviceConfig (cpu_only=True)
|
||||||
|
|
||||||
def sharpen_func (img, sharpen_mode=0, radius=0.003, amount=150):
|
def sharpen_func (img, sharpen_mode=0, kernel_size=3, amount=150):
|
||||||
h,w,c = img.shape
|
if kernel_size % 2 == 0:
|
||||||
radius = max(1, round(w * radius))
|
kernel_size += 1
|
||||||
kernel_size = int((radius * 2) + 1)
|
|
||||||
if sharpen_mode == 1: #box
|
if sharpen_mode == 1: #box
|
||||||
kernel = np.zeros( (kernel_size, kernel_size), dtype=np.float32)
|
kernel = np.zeros( (kernel_size, kernel_size), dtype=np.float32)
|
||||||
kernel[ kernel_size//2, kernel_size//2] = 1.0
|
kernel[ kernel_size//2, kernel_size//2] = 1.0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue