mirror of
https://github.com/facefusion/facefusion.git
synced 2026-07-29 21:38:51 +02:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
844f22db91 | ||
|
|
45b8ad93ee |
@@ -11,7 +11,7 @@ FACE_STORE : FaceStore = {}
|
|||||||
|
|
||||||
def get_faces(vision_frame : VisionFrame) -> Optional[List[Face]]:
|
def get_faces(vision_frame : VisionFrame) -> Optional[List[Face]]:
|
||||||
if numpy.any(vision_frame):
|
if numpy.any(vision_frame):
|
||||||
vision_hash = create_hash(vision_frame.data)
|
vision_hash = create_hash(vision_frame.tobytes())
|
||||||
|
|
||||||
if FACE_STORE.get(vision_hash):
|
if FACE_STORE.get(vision_hash):
|
||||||
return FACE_STORE.get(vision_hash).get('faces')
|
return FACE_STORE.get(vision_hash).get('faces')
|
||||||
@@ -21,7 +21,7 @@ def get_faces(vision_frame : VisionFrame) -> Optional[List[Face]]:
|
|||||||
|
|
||||||
def set_faces(vision_frame : VisionFrame, faces : List[Face]) -> None:
|
def set_faces(vision_frame : VisionFrame, faces : List[Face]) -> None:
|
||||||
if numpy.any(vision_frame):
|
if numpy.any(vision_frame):
|
||||||
vision_hash = create_hash(vision_frame.data)
|
vision_hash = create_hash(vision_frame.tobytes())
|
||||||
FACE_STORE.setdefault(vision_hash,
|
FACE_STORE.setdefault(vision_hash,
|
||||||
{
|
{
|
||||||
'lock': threading.Lock()
|
'lock': threading.Lock()
|
||||||
@@ -30,7 +30,7 @@ def set_faces(vision_frame : VisionFrame, faces : List[Face]) -> None:
|
|||||||
|
|
||||||
def resolve_lock(vision_frame : VisionFrame) -> threading.Lock:
|
def resolve_lock(vision_frame : VisionFrame) -> threading.Lock:
|
||||||
if numpy.any(vision_frame):
|
if numpy.any(vision_frame):
|
||||||
vision_hash = create_hash(vision_frame.data)
|
vision_hash = create_hash(vision_frame.tobytes())
|
||||||
return FACE_STORE.setdefault(vision_hash,
|
return FACE_STORE.setdefault(vision_hash,
|
||||||
{
|
{
|
||||||
'lock': threading.Lock()
|
'lock': threading.Lock()
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ def run_ffmpeg(commands : List[Command]) -> subprocess.Popen[bytes]:
|
|||||||
|
|
||||||
def open_ffmpeg(commands : List[Command]) -> subprocess.Popen[bytes]:
|
def open_ffmpeg(commands : List[Command]) -> subprocess.Popen[bytes]:
|
||||||
commands = ffmpeg_builder.run(commands)
|
commands = ffmpeg_builder.run(commands)
|
||||||
return subprocess.Popen(commands, stdin = subprocess.PIPE, stdout = subprocess.PIPE, pipesize = 1024 * 1024)
|
return subprocess.Popen(commands, stdin = subprocess.PIPE, stdout = subprocess.PIPE)
|
||||||
|
|
||||||
|
|
||||||
def create_video_reader(video_path : str, frame_number : int, video_metadata : VideoReaderMetadata) -> subprocess.Popen[bytes]:
|
def create_video_reader(video_path : str, frame_number : int, video_metadata : VideoReaderMetadata) -> subprocess.Popen[bytes]:
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ def start(webcam_device_id : int, webcam_mode : WebcamMode, webcam_resolution :
|
|||||||
yield capture_vision_frame
|
yield capture_vision_frame
|
||||||
if webcam_mode in [ 'udp', 'v4l2' ]:
|
if webcam_mode in [ 'udp', 'v4l2' ]:
|
||||||
try:
|
try:
|
||||||
stream.stdin.write(capture_vision_frame.data)
|
stream.stdin.write(capture_vision_frame.tobytes())
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ def get_writer(video_path : str, temp_video_fps : Fps, temp_video_resolution : R
|
|||||||
|
|
||||||
|
|
||||||
def write_video_frame(video_writer : VideoWriter, vision_frame : VisionFrame) -> None:
|
def write_video_frame(video_writer : VideoWriter, vision_frame : VisionFrame) -> None:
|
||||||
video_writer.get('process').stdin.write(vision_frame.data)
|
video_writer.get('process').stdin.write(vision_frame.tobytes())
|
||||||
|
|
||||||
|
|
||||||
def close_video_writer(video_writer : VideoWriter) -> bool:
|
def close_video_writer(video_writer : VideoWriter) -> bool:
|
||||||
|
|||||||
Reference in New Issue
Block a user