Skip to content

Commit

Permalink
check_skip fixes (deepfakes#95)
Browse files Browse the repository at this point in the history
* extended arguments for convert re deepfakes#85

* forgot to change helptext for extended arguments.

* Added -fr --frame-range argument to convert

accepts a list of frame ranges like `-fr 40-50 90-100`

still writes out frames that havent been converted.

* added --discard-frames argument

--discard-frames discards frames not included in --frame-range instead
of writing them out unchanged.

* Made training message slightly clearer

* Revert "Made training message slightly clearer"

This reverts commit 25a9744.

* Training status now '\r's rather than newlines.
Maybe its good, maybe its bad.
I like it.

* fixing deepfakes#90 (comment)

* Fixing issues with frame-range if no frame-range is specified.

* fixes for check_skip
  • Loading branch information
gdunstone authored Feb 1, 2018
1 parent 6692a10 commit c529bd4
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions scripts/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def process(self):
if not model.load(self.arguments.swap_model):
print('Model Not Found! A valid model must be provided to continue!')
exit(1)

converter = PluginLoader.get_converter(conv_name)(model.converter(False),
blur_size=self.arguments.blur_size,
seamless_clone=self.arguments.seamless_clone,
Expand All @@ -127,16 +127,19 @@ def process(self):

for item in batch.iterator():
self.convert(converter, item)



def check_skip(self, filename):
idx = int(self.imageidxre.findall(filename)[0])
return not any(map(lambda b: b[0]<=idx<=b[1], self.frame_ranges))
try:
idx = int(self.imageidxre.findall(filename)[0])
return not any(map(lambda b: b[0]<=idx<=b[1], self.frame_ranges))
except:
return False


def convert(self, converter, item):
try:
(filename, image, faces) = item

skip = self.check_skip(filename)

if not skip: # process as normal
Expand Down

0 comments on commit c529bd4

Please sign in to comment.