mirror of
https://github.com/iperov/DeepFaceLive
synced 2025-08-20 13:33:25 -07:00
fix
This commit is contained in:
parent
be6ac8643f
commit
458816dbc9
1 changed files with 13 additions and 13 deletions
|
@ -231,16 +231,16 @@ class FaceMergerWorker(BackendWorker):
|
||||||
face_swap_img_t = lib_cl.Tensor.from_value(face_swap_img)
|
face_swap_img_t = lib_cl.Tensor.from_value(face_swap_img)
|
||||||
face_swap_img_t = face_swap_img_t.transpose( (2,0,1), op_text='O = ((O_TYPE)I) / 255.0', dtype=np.float32)
|
face_swap_img_t = face_swap_img_t.transpose( (2,0,1), op_text='O = ((O_TYPE)I) / 255.0', dtype=np.float32)
|
||||||
|
|
||||||
frame_face_mask_t = lib_cl.remap_np_affine(face_mask_t, aligned_to_source_uni_mat, interpolation=interpolation, output_size=(frame_height, frame_width) )
|
frame_face_mask_t = lib_cl.remap_np_affine(face_mask_t, aligned_to_source_uni_mat, interpolation=lib_cl.EInterpolation.LINEAR, output_size=(frame_height, frame_width), post_op_text='O = (O <= (1.0/255.0) ? 0.0 : O > 1.0 ? 1.0 : O);' )
|
||||||
frame_face_swap_img_t = lib_cl.remap_np_affine(face_swap_img_t, aligned_to_source_uni_mat, interpolation=interpolation, output_size=(frame_height, frame_width) )
|
frame_face_swap_img_t = lib_cl.remap_np_affine(face_swap_img_t, aligned_to_source_uni_mat, interpolation=interpolation, output_size=(frame_height, frame_width), post_op_text='O = clamp(O, 0.0, 1.0);' )
|
||||||
|
|
||||||
frame_image_t = lib_cl.Tensor.from_value(frame_image).transpose( (2,0,1) )
|
frame_image_t = lib_cl.Tensor.from_value(frame_image).transpose( (2,0,1) )
|
||||||
|
|
||||||
opacity = state.face_opacity
|
opacity = state.face_opacity
|
||||||
if opacity == 1.0:
|
if opacity == 1.0:
|
||||||
frame_final_t = lib_cl.any_wise('float I0f = (((float)I0) / 255.0); I1 = (I1 <= (1.0/255.0) ? 0.0 : I1 > 1.0 ? 1.0 : I1); O = I0f*(1.0-I1) + I2*I1', frame_image_t, frame_face_mask_t, frame_face_swap_img_t, dtype=np.float32)
|
frame_final_t = lib_cl.any_wise('float I0f = (((float)I0) / 255.0); O = I0f*(1.0-I1) + I2*I1', frame_image_t, frame_face_mask_t, frame_face_swap_img_t, dtype=np.float32)
|
||||||
else:
|
else:
|
||||||
frame_final_t = lib_cl.any_wise('float I0f = (((float)I0) / 255.0); I1 = (I1 <= (1.0/255.0) ? 0.0 : I1 > 1.0 ? 1.0 : I1); O = I0f*(1.0-I1) + I0f*I1*(1.0-I3) + I2*I1*I3', frame_image_t, frame_face_mask_t, frame_face_swap_img_t, opacity, dtype=np.float32)
|
frame_final_t = lib_cl.any_wise('float I0f = (((float)I0) / 255.0); O = I0f*(1.0-I1) + I0f*I1*(1.0-I3) + I2*I1*I3', frame_image_t, frame_face_mask_t, frame_face_swap_img_t, opacity, dtype=np.float32)
|
||||||
|
|
||||||
return frame_final_t.transpose( (1,2,0) ).np()
|
return frame_final_t.transpose( (1,2,0) ).np()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue