      @staticmethod
      def _dict_lists_to_list_dicts(dictionary):
          """ Convert a dictionary of lists to a list of dictionaries """
          return [dict(zip(dictionary, val)) for val in zip(*dictionary.values())]
  
      @staticmethod
      def _remove_invalid_keys(dictionary, valid_keys):
          """ Remove items from dict that are no longer required """
          for key in list(dictionary.keys()):
              if key not in valid_keys:
                  logger.trace("Removing from output: '%s'", key)
                  del dictionary[key]
 
</s> remove     # <<< MISC UTILITY METHODS >>> #
    def _convert_color(self, image):
        """ Convert the image to the correct color format and strip alpha channel """
        logger.trace("Converting image to color format: %s", self.colorformat)
        if self.colorformat == "RGB":
            cvt_image = image[..., 2::-1].copy()
        elif self.colorformat == "GRAY":
            cvt_image = cv2.cvtColor(image.copy(), cv2.COLOR_BGR2GRAY)
        else:
            cvt_image = image[..., :3].copy()
        return cvt_image

 </s> add  </s> remove             # Remove items from algnments that have no faces so they will
 </s> add             # Remove items from alignments that have no faces so they will </s> remove             Dictionary of detected_faces with the filename as its key and a list of
            :class:`lib.faces_detect.DetectedFace` as the values for pairing with reloaded images.
 </s> add             Dictionary of :class:`plugins.extract.pipeline.ExtractMedia` with the filename as the
            key for repopulating the image attribute. </s> remove             logger.trace("final output: %s", {k: v.shape if isinstance(v, np.ndarray) else v
                                              for k, v in item.items()})
            yield item
 </s> add             output = self._extract_media.pop(item["filename"])
            output.add_detected_faces(item["detected_faces"])
            logger.trace("final output: (filename: '%s', image shape: %s, detected_faces: %s, "
                         "item: %s", output.filename, output.image_shape, output.detected_faces,
                         output)
            yield output </s> remove             action.process(output_item)
 </s> add             action.process(extract_media)
      @staticmethod
      def _dict_lists_to_list_dicts(dictionary):
          """ Convert a dictionary of lists to a list of dictionaries """
          return [dict(zip(dictionary, val)) for val in zip(*dictionary.values())]








keep keep keep keep replace replace replace replace replace replace replace replace
 plugins.extract - Create ExtractMedia class for pipeline flow
Bugfix - Fix memory leak in extract 
plugins/extract/_base.py