Deprecated CLI Arguments

Getting errors or found a bug when converting faces from a trained model? Post about them here


Forum rules

Read the FAQs and search the forum before posting a new topic.

This forum is for reporting errors with the Convert process. If you want to get tips, or better understand the Convert process, then you should look in the Convert Discussion forum.

Please mark any answers that fixed your problems so others can find the solutions.

Post Reply
User avatar
BrassNucks
Posts: 16
Joined: Wed Apr 10, 2024 2:26 am
Has thanked: 1 time
Been thanked: 3 times

Deprecated CLI Arguments

Post by BrassNucks »

Something's definitely gone wrong in the frame_name area of things. After spending a day getting scripts updated to use new arguments just to have the whole thing flop is a bit tedious right now lol, I think I have one workstation still using the old code thankfully, going to try to use that one in the interim.

Deprecation notices are one thing, and i'm used to preparing for those, but to obsolete an arg in a day's notice is a bit much. When we deprecate things, we allow the old args to work for at least a minor version, but all of my scripts came to a crashing halt as of yesterday, I think I need a good week off haha

Last edited by torzdf on Sun Apr 21, 2024 2:45 pm, edited 1 time in total.
User avatar
torzdf
Posts: 2687
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 135 times
Been thanked: 628 times

Re: Alignment files Bug

Post by torzdf »

BrassNucks wrote: Sat Apr 20, 2024 7:47 am

Deprecation notices are one thing, and i'm used to preparing for those, but to obsolete an arg in a day's notice is a bit much.

I'm not sure what you mean by this? I haven' t obsoleted any args... at least not knowingly. I deprecated a load a little while back, but the deprecated args are stilll valid.

Last edited by torzdf on Sun Apr 21, 2024 2:48 pm, edited 1 time in total.

My word is final

User avatar
BrassNucks
Posts: 16
Joined: Wed Apr 10, 2024 2:26 am
Has thanked: 1 time
Been thanked: 3 times

Re: Alignment files Bug

Post by BrassNucks »

torzdf wrote: Sat Apr 20, 2024 11:47 am

I'm not sure what you mean by this? I haven' t obsoleted any args... at least not knowingly. I deprecated a load a little while back, but the deprecated args are stilll valid.

I submitted a lengthy response with examples but my session expired and I'm not going to do it all again ... but here was the gist:

Converting using the updated faceswap on old alignments gave me this:

Code: Select all

