diff --git a/happypose/toolbox/utils/download.py b/happypose/toolbox/utils/download.py index f4d6025f..8a2b2e43 100755 --- a/happypose/toolbox/utils/download.py +++ b/happypose/toolbox/utils/download.py @@ -19,6 +19,7 @@ logger = get_logger(__name__) DOWNLOAD_URL = "https://www.paris.inria.fr/archive_ylabbeprojectsdata" +LAAS_DOWNLOAD_URL = "https://gepettoweb.laas.fr/data/happypose/" DOWNLOAD_DIR = LOCAL_DATA_DIR / "downloads" DOWNLOAD_DIR.mkdir(exist_ok=True) @@ -67,6 +68,7 @@ def main(): parser.add_argument("--bop_result_id", nargs="*") parser.add_argument("--synt_dataset", nargs="*") parser.add_argument("--detections", nargs="*") + parser.add_argument("--examples", nargs="*") parser.add_argument("--example_scenario", action="store_true") parser.add_argument("--pbr_training_images", action="store_true") parser.add_argument("--all_bop20_results", action="store_true") @@ -282,6 +284,14 @@ def main(): LOCAL_DATA_DIR / "results", ) ) + if args.examples: + for example in args.examples: + to_dl.append( + ( + f"{LAAS_DOWNLOAD_URL}/examples/{example}", + LOCAL_DATA_DIR / "examples", + ) + ) print(f"{to_dl=}") asyncio.run(adownloads(*to_dl)) diff --git a/tests/test_cosypose_inference.py b/tests/test_cosypose_inference.py index f784f672..358ba33a 100644 --- a/tests/test_cosypose_inference.py +++ b/tests/test_cosypose_inference.py @@ -1,6 +1,5 @@ """Set of unit tests for testing inference example for CosyPose.""" import unittest -from pathlib import Path import numpy as np import pinocchio as pin @@ -8,7 +7,7 @@ import yaml from PIL import Image -from happypose.pose_estimators.cosypose.cosypose.config import EXP_DIR +from happypose.pose_estimators.cosypose.cosypose.config import EXP_DIR, LOCAL_DATA_DIR from happypose.pose_estimators.cosypose.cosypose.integrated.detector import Detector from happypose.pose_estimators.cosypose.cosypose.integrated.pose_estimator import ( PoseEstimator, @@ -86,7 +85,7 @@ def _load_pose_models( ): """Load coarse and refiner for the crackers example renderer.""" object_dataset = BOPObjectDataset( - Path(__file__).parent / "data" / "crackers_example" / "models", + LOCAL_DATA_DIR / "examples" / "crackers_example" / "models", label_format="ycbv-{label}", ) renderer = Panda3dBatchRenderer( @@ -105,7 +104,7 @@ def _load_pose_models( @staticmethod def _load_crackers_example_observation(): """Load cracker example observation tensor.""" - data_dir = Path(__file__).parent.joinpath("data").joinpath("crackers_example") + data_dir = LOCAL_DATA_DIR / "examples" / "crackers_example" camera_data = CameraData.from_json((data_dir / "camera_data.json").read_text()) rgb = np.array(Image.open(data_dir / "image_rgb.png"), dtype=np.uint8) assert rgb.shape[:2] == camera_data.resolution diff --git a/tests/test_megapose_inference.py b/tests/test_megapose_inference.py index 8b9fdb96..bc5dae4a 100644 --- a/tests/test_megapose_inference.py +++ b/tests/test_megapose_inference.py @@ -1,10 +1,10 @@ """Set of unit tests for testing inference example for MegaPose.""" import unittest -from pathlib import Path import numpy as np import pinocchio as pin +from happypose.pose_estimators.cosypose.cosypose.config import LOCAL_DATA_DIR from happypose.toolbox.datasets.bop_object_datasets import BOPObjectDataset from happypose.toolbox.utils.load_model import NAMED_MODELS, load_named_model @@ -25,7 +25,7 @@ def test_megapose_pipeline(self): detections = detections[:1] # let's keep the most promising one only. object_dataset = BOPObjectDataset( - Path(__file__).parent / "data" / "crackers_example" / "models", + LOCAL_DATA_DIR / "examples" / "crackers_example" / "models", label_format="ycbv-{label}", )