Skip to content

Commit

Permalink
laas download for crackers example
Browse files Browse the repository at this point in the history
  • Loading branch information
nim65s committed Oct 24, 2023
1 parent f3f2843 commit ea52daa
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
10 changes: 10 additions & 0 deletions happypose/toolbox/utils/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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))
Expand Down
7 changes: 3 additions & 4 deletions tests/test_cosypose_inference.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
"""Set of unit tests for testing inference example for CosyPose."""
import unittest
from pathlib import Path

import numpy as np
import pinocchio as pin
import torch
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,
Expand Down Expand Up @@ -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(
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/test_megapose_inference.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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}",
)

Expand Down

0 comments on commit ea52daa

Please sign in to comment.