mirror of
https://github.com/s0md3v/roop.git
synced 2025-12-06 18:08:29 +00:00
Switch get_one_face() to pick the largest one
This commit is contained in:
parent
68f534c35f
commit
6f862d1d48
@ -20,9 +20,10 @@ def get_face_analyser() -> Any:
|
||||
|
||||
|
||||
def get_one_face(frame: Frame) -> Any:
|
||||
face = get_face_analyser().get(frame)
|
||||
faces = get_face_analyser().get(frame)
|
||||
try:
|
||||
return min(face, key=lambda x: x.bbox[0])
|
||||
# Pick the largest face (x2 - x1) * (y2 - y1)
|
||||
return max(faces, key=lambda x: (x.bbox[2] - x.bbox[0]) * (x.bbox[3] - x.bbox[1]))
|
||||
except ValueError:
|
||||
return None
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user