{"record":{"id":"cf59fa75e8d5d05e","repo":"deepfakes/faceswap","slug":"predicted-mask-selected-but-the-model-was-not-tra","errorCode":null,"errorMessage":"Predicted Mask selected, but the model was not trained with a mask and no masks are stored in the Alignments File.\\nYou should generate the required masks with the Mask Tool or set the Mask Type to `none`.","messagePattern":"Predicted Mask selected, but the model was not trained with a mask and no masks are stored in the Alignments File\\.\\\\nYou should generate the required masks with the Mask Tool or set the Mask Type to `none`\\.","errorType":"exception","errorClass":"FaceswapError","httpStatus":null,"severity":"error","filePath":"scripts/convert.py","lineNumber":197,"sourceCode":"        if (not self._args.on_the_fly and\n                self._args.mask_type not in (\"none\", \"predicted\", \"extended\", \"components\") and\n                not self._alignments.mask_is_valid(self._args.mask_type)):\n            msg = (f\"You have selected the Mask Type `{self._args.mask_type}` but at least one \"\n                   \"face does not have this mask stored in the Alignments File.\\nYou should \"\n                   \"generate the required masks with the Mask Tool or set the Mask Type option to \"\n                   \"an existing Mask Type.\\nA summary of existing masks is as follows:\\nTotal \"\n                   f\"faces: {self._alignments.faces_count}, \"\n                   f\"Masks: {self._alignments.mask_summary}\")\n            raise FaceswapError(msg)\n\n        if self._args.mask_type == \"predicted\" and not self._predictor.has_predicted_mask:\n            available_masks = [k for k, v in self._alignments.mask_summary.items()\n                               if k != \"none\" and v == self._alignments.faces_count]\n            if not available_masks:\n                msg = (\"Predicted Mask selected, but the model was not trained with a mask and no \"\n                       \"masks are stored in the Alignments File.\\nYou should generate the \"\n                       \"required masks with the Mask Tool or set the Mask Type to `none`.\")\n                raise FaceswapError(msg)\n            mask_type = available_masks[0]\n            logger.warning(\"Predicted Mask selected, but the model was not trained with a \"\n                           \"mask. Selecting first available mask: '%s'\", mask_type)\n            self._args.mask_type = mask_type\n\n    def _add_queues(self) -> None:\n        \"\"\"Add the queues for in, patch and out.\"\"\"\n        logger.debug(\"Adding queues. Queue size: %s\", self._queue_size)\n        for qname in (\"convert_in\", \"convert_out\", \"patch\"):\n            queue_manager.add_queue(qname, self._queue_size)\n\n    def _get_threads(self) -> MultiThread:\n        \"\"\"Get the threads for patching the converted faces onto the frames.\n\n        Returns\n        -------\n        The threads that perform the patching of swapped faces onto the output frames\n        \"\"\"","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/deepfakes/faceswap/blob/f530cb7508ae670f6474f8a7d9c4df94705cf96b/scripts/convert.py#L179-L215","documentation":"FaceswapError raised in Convert._check_output_args when -mask_type predicted is chosen, the model was not trained with a mask (predictor.has_predicted_mask is False), and no mask type in the alignments file fully covers all faces (available_masks is empty). Faceswap then has no usable mask source at all: neither the model nor the alignments can supply one. If a full-coverage stored mask existed, it would be auto-selected with a warning instead.","triggerScenarios":"Converting with a model trained without learn_mask/mask output while the alignments file also contains no complete stored mask. available_masks filters for mask types where stored count == total face count and finds none.","commonSituations":"Old model trained before mask training was common, extraction done without any mask plugins enabled, or align file regenerated without masks.","solutions":["Run tools.py mask to generate and store a full-coverage mask (e.g. extended, components) then re-run convert with -mask_type predicted (it will auto-fallback to the stored mask)","Or set -mask_type to none if no masking is acceptable","Long term: retrain the model with a mask (enable mask training) to get true predicted masks"],"exampleFix":"# before\npython faceswap.py convert ... -mask_type predicted\n# error: model has no mask, alignments have none\n\n# after\npython tools.py mask -i /data/frames -a /data/alignments.fsa \\\n    -M extended --process all\npython faceswap.py convert ... -mask_type predicted\n# -> warns and falls back to 'extended'","handlingStrategy":"validation","validationCode":"if args.mask_type == \"predicted\" and not predictor.has_predicted_mask:\n    full = [k for k, v in alignments.mask_summary.items()\n            if k != \"none\" and v == alignments.faces_count]\n    if not full:\n        raise SystemExit(\"No predicted mask and no complete stored mask; \"\n                         \"run tools.py mask or set -mask_type none\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Train new models with a mask enabled so predicted masks are available at convert time","Always generate at least one full-coverage stored mask (extended/components) during extraction"],"tags":["faceswap","convert","mask","predicted-mask","alignments"],"backgroundTag":null,"analyzedSha":"f530cb7508ae670f6474f8a7d9c4df94705cf96b","analyzedAt":"2026-08-15T02:59:26.626Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}