Created
April 18, 2020 23:18
-
-
Save odigity/3a46ffeba7be475ae4dab9088808274b to your computer and use it in GitHub Desktop.
remove frames that should have been skipped by the Faceswap -een arg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import argparse | |
import re | |
import os | |
import os.path | |
def frame_of( filename ): | |
return int(re.search( '_(\d+)_\d+\.png$', filename ).group(1)) | |
parser = argparse.ArgumentParser(description='TODO') | |
parser.add_argument( 'facedir' ) | |
parser.add_argument( '-k', '--keep', type=int, default=6 ) | |
args = parser.parse_args() | |
for f in sorted(os.listdir(args.facedir)): | |
frame = frame_of(f) | |
if ((frame - 1) % args.keep != 0): | |
path = os.path.join( args.facedir, f ) | |
print( "\tDEL:", path ) | |
os.remove(path) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment