Skip to content

Commit

Permalink
Bugfix: Extras Tab
Browse files Browse the repository at this point in the history
Bugfix: Preview Mask
Bugfix: DMDNet working on Cuda only
Updated Colab Script to also install CUDNN
  • Loading branch information
C0untFloyd committed Jan 3, 2025
1 parent 1b311e8 commit e70a129
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 9 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ Additional commandline arguments are currently unsupported and settings should b

### Changelog

**03.01.2025** v4.4.1

Bugfix: Extras Tab
Bugfix: Preview Mask
Bugfix: DMDNet working on Cuda only
Updated Colab Script to also install CUDNN


**31.12.2024** v4.4.0 Hotfix

Bugfix: Updated Colab to use present Cuda Drivers
Expand Down
7 changes: 5 additions & 2 deletions roop/ProcessOptions.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
class ProcessOptions:

def __init__(self, swap_model, processordefines:dict, face_distance, blend_ratio, swap_mode, selected_index, masking_text, imagemask, num_steps, subsample_size, show_face_area, restore_original_mouth, show_mask=False):
self.swap_modelname = swap_model
self.swap_output_size = int(swap_model.split()[-1])
if swap_model is not None:
self.swap_modelname = swap_model
self.swap_output_size = int(swap_model.split()[-1])
else:
self.swap_output_size = 128
self.processors = processordefines
self.face_distance_threshold = face_distance
self.blend_ratio = blend_ratio
Expand Down
2 changes: 1 addition & 1 deletion roop/metadata.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
name = 'roop unleashed'
version = '4.4.0'
version = '4.4.1'
4 changes: 2 additions & 2 deletions roop/processors/Enhance_DMDNet.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ def enhance_face(self, ref_faceset: FaceSet, temp_frame, face: Face):
def create(self, devicename):
self.torchdevice = torch.device(devicename)
model_dmdnet = DMDNet().to(self.torchdevice)
weights = torch.load('./models/DMDNet.pth')
model_dmdnet.load_state_dict(weights, strict=True)
weights = torch.load('./models/DMDNet.pth', map_location=self.torchdevice)
model_dmdnet.load_state_dict(weights, strict=False)

model_dmdnet.eval()
num_params = 0
Expand Down
2 changes: 1 addition & 1 deletion ui/tabs/extras_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def on_frame_process(files, filterselection, upscaleselection):
filter = next((x for x in frame_upscalers_map.keys() if x == upscaleselection), None)
if filter is not None:
processoroptions.update(frame_upscalers_map[filter])
options = ProcessOptions(processoroptions, 0, 0, "all", 0, None, None, 0, 128, False, False)
options = ProcessOptions(None, processoroptions, 0, 0, "all", 0, None, None, 0, 128, False, False)
batch_process_with_options(list_files_process, options, None)
outdir = pathlib.Path(roop.globals.output_path)
outfiles = [str(item) for item in outdir.rglob("*") if item.is_file()]
Expand Down
6 changes: 3 additions & 3 deletions ui/tabs/faceswap_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def faceswap_tab():
bt_clear_input_faces.click(fn=on_clear_input_faces, outputs=[input_faces])

bt_add_local.click(fn=on_add_local_folder, inputs=[local_folder], outputs=[bt_destfiles])
bt_preview_mask.click(fn=on_preview_mask, inputs=[preview_frame_num, bt_destfiles, clip_text, selected_mask_engine], outputs=[previewimage])
bt_preview_mask.click(fn=on_preview_mask, inputs=[ui.globals.ui_selected_swap_model, preview_frame_num, bt_destfiles, clip_text, selected_mask_engine], outputs=[previewimage])

start_event = bt_start.click(fn=start_swap,
inputs=[ui.globals.ui_selected_swap_model, output_method, ui.globals.ui_selected_enhancer, selected_face_detection, roop.globals.keep_frames, roop.globals.wait_after_extraction,
Expand Down Expand Up @@ -624,7 +624,7 @@ def on_set_frame(sender:str, frame_num):
return gen_processing_text(list_files_process[idx].startframe,list_files_process[idx].endframe)


def on_preview_mask(frame_num, files, clip_text, mask_engine):
def on_preview_mask(swap_model, frame_num, files, clip_text, mask_engine):
from roop.core import live_swap, get_processing_plugins
global is_processing

Expand All @@ -645,7 +645,7 @@ def on_preview_mask(frame_num, files, clip_text, mask_engine):
mask_engine = None
elif mask_engine == "DFL XSeg":
mask_engine = "mask_xseg"
options = ProcessOptions(get_processing_plugins(mask_engine), roop.globals.distance_threshold, roop.globals.blend_ratio,
options = ProcessOptions(swap_model, get_processing_plugins(mask_engine), roop.globals.distance_threshold, roop.globals.blend_ratio,
"all", 0, clip_text, None, 0, 128, False, False, True)

current_frame = live_swap(current_frame, options)
Expand Down

0 comments on commit e70a129

Please sign in to comment.