Error Handling

Preview Tool: Catch no faces found Error
Training: Raise unhandled ValueErrors
This commit is contained in:
torzdf
2019-07-08 11:28:44 +00:00
parent 541498970e
commit ce45f01e4a
2 changed files with 11 additions and 1 deletions
+3
View File
@@ -197,6 +197,9 @@ class ModelBase():
"\nYou should restore weights from a snapshot or from backup files. "
"You can use the 'Restore' Tool to restore from backup.")
raise FaceswapError(msg) from err
if "multi_gpu_model" in str(err).lower():
raise FaceswapError(str(err)) from err
raise err
self.log_summary()
self.compile_predictors(initialize=True)
+8 -1
View File
@@ -22,7 +22,7 @@ from lib.convert import Converter
from lib.faces_detect import DetectedFace
from lib.model.masks import get_available_masks
from lib.multithreading import MultiThread
from lib.utils import set_system_verbosity
from lib.utils import FaceswapError, set_system_verbosity
from lib.queue_manager import queue_manager
from scripts.fsmedia import Alignments, Images
from scripts.convert import Predict
@@ -184,6 +184,13 @@ class Samples():
retval = [filename for filename in filelist
if self.alignments.frame_has_faces(os.path.basename(filename))]
logger.debug("Filtered out frames: %s", self.images.images_found - len(retval))
try:
assert retval
except AssertionError as err:
msg = ("No faces were found in any of the frames passed in. Make sure you are passing "
"in a frames source rather than extracted faces, and that you have provided "
"the correct alignments file.")
raise FaceswapError(msg) from err
return retval
def get_indices(self):