  #!/usr/bin/env python3
  """ Tool to generate masks and previews of masks for existing alignments file """
  import logging
  import os
  
  import cv2
  import numpy as np
  from tqdm import tqdm
  
  from lib.alignments import Alignments
 
</s> remove                 exit(0)
 </s> add                 sys.exit(0) </s> remove             logger.debug("Not updating existing mask for face: '%s' - %s", frame, idx)
 </s> add             logger.debug("Mask pre-exists for face: '%s' - %s", frame, idx) </s> remove             exit(0)
 </s> add             sys.exit(0) </s> remove             exit(0)
 </s> add             sys.exit(0) </s> remove             detected_faces = []
            for idx, alignment in enumerate(self._alignments.get_faces_in_frame(frame)):
                self._face_count += 1
                if self._check_for_missing(frame, idx, alignment):
                    continue
                detected_face = self._get_detected_face(alignment)
                if self._update_type == "output":
 </s> add             faces_in_frame = self._alignments.get_faces_in_frame(frame)
            self._face_count += len(faces_in_frame)

            # To keep face indexes correct/cover off where only one face in an image is missing a
            # mask where there are multiple faces we process all faces again for any frames which
            # have missing masks.
            if all(self._check_for_missing(frame, idx, alignment)
                   for idx, alignment in enumerate(faces_in_frame)):
                continue

            detected_faces = [self._get_detected_face(alignment) for alignment in faces_in_frame]
            if self._update_type == "output":
                for idx, detected_face in enumerate(detected_faces):
import sys
  #!/usr/bin/env python3
  """ Tool to generate masks and previews of masks for existing alignments file """
  import logging
  import os
import sys
  
  import cv2
  import numpy as np
  from tqdm import tqdm
  
  from lib.alignments import Alignments
keep keep keep add keep keep keep keep keep keep
 tools.mask - Bugfixes
- Missing masks - fix memory leak
- Missing masks - Handle multiple faces in frames properly 
tools/mask.py