DeepFaceLab icon indicating copy to clipboard operation
DeepFaceLab copied to clipboard

Extractor and XSeg freezes

Open faad3 opened this issue 3 years ago • 0 comments

For my needs, I run the extractor and XSeg in a cycle, processing one photo at a time. The problem is that after the first iteration, the process freezes. The code looks like this:

from DeepFaceLab.mainscripts.XSegUtil import apply_xseg
from DeepFaceLab.mainscripts.Extractor import ExtractSubprocessor
from DeepFaceLab.facelib import FaceType

from DeepFaceLab.core.leras import nn
nn.initialize_main_env()

def extract(filename,output_path = '/app/.temp'):
    filename = Path(filename)
    output_path = Path(output_path)
    device_config = nn.DeviceConfig.CPU()
                    
    data = ExtractSubprocessor([ ExtractSubprocessor.Data(Path(filename))],
                                         'all',
                                         image_size = 512,
                                         jpeg_quality = 100,
                                         face_type=FaceType.fromString('whole_face'),
                                         output_debug_path = None,
                                         max_faces_from_image=1,
                                         final_output_path=output_path,
                                         device_config=device_config).run()

paths = [...]
output_path = ...

for path in paths:
    data = extract(path,output_path)
    apply_xseg(output_path)

Any ideas how to get rid of this problem?

faad3 avatar Jul 27 '22 10:07 faad3