* Allow passing the onnxruntime to install.py

* Fix CI

* Disallow none execution providers in the UI

* Use CV2 to detect fps

* Respect trim on videos with audio

* Respect trim on videos with audio (finally)

* Implement caching to speed up preview and webcam

* Define webcam UI and webcam performance

* Remove layout from components

* Add primary buttons

* Extract benchmark and webcam settings

* Introduce compact UI settings

* Caching for IO and **** prediction

* Caching for IO and **** prediction

* Introduce face analyser caching

* Fix some typing

* Improve setup for benchmark

* Clear image cache via post process

* Fix settings in UI, Simplify restore_audio() using shortest

* Select resolution and fps via webcam ui

* Introduce read_static_image() to stop caching temp images

* Use DirectShow under Windows

* Multi-threading for webcam

* Fix typing

* Refactor frame processor

* Refactor webcam processing

* Avoid warnings due capture.isOpened()

* Resume downloads (#110)

* Introduce resumable downloads

* Fix CURL commands

* Break execution_settings into pieces

* Cosmetic changes on cv2 webcam

* Update Gradio

* Move face cache to own file

* Uniform namings for threading

* Fix sorting of get_temp_frame_paths(), extend get_temp_frames_pattern()

* Minor changes from the review

* Looks stable to tme

* Update the disclaimer

* Update the disclaimer

* Update the disclaimer
This commit is contained in:
Henry Ruhs
2023-09-19 11:21:18 +02:00
committed by GitHub
parent 7f69889c95
commit 66ea4928f8
45 changed files with 866 additions and 588 deletions

View File

@@ -1,13 +1,14 @@
import threading
from typing import Any, Optional, List
import threading
import insightface
import numpy
import facefusion.globals
from facefusion.face_cache import get_faces_cache, set_faces_cache
from facefusion.typing import Frame, Face, FaceAnalyserDirection, FaceAnalyserAge, FaceAnalyserGender
FACE_ANALYSER = None
THREAD_LOCK = threading.Lock()
THREAD_LOCK : threading.Lock = threading.Lock()
def get_face_analyser() -> Any:
@@ -38,7 +39,12 @@ def get_one_face(frame : Frame, position : int = 0) -> Optional[Face]:
def get_many_faces(frame : Frame) -> List[Face]:
try:
faces = get_face_analyser().get(frame)
faces_cache = get_faces_cache(frame)
if faces_cache:
faces = faces_cache
else:
faces = get_face_analyser().get(frame)
set_faces_cache(frame, faces)
if facefusion.globals.face_analyser_direction:
faces = sort_by_direction(faces, facefusion.globals.face_analyser_direction)
if facefusion.globals.face_analyser_age:
@@ -100,7 +106,3 @@ def filter_by_gender(faces : List[Face], gender : FaceAnalyserGender) -> List[Fa
if face['gender'] == 0 and gender == 'female':
filter_faces.append(face)
return filter_faces
def get_faces_total(frame : Frame) -> int:
return len(get_many_faces(frame))