styleganex template

This commit is contained in:
harisreedhar 2024-10-15 19:27:56 +05:30
parent 6957cf1de0
commit 7f827b07d6
3 changed files with 10 additions and 4 deletions

View File

@ -48,6 +48,14 @@ WARP_TEMPLATES : WarpTemplateSet =\
[ 0.50019127, 0.61942959 ],
[ 0.39032951, 0.77598822 ],
[ 0.61178945, 0.77476328 ]
]),
'styleganex_384': numpy.array(
[
[ 0.42353745, 0.52289879 ],
[ 0.57725008, 0.52319972 ],
[ 0.50123859, 0.61331904 ],
[ 0.43364461, 0.68337652 ],
[ 0.57015325, 0.68306005 ]
])
}

View File

@ -119,10 +119,8 @@ def modify_age(target_face : Face, temp_vision_frame : VisionFrame) -> VisionFra
model_size = get_model_options().get('size')
extend_crop_size = (384, 384)
face_landmark_5 = target_face.landmark_set.get('5/68').copy()
eye_center = face_landmark_5[[0, 1]].mean(axis = 0)
extend_face_landmark_5 = (face_landmark_5 - eye_center) * 1.6 + eye_center
crop_vision_frame, affine_matrix = warp_face_by_face_landmark_5(temp_vision_frame, face_landmark_5, model_template, model_size)
extend_vision_frame, extend_affine_matrix = warp_face_by_face_landmark_5(temp_vision_frame, extend_face_landmark_5, model_template, extend_crop_size)
extend_vision_frame, extend_affine_matrix = warp_face_by_face_landmark_5(temp_vision_frame, face_landmark_5, 'styleganex_384', extend_crop_size)
extend_vision_frame_raw = extend_vision_frame.copy()
box_mask = create_static_box_mask(model_size, state_manager.get_item('face_mask_blur'), (0, 0, 0, 0))
crop_masks =\

View File

@ -85,7 +85,7 @@ ProcessStep = Callable[[str, int, Args], bool]
Content = Dict[str, Any]
WarpTemplate = Literal['arcface_112_v1', 'arcface_112_v2', 'arcface_128_v2', 'ffhq_512', 'mtcnn_512']
WarpTemplate = Literal['arcface_112_v1', 'arcface_112_v2', 'arcface_128_v2', 'ffhq_512', 'mtcnn_512', 'styleganex_384']
WarpTemplateSet = Dict[WarpTemplate, NDArray[Any]]
ProcessMode = Literal['output', 'preview', 'stream']