def _inference_one_image(self, input):
        """
        Args:
            input (dict): one dataset dict with "image" field being a CHW tensor

        Returns:
            dict: one output dict
        """
        orig_shape = (input["height"], input["width"])
        augmented_inputs, tfms, min_sizes, max_sizes = self._get_augmented_inputs(input)
        # Detect boxes from all augmented versions
        with self._turn_off_roi_heads(["mask_on", "keypoint_on"]):
            # temporarily disable roi heads
            all_boxes, all_scores, all_classes = self._get_augmented_boxes(augmented_inputs, tfms, min_sizes, max_sizes, input)
        # merge all detected boxes to obtain final predictions for boxes
        merged_instances = self._merge_detections(all_boxes, all_scores, all_classes, orig_shape)

        if isinstance(self.cfg, CfgNode):
            MASK_ON = self.cfg.MODEL.MASK_ON
        elif isinstance(self.cfg, DictConfig):
            MASK_ON = False if self.cfg.model.roi_heads.mask_head is None else True
        else:
            raise NotImplementedError
        MASK_ON = True if 'maskness_thresh' in self.cfg.model.roi_heads else False

        # todo: apply maskness on tta merge
        if MASK_ON:
            # todo: select a single scale for crop
            target_scale = 1536
            target_aug_idx = 1
            for aug_idx, aug_input in enumerate(augmented_inputs):
                _, height, width = aug_input['image'].shape
                max_size = max(height, width)
                if max_size == target_scale:
                    target_aug_idx_check = aug_idx
                    break
            assert target_aug_idx_check == target_aug_idx, target_aug_idx_check
            augmented_inputs = [augmented_inputs[target_aug_idx]]
            tfms = [tfms[target_aug_idx]]

            # Use the detected boxes to obtain masks
            augmented_instances = self._rescale_detected_boxes(
                augmented_inputs, merged_instances, tfms
            )
            # run forward on the detected boxes
            outputs = self._batch_inference(augmented_inputs, augmented_instances)
            # Delete now useless variables to avoid being out of memory
            del augmented_inputs, augmented_instances
            # average the predictions
            merged_instances.pred_masks = self._reduce_pred_masks(outputs, tfms)
            merged_instances = detector_postprocess(merged_instances, *orig_shape)
            return {"instances": merged_instances}
        else:
            return {"instances": merged_instances}

        Args:
            input (dict): one dataset dict with "image" field being a CHW tensor

        Returns:
            dict: one output dict
        
EVA-02/det/detectron2/modeling/test_time_augmentation.py