Gradio demo crops/zooms in on face
mitchellfox opened this issue · comments
Regarding the latest commit which includes a gradio demo, when using vid2vid I noticed that with the gradio demo it is cropping/zooming in on the face in the output, it also modifies the source photo to be cropped/zoomed in on the face. Whereas, in huggingface demo the output retained the body from the source image and scaled instead of cropping.
Is there a parameter or config where this can be switched back to scaling instead of cropping?
Thanks for your amazing work!
It is something to do with this
https://huggingface.co/spaces/ZJYang/AniPortrait_official/blob/main/src/utils/crop_face_single.py
in this main repo it is https://github.com/Zejun-Yang/AniPortrait/blob/main/src/utils/util.py#L131 set at 1.5
def crop_face(img, lmk_extractor, expand=1.5):
result = lmk_extractor(img) # cv2 BGR
if result is None:
return None
when I changed expand in crop_single to 1.1 it resulted in this, even more zoomed in, so it is do with cropfacesingle in the huggingface app. I guess somewhere in the main repo there is an equivalent
512x512_0923.mp4
Expand 3