          """ Run model to get predictions """
          prediction, points = self.model.detect_faces(batch["feed"])
          logger.trace("filename: %s, prediction: %s, mtcnn_points: %s",
                       batch["filename"], prediction, points)
          batch["prediction"], batch["mtcnn_points"] = [prediction], [points]
          return batch
  
      def process_output(self, batch):
          """ Post process the detected faces """
          return batch
 
</s> remove         total_boxes = np.empty((0, 9))
        points = np.empty(0)
        # TODO Implement batch support
        image = batch[0]
        origin_h, origin_w = image.shape[:2]
        rectangles = self.detect_pnet(image, origin_h, origin_w)
        if not rectangles:
            return total_boxes, points
        rectangles = self.detect_rnet(image, rectangles, origin_h, origin_w)
        if not rectangles:
            return total_boxes, points
        rectangles = self.detect_onet(image, rectangles, origin_h, origin_w)
        if rectangles:
            total_boxes = np.array([result[:5] for result in rectangles])
            points = np.array([result[5:] for result in rectangles]).T
        return total_boxes, points

    def detect_pnet(self, image, height, width):
 </s> add         origin_h, origin_w = batch.shape[1:3]
        rectangles = self.detect_pnet(batch, origin_h, origin_w)
        rectangles = self.detect_rnet(batch, rectangles, origin_h, origin_w)
        rectangles = self.detect_onet(batch, rectangles, origin_h, origin_w)
        ret_boxes = list()
        ret_points = list()
        for rects in rectangles:
            if rects:
                total_boxes = np.array([result[:5] for result in rects])
                points = np.array([result[5:] for result in rects]).T
            else:
                total_boxes = np.empty((0, 9))
                points = np.empty(0)
            ret_boxes.append(total_boxes)
            ret_points.append(points)
        return ret_boxes, ret_points

    def detect_pnet(self, images, height, width): </s> remove     def predict(self, feed):
 </s> add     def _amd_predict_with_optimized_batchsizes(self, feed, batch_size):
        """ Minimizes the amount of kernels to be compiled when using
        the ``Amd`` backend with varying batchsizes while trying to keep
        the batchsize as high as possible.

        Parameters
        ----------
        feed: numpy.ndarray or list
            The feed to be provided to the model as input. This should be a ``numpy.ndarray``
            for single inputs or a ``list`` of ``numpy.ndarrays`` for multiple inputs.
        batch_size: int
            The upper batchsize to use.
        """
        if isinstance(feed, np.ndarray):
            feed = [feed]
        items = feed[0].shape[0]
        done_items = 0
        results = list()
        while done_items < items:
            if batch_size < 4:  # Not much difference in BS < 4
                batch_size = 1
            batch_items = ((items - done_items) // batch_size) * batch_size
            if batch_items:
                pred_data = [x[done_items:done_items + batch_items] for x in feed]
                pred = self._model.predict(pred_data, batch_size=batch_size)
                done_items += batch_items
                results.append(pred)
            batch_size //= 2
        if isinstance(results[0], np.ndarray):
            return np.concatenate(results)
        return [np.concatenate(x) for x in zip(*results)]

    def predict(self, feed, batch_size=None): </s> remove         self.queue_size = kwargs["queue_size"]
 </s> add         self.queue_size = 1 </s> remove                       out_queue=self._queues["extract_align_out"],
                      queue_size=self._queue_size)
 </s> add                       out_queue=self._queues["extract_align_out"])
        batch["prediction"], batch["mtcnn_points"] = prediction, points
          """ Run model to get predictions """
          prediction, points = self.model.detect_faces(batch["feed"])
          logger.trace("filename: %s, prediction: %s, mtcnn_points: %s",
                       batch["filename"], prediction, points)
        batch["prediction"], batch["mtcnn_points"] = prediction, points
          return batch
  
      def process_output(self, batch):
          """ Post process the detected faces """
          return batch
keep keep keep keep replace keep keep keep keep keep
 Optimized mtcnn a bit + added batching (#874) 
plugins/extract/detect/mtcnn.py