          if is_zoomed:
              aligned = AlignedFace(face.landmarks_xy,
                                    centering="face",
                                    size=min(self._globals.frame_display_dims))
              landmark = aligned.landmarks[landmark_index]
              landmark += (shift_x, shift_y)
              matrix = aligned.adjusted_matrix
              matrix = cv2.invertAffineTransform(matrix)
              if landmark.ndim == 1:
                  landmark = np.reshape(landmark, (1, 1, 2))
 
</s> remove         face.mask = self._extractor.get_masks(frame_index, face_index)
 </s> add  </s> remove         face.mask = self._extractor.get_masks(frame_index, face_index)
 </s> add  </s> remove     def sort_color(self):
        """ Score by channel average intensity """
        logger.info("Sorting by channel average intensity...")
        desired_channel = {'gray': 0, 'luma': 0, 'orange': 1, 'green': 2}
        method = self._args.color_method
        channel_to_sort = next(v for (k, v) in desired_channel.items() if method.endswith(k))
        filename_list, image_list = self._get_images()

        logger.info("Converting to appropriate colorspace...")
        same_size = all(img.size == image_list[0].size for img in image_list)
        images = np.array(image_list, dtype='float32')[None, ...] if same_size else image_list
        converted_images = self._convert_color(images, same_size, method)

        logger.info("Scoring each image...")
        if same_size:
            scores = np.average(converted_images[0], axis=(1, 2))
        else:
            progress_bar = tqdm(converted_images, desc="Scoring", file=sys.stdout)
            scores = np.array([np.average(image, axis=(0, 1)) for image in progress_bar])

        logger.info("Sorting...")
        matched_list = list(zip(filename_list, scores[:, channel_to_sort]))
        sorted_file_img_list = sorted(matched_list, key=operator.itemgetter(1), reverse=True)
        return sorted_file_img_list

 </s> add  </s> remove                 output = "{}_{}{}".format(frame_name, str(face_idx), extension)
 </s> add                 output = "{}_{}{}".format(frame_name, str(face_idx), ".png")
            landmark = aligned.landmarks[landmark_index]  # pylint:disable=unsubscriptable-object
          if is_zoomed:
              aligned = AlignedFace(face.landmarks_xy,
                                    centering="face",
                                    size=min(self._globals.frame_display_dims))
            landmark = aligned.landmarks[landmark_index]  # pylint:disable=unsubscriptable-object
              landmark += (shift_x, shift_y)
              matrix = aligned.adjusted_matrix
              matrix = cv2.invertAffineTransform(matrix)
              if landmark.ndim == 1:
                  landmark = np.reshape(landmark, (1, 1, 2))
keep keep keep keep replace keep keep keep keep keep
 Add Misalignment Detection
  - lib.align.AlignedFace - Add average_distance property (distance from mean_face)
  - tools.manual - Add misaligned Faces filter
  - tools.sort - Add sort by distance (misaligned sort)Add "Misaligned Faces" filter to manual tool 
tools/manual/detected_faces.py