    def run_batch(self, batch_data, graph_mode=False):
        """
        Run the inference of the AIT model with batched data.
        """
        score_thresh = self.cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST
        results = {}
        inputs = batch_data["data"]
        image_list = batch_data["path"]
        image_shapes = batch_data["image_shape"]
        image_scales = batch_data["image_scale"]
        images = batch_data["image"]
        ret = self.run_on_image(inputs, graph_mode=graph_mode)
        batched_boxes, batched_scores, batched_classes = ret[:3]
        if self.mask_on:
            batched_masks = ret[-1]
        for i in range(self.batch_size):
            boxes, scores, classes = (
                batched_boxes[i, :],
                batched_scores[i, :],
                batched_classes[i, :],
            )

            filter_mask = scores > score_thresh
            filter_inds = filter_mask.nonzero()[0]
            scores = scores[filter_inds]
            boxes = boxes[filter_inds, :] * image_scales[i]
            boxes = self.apply_bbox(boxes, image_shapes[i][1], image_shapes[i][0])
            classes = classes[filter_inds]

            results[image_list[i]] = {
                "boxes": boxes,
                "scores": scores,
                "classes": classes,
                "image_height": image_shapes[i][0],
                "image_width": image_shapes[i][1],
                "num_instances": boxes.shape[0],
                "image": images[i],
            }
            if self.mask_on:
                mask_pred = batched_masks[i, filter_inds, :, :]
                results[image_list[i]]["masks"] = mask_pred
        return results
Run the inference of the AIT model with batched data.
examples/02_detectron2/predictor/predictor.py