Skip to content

Commit

Permalink
keep minimal inference function as example
Browse files Browse the repository at this point in the history
  • Loading branch information
MedericFourmy committed Oct 16, 2024
1 parent 45422fb commit a2ec4e5
Showing 1 changed file with 18 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
load_model_cosypose,
)
from happypose.pose_estimators.megapose.inference.detector import Detector
from happypose.pose_estimators.megapose.inference.types import (
ObservationTensor,
)
from happypose.toolbox.datasets.datasets_cfg import make_object_dataset
from happypose.toolbox.datasets.object_dataset import RigidObjectDataset
from happypose.toolbox.inference.utils import load_detector
Expand Down Expand Up @@ -176,26 +179,20 @@ def load_pose_models(
)
return coarse_model, refiner_model

def inference(self, observation, coarse_guess=None):
detections = None
run_detector = True
if coarse_guess is None:
final_preds, all_preds = self.pose_predictor.run_inference_pipeline(
observation,
detections=detections,
run_detector=run_detector,
data_TCO_init=None,
n_coarse_iterations=1,
n_refiner_iterations=4,
)
else:
final_preds, all_preds = self.pose_predictor.run_inference_pipeline(
observation,
detections=detections,
run_detector=run_detector,
data_TCO_init=None,
n_coarse_iterations=0,
n_refiner_iterations=4,
)
def inference(self, observation: ObservationTensor):
"""Example of how to un inference with the loaded models.
Args:
---
observation: ObservationTensor, the data used for inference
"""
final_preds, all_preds = self.pose_predictor.run_inference_pipeline(
observation,
detections=None,
run_detector=None,
data_TCO_init=None,
n_coarse_iterations=1,
n_refiner_iterations=4,
)
print("inference successfull")
return final_preds.cpu()

0 comments on commit a2ec4e5

Please sign in to comment.