Converting file 1 of 1, Jennifer Lopez ft. Iggy Azalea - Booty (HD 1080p).
Setting Faceswap backend to NVIDIA
04/20/2024 14:05:24 INFO     Log level set to: INFO
04/20/2024 14:05:26 WARNING  Command line option '-al' has been deprecated and will be removed from a future update. Use '-p, --alignments_path' instead
04/20/2024 14:05:26 WARNING  Command line option '-ref' has been deprecated and will be removed from a future update. Use '-r, --reference_video' instead
04/20/2024 14:05:26 WARNING  Command line option '-osc' has been deprecated and will be removed from a future update. Use '-O, --output_scale' instead
04/20/2024 14:05:27 INFO     Reading alignments from: '\\-removed-\face_vidslib\jlo\Jennifer Lopez ft. Iggy Azalea - Booty (HD 1080p)_alignments.fsa'
04/20/2024 14:05:27 INFO     Loading Model from Phaze_A plugin...
04/20/2024 14:05:27 INFO     Config item: 'autoclip' has been updated from 'True' to 'False'
04/20/2024 14:05:27 INFO     Config item: 'mixed_precision' has been updated from 'True' to 'False'
04/20/2024 14:05:27 INFO     Config item: 'loss_function' has been updated from 'smooth_loss' to 'ssim'
04/20/2024 14:05:27 INFO     Config item: 'loss_function_2' has been updated from 'ms_ssim' to 'mse'
04/20/2024 14:05:27 INFO     Config item: 'loss_function_3' has been updated from 'ffl' to 'None'
04/20/2024 14:05:27 INFO     Config item: 'loss_weight_3' has been updated from '25' to '0'
04/20/2024 14:05:27 INFO     Config item: 'loss_function_4' has been updated from 'lpips_alex' to 'None'
04/20/2024 14:05:27 INFO     Config item: 'loss_weight_4' has been updated from '5' to '0'
04/20/2024 14:05:27 INFO     Config item: 'mask_loss_function' has been updated from 'mae' to 'mse'
04/20/2024 14:05:27 INFO     Config item: 'freeze_layers' has been updated from '['visual']' to '['keras_encoder']'
04/20/2024 14:05:27 INFO     Using configuration saved in state file
04/20/2024 14:05:27 INFO     Mixed precision compatibility check (mixed_float16): OK\nYour GPU will likely run quickly with dtype policy mixed_float16 as it has compute capability of at least 7.0. Your GPU: NVIDIA GeForce RTX 4060 Ti, compute capability 8.9
04/20/2024 14:05:59 INFO     Loaded model from disk: '\\-removed-\d\sample_data\models\_Phaze-A\-removed-\phaze_a.h5'
04/20/2024 14:05:59 INFO     Loading Writer from Ffmpeg plugin...
04/20/2024 14:05:59 INFO     Outputting to: '\\-removed-\d\face_sample_data\video_src\vidout\deepfakes\phaze_a\-removed-\Jennifer Lopez ft. Iggy Azalea - Booty (HD 1080p)_converted_1.mp4'
04/20/2024 14:05:59 INFO     Loading Mask from Mask_Blend plugin...
04/20/2024 14:05:59 INFO     Loading Color from Avg_Color plugin...
04/20/2024 14:05:59 INFO     Loading Scaling from Sharpen plugin...
04/20/2024 14:07:45 ERROR    Failed to convert image: 'Jennifer Lopez ft. Iggy Azalea - Booty (HD 1080p)_002585.mp4'. Reason: 'bisenet-fp_face'
04/20/2024 14:07:45 WARNING  Convert error traceback:
Traceback (most recent call last):
  File "C:\Users\-removed-\faceswap\lib\convert.py", line 203, in process
    image = self._patch_image(item)
  File "C:\Users\-removed-\faceswap\lib\convert.py", line 267, in _patch_image
    new_image, background = self._get_new_image(predicted, frame_size)
  File "C:\Users\-removed-\faceswap\lib\convert.py", line 363, in _get_new_image
    new_face = self._pre_warp_adjustments(new_face,
  File "C:\Users\-removed-\faceswap\lib\convert.py", line 415, in _pre_warp_adjustments
    new_face, raw_mask = self._get_image_mask(new_face,
  File "C:\Users\-removed-\faceswap\lib\convert.py", line 456, in _get_image_mask
    mask_centering = detected_face.mask[self._args.mask_type].stored_centering
KeyError: 'bisenet-fp_face'

I don't know why it would KeyError only once on that frame, but the rest of it finished properly.

So I updated the powershell script to use the recommended args in the warning, and got this:

Code: Select all

Converting file 1 of 1, Jennifer Lopez ft. Iggy Azalea - Booty (HD 1080p).
Setting Faceswap backend to NVIDIA
usage: faceswap.py [-h] {extract,train,convert,gui} ...

positional arguments:
  {extract,train,convert,gui}
    extract             Extract the faces from pictures or a video
    train               Train a model for the two faces A and B
    convert             Convert source pictures or video to a new one with the face swapped
    gui                 Launch the Faceswap Graphical User Interface

options:
  -h, --help            show this help message and exit
faceswap.py: error: unrecognized arguments: --alignments_path \\-removed-\face_vidslib\jlo\Jennifer Lopez ft. Iggy Azalea - Booty (HD 1080p)_alignments.fsa --reference_video \\-removed-\face_vidslib\jlo\Jennifer Lopez ft. Iggy Azalea - Booty (HD 1080p).mp4 --output_scale 100
(faceswap) PS C:\WINDOWS\system32>

I realized it's the warning message that's wrong (showing underscores), not the code (using dashes). So, hopefully the args don't change further and I can leave the scripts alone.

Now on to the Skipped frames issue lol

User avatar
torzdf
Posts: 2687
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 135 times
Been thanked: 628 times

Re: Deprecated CLI Arguments

Post by torzdf »

I split this topic as I think we were talking 2 different issues.

Original issue is here, and my response stands (would very much like to fix it, so if you can provide data, it would be helpful. I have no interest in what the data is, just that it triggers the bug): viewtopic.php?p=10062#p10062

Thanks for the heads up on the help message re: _ v -. I will look into that.

The deprecations are to remove multiple character switches (eg -een etc) as they are bad practice and often lead to issues when parsing cli arguments. The changes made only impacted the short version of the args (eg -a) and not the long version (eg --alignments-path). The longer versions remain exactly as they were before.

The deprecated args are likely to stay valid for well over a year, so no worries there.

I believe there is 1 cli argument (in tools) where passing in the old version will not work, and it will error out. This is because it is a required argument, and I couldn't be bothered to program around it for a deprecation on a non-central part of the code.

re this:

Converting using the updated faceswap on old alignments gave me this:
I don't know why it would KeyError only once on that frame, but the rest of it finished properly.

I would suggest that (at least) one of your frames in your alignments file does not have the bisenet-fp mask generated (most likely after an edit in the Manual tool). This should be fixable with the mask tool

Either way, beyond the help message output, I belive this issue is resolved?

Last edited by torzdf on Sun Apr 21, 2024 2:58 pm, edited 1 time in total.

My word is final

User avatar
BrassNucks
Posts: 16
Joined: Wed Apr 10, 2024 2:26 am
Has thanked: 1 time
Been thanked: 3 times

Re: Deprecated CLI Arguments

Post by BrassNucks »

Yes once I corrected the underscore in the args it definitely started working properly again. As it's a script I'm using, I worry less about the length of arguments and more about the readability of them haha

Post Reply