mirror of
https://github.com/facefusion/facefusion.git
synced 2026-08-04 16:18:38 +02:00
* mark as next * unify the dependency checks in pre_check and add ffprobe (#1181) * drop keep_temp and the common options component (#1180) Claude-Session: https://claude.ai/code/session_01Tbcd6VWCiU4BQP1gywPr2a Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> * introduce ffprobe and ffprobe_builder (#1182) * introduce ffprobe and ffprobe_builder Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tbcd6VWCiU4BQP1gywPr2a * introduce ffprobe and ffprobe_builder Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tbcd6VWCiU4BQP1gywPr2a --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> * probe video metadata via ffprobe in vision (#1184) * probe video metadata via ffprobe in vision Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tbcd6VWCiU4BQP1gywPr2a * probe video metadata via ffprobe in vision Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tbcd6VWCiU4BQP1gywPr2a --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> * adopt the workflow task vocabulary from next major (#1185) Claude-Session: https://claude.ai/code/session_01Tbcd6VWCiU4BQP1gywPr2a Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> * introduce workflow-mode and workflow-strategy like next major (#1187) Claude-Session: https://claude.ai/code/session_01Tbcd6VWCiU4BQP1gywPr2a Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> * restrict hdr color transfer and tag the merge output as bt709 (#1188) * restrict hdr color transfer and tag the merge output as bt709 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tbcd6VWCiU4BQP1gywPr2a * restrict hdr color transfer and tag the merge output as bt709 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tbcd6VWCiU4BQP1gywPr2a * full video migration * compose the hdr fixture via the builder chain Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tbcd6VWCiU4BQP1gywPr2a * compose the test fixtures via the builder and run_ffmpeg Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tbcd6VWCiU4BQP1gywPr2a --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> * compose every test fixture via the builder and run_ffmpeg (#1189) * compose every test fixture via the builder and run_ffmpeg Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tbcd6VWCiU4BQP1gywPr2a * use loops in tests for ffmpeg stuff --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> * New Video Manager (#1191) * tiny adjustment for tests * address the review on the video manager Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tbcd6VWCiU4BQP1gywPr2a * introduce the stream strategy for the video workflow (#1192) * introduce the stream strategy for the video workflow Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tbcd6VWCiU4BQP1gywPr2a * address the review on the stream strategy Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tbcd6VWCiU4BQP1gywPr2a --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> * annotate the changes for review Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tbcd6VWCiU4BQP1gywPr2a * annotate the new tests for review Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tbcd6VWCiU4BQP1gywPr2a * match the temp pixel format help to the locale style Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tbcd6VWCiU4BQP1gywPr2a * question the set_input_seek naming Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tbcd6VWCiU4BQP1gywPr2a * question the reader and writer keys Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tbcd6VWCiU4BQP1gywPr2a * drop the review annotations from the encoder mapping tests Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tbcd6VWCiU4BQP1gywPr2a * drop the review annotations from the thread count tests Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tbcd6VWCiU4BQP1gywPr2a * drop the review annotations from the ui files Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tbcd6VWCiU4BQP1gywPr2a * capture the open review questions as annotations Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tbcd6VWCiU4BQP1gywPr2a * drop the settled annotations from the types Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tbcd6VWCiU4BQP1gywPr2a --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> * switch to ffmpeg.style for audio.py * remove todos that were never needed * fix for ffmpeg7 * Add frame_store module (#1194) * add frame_store module * rename and change tests * rename and update tests * route window read through frame_store (#1196) * route window read through frame_store * update proper id * restore todos * restore todos * go v4 style for workflow (#1197) * go v4 style for workflow * remove some todos * route chunk read through frame_store (#1198) * vision integration * Deleted read_video_chunk + read_static_video_chunk * margin decouple (#1199) * fix windows CI fail (#1200) * Cleanup Part1 (#1201) * remove some todos, improve video manager, simplify ffmpeg commands and more * do more * remove thread count for filters * Cleanup Part 2 (#1202) * tons of renaming * tons of renaming * multi reader approach * bring tests to an okay-ish state * bring drain back * improve read_video_frame speed * rename method * move variables * seek video reader only when trim frame start is larger 0 * make stream the default * Cleanup/part 3 (#1203) * remove todo * sort out workflow, to match upcoming v4 * remove look ahead * remove core namespace again * Revamp execution provider overrides/adjustments (#1206) * Split provider hooks into override/adjust with cached CoreML base Replace the single resolve_inference_providers processor hook with two: override_inference_providers (full replacement) and adjust_inference_providers (merge options onto the base providers built by create_inference_providers). This lets CoreML processors inherit ModelCacheDirectory + SpecializationStrategy from the base while layering ModelFormat/MLComputeUnits on top. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HTQCZiYjJyUX11bDpbRSiB * fix caching for execution provider by having override and adjust ways * fix caching for execution provider by having override and adjust ways * fix lint * use proper pytest fixtures --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix update preview bug (#1205) * fix update preview bug * fix update preview bug * remove guard * add is_vision_frame * Restrict the preview frame slider and the reader seek to the last frame index (#1207) * fix index bug * fix rounding bug * avoid tobytes copy (#1208) * beautify tests * hide ffmpeg warnings * simplify process_stream_frame * Use is vision frame everywhere (#1210) * use is_vision_frame everywhere * fix hash * fix lint * fix hash creation in face store * that model does not exist * update workflow ffmpeg * guard workflow (#1211) * bump version and dependencies * Update preview * switch workflow strategy to disk|memory * update preview * update preview * fix wording * last minute change workflow position * adjust wording --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> Co-authored-by: Harisreedhar <46858047+harisreedhar@users.noreply.github.com> Co-authored-by: harisreedhar <h4harisreedhar.s.s@gmail.com>
178 lines
7.2 KiB
Python
Executable File
178 lines
7.2 KiB
Python
Executable File
import logging
|
|
from typing import List, Sequence, get_args
|
|
|
|
from facefusion.common_helper import create_float_range, create_int_range
|
|
from facefusion.types import Angle, AudioEncoder, AudioFormat, AudioTypeSet, BenchmarkMode, BenchmarkResolution, BenchmarkSet, DownloadProvider, DownloadProviderSet, DownloadScope, EncoderSet, ExecutionProvider, ExecutionProviderSet, FaceDetectorModel, FaceDetectorSet, FaceLandmarkerModel, FaceMaskArea, FaceMaskAreaSet, FaceMaskRegion, FaceMaskRegionSet, FaceMaskType, FaceOccluderModel, FaceParserModel, FaceSelectorGender, FaceSelectorMode, FaceSelectorOrder, FaceSelectorRace, Gender, ImageFormat, ImageTypeSet, JobStatus, LogLevel, LogLevelSet, Race, Score, TempFrameFormat, TempPixelFormat, UiWorkflow, VideoEncoder, VideoFormat, VideoMemoryStrategy, VideoPreset, VideoTypeSet, VoiceExtractorModel, WorkflowMode, WorkflowStrategy
|
|
|
|
face_detector_set : FaceDetectorSet =\
|
|
{
|
|
'many': [ '640x640' ],
|
|
'retinaface': [ '160x160', '320x320', '480x480', '512x512', '640x640' ],
|
|
'scrfd': [ '160x160', '320x320', '480x480', '512x512', '640x640' ],
|
|
'yolo_face': [ '640x640' ],
|
|
'yunet': [ '640x640' ]
|
|
}
|
|
face_detector_models : List[FaceDetectorModel] = list(get_args(FaceDetectorModel))
|
|
face_landmarker_models : List[FaceLandmarkerModel] = list(get_args(FaceLandmarkerModel))
|
|
face_selector_modes : List[FaceSelectorMode] = list(get_args(FaceSelectorMode))
|
|
face_selector_orders : List[FaceSelectorOrder] = list(get_args(FaceSelectorOrder))
|
|
genders : List[Gender] = list(get_args(Gender))
|
|
races : List[Race] = list(get_args(Race))
|
|
face_selector_genders : List[FaceSelectorGender] = list(get_args(FaceSelectorGender))
|
|
face_selector_races : List[FaceSelectorRace] = list(get_args(FaceSelectorRace))
|
|
face_occluder_models : List[FaceOccluderModel] = list(get_args(FaceOccluderModel))
|
|
face_parser_models : List[FaceParserModel] = list(get_args(FaceParserModel))
|
|
face_mask_types : List[FaceMaskType] = list(get_args(FaceMaskType))
|
|
face_mask_area_set : FaceMaskAreaSet =\
|
|
{
|
|
'upper-face': [ 0, 1, 2, 31, 32, 33, 34, 35, 14, 15, 16, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17 ],
|
|
'lower-face': [ 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 35, 34, 33, 32, 31 ],
|
|
'mouth': [ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67 ]
|
|
}
|
|
face_mask_region_set : FaceMaskRegionSet =\
|
|
{
|
|
'skin': 1,
|
|
'left-eyebrow': 2,
|
|
'right-eyebrow': 3,
|
|
'left-eye': 4,
|
|
'right-eye': 5,
|
|
'glasses': 6,
|
|
'nose': 10,
|
|
'mouth': 11,
|
|
'upper-lip': 12,
|
|
'lower-lip': 13
|
|
}
|
|
face_mask_areas : List[FaceMaskArea] = list(get_args(FaceMaskArea))
|
|
face_mask_regions : List[FaceMaskRegion] = list(get_args(FaceMaskRegion))
|
|
|
|
voice_extractor_models : List[VoiceExtractorModel] = list(get_args(VoiceExtractorModel))
|
|
|
|
audio_type_set : AudioTypeSet =\
|
|
{
|
|
'flac': 'audio/flac',
|
|
'm4a': 'audio/mp4',
|
|
'mp3': 'audio/mpeg',
|
|
'ogg': 'audio/ogg',
|
|
'opus': 'audio/opus',
|
|
'wav': 'audio/x-wav'
|
|
}
|
|
image_type_set : ImageTypeSet =\
|
|
{
|
|
'bmp': 'image/bmp',
|
|
'jpeg': 'image/jpeg',
|
|
'png': 'image/png',
|
|
'tiff': 'image/tiff',
|
|
'webp': 'image/webp'
|
|
}
|
|
video_type_set : VideoTypeSet =\
|
|
{
|
|
'avi': 'video/x-msvideo',
|
|
'm4v': 'video/mp4',
|
|
'mkv': 'video/x-matroska',
|
|
'mp4': 'video/mp4',
|
|
'mpeg': 'video/mpeg',
|
|
'mov': 'video/quicktime',
|
|
'mxf': 'application/mxf',
|
|
'webm': 'video/webm',
|
|
'wmv': 'video/x-ms-wmv'
|
|
}
|
|
workflow_modes : List[WorkflowMode] = list(get_args(WorkflowMode))
|
|
workflow_strategies : List[WorkflowStrategy] = list(get_args(WorkflowStrategy))
|
|
|
|
audio_formats : List[AudioFormat] = list(get_args(AudioFormat))
|
|
image_formats : List[ImageFormat] = list(get_args(ImageFormat))
|
|
video_formats : List[VideoFormat] = list(get_args(VideoFormat))
|
|
temp_frame_formats : List[TempFrameFormat] = list(get_args(TempFrameFormat))
|
|
temp_pixel_formats : List[TempPixelFormat] = list(get_args(TempPixelFormat))
|
|
|
|
output_audio_encoders : List[AudioEncoder] = list(get_args(AudioEncoder))
|
|
output_video_encoders : List[VideoEncoder] = list(get_args(VideoEncoder))
|
|
output_encoder_set : EncoderSet =\
|
|
{
|
|
'audio': output_audio_encoders,
|
|
'video': output_video_encoders
|
|
}
|
|
output_video_presets : List[VideoPreset] = list(get_args(VideoPreset))
|
|
|
|
benchmark_modes : List[BenchmarkMode] = list(get_args(BenchmarkMode))
|
|
benchmark_set : BenchmarkSet =\
|
|
{
|
|
'240p': '.assets/examples/target-240p.mp4',
|
|
'360p': '.assets/examples/target-360p.mp4',
|
|
'540p': '.assets/examples/target-540p.mp4',
|
|
'720p': '.assets/examples/target-720p.mp4',
|
|
'1080p': '.assets/examples/target-1080p.mp4',
|
|
'1440p': '.assets/examples/target-1440p.mp4',
|
|
'2160p': '.assets/examples/target-2160p.mp4'
|
|
}
|
|
benchmark_resolutions : List[BenchmarkResolution] = list(get_args(BenchmarkResolution))
|
|
|
|
execution_provider_set : ExecutionProviderSet =\
|
|
{
|
|
'cuda': 'CUDAExecutionProvider',
|
|
'tensorrt': 'TensorrtExecutionProvider',
|
|
'rocm': 'ROCMExecutionProvider',
|
|
'migraphx': 'MIGraphXExecutionProvider',
|
|
'coreml': 'CoreMLExecutionProvider',
|
|
'openvino': 'OpenVINOExecutionProvider',
|
|
'qnn': 'QNNExecutionProvider',
|
|
'directml': 'DmlExecutionProvider',
|
|
'cpu': 'CPUExecutionProvider'
|
|
}
|
|
execution_providers : List[ExecutionProvider] = list(get_args(ExecutionProvider))
|
|
download_provider_set : DownloadProviderSet =\
|
|
{
|
|
'github':
|
|
{
|
|
'urls':
|
|
[
|
|
'https://github.com'
|
|
],
|
|
'path': '/facefusion/facefusion-assets/releases/download/{base_name}/{file_name}'
|
|
},
|
|
'huggingface':
|
|
{
|
|
'urls':
|
|
[
|
|
'https://huggingface.co',
|
|
'https://hf-mirror.com'
|
|
],
|
|
'path': '/facefusion/{base_name}/resolve/main/{file_name}'
|
|
}
|
|
}
|
|
download_providers : List[DownloadProvider] = list(get_args(DownloadProvider))
|
|
download_scopes : List[DownloadScope] = list(get_args(DownloadScope))
|
|
|
|
video_memory_strategies : List[VideoMemoryStrategy] = list(get_args(VideoMemoryStrategy))
|
|
|
|
log_level_set : LogLevelSet =\
|
|
{
|
|
'error': logging.ERROR,
|
|
'warn': logging.WARNING,
|
|
'info': logging.INFO,
|
|
'debug': logging.DEBUG
|
|
}
|
|
log_levels : List[LogLevel] = list(get_args(LogLevel))
|
|
|
|
ui_workflows : List[UiWorkflow] = list(get_args(UiWorkflow))
|
|
job_statuses : List[JobStatus] = list(get_args(JobStatus))
|
|
|
|
benchmark_cycle_count_range : Sequence[int] = create_int_range(1, 10, 1)
|
|
execution_thread_count_range : Sequence[int] = create_int_range(1, 32, 1)
|
|
face_detector_margin_range : Sequence[int] = create_int_range(0, 100, 1)
|
|
face_detector_angles : Sequence[Angle] = create_int_range(0, 270, 90)
|
|
face_detector_score_range : Sequence[Score] = create_float_range(0.0, 1.0, 0.05)
|
|
face_landmarker_score_range : Sequence[Score] = create_float_range(0.0, 1.0, 0.05)
|
|
face_mask_blur_range : Sequence[float] = create_float_range(0.0, 1.0, 0.05)
|
|
face_mask_padding_range : Sequence[int] = create_int_range(0, 100, 1)
|
|
face_selector_age_range : Sequence[int] = create_int_range(0, 100, 1)
|
|
reference_face_distance_range : Sequence[float] = create_float_range(0.0, 1.0, 0.05)
|
|
face_tracker_score_range : Sequence[Score] = create_float_range(0.0, 0.5, 0.05)
|
|
target_frame_amount_range : Sequence[int] = create_int_range(0, 10, 1)
|
|
output_image_quality_range : Sequence[int] = create_int_range(0, 100, 1)
|
|
output_image_scale_range : Sequence[float] = create_float_range(0.25, 8.0, 0.25)
|
|
output_audio_quality_range : Sequence[int] = create_int_range(0, 100, 1)
|
|
output_audio_volume_range : Sequence[int] = create_int_range(0, 100, 1)
|
|
output_video_quality_range : Sequence[int] = create_int_range(0, 100, 1)
|
|
output_video_scale_range : Sequence[float] = create_float_range(0.25, 8.0, 0.25)
|