33
33
from happypose .pose_estimators .megapose .evaluation .runner_utils import format_results
34
34
35
35
# Pose estimator
36
- from happypose .toolbox .datasets .datasets_cfg import make_object_dataset , make_scene_dataset , get_obj_ds_info
36
+ from happypose .toolbox .datasets .datasets_cfg import (
37
+ get_obj_ds_info ,
38
+ make_object_dataset ,
39
+ make_scene_dataset ,
40
+ )
37
41
from happypose .toolbox .lib3d .rigid_mesh_database import MeshDataBase
38
42
from happypose .toolbox .utils .distributed import get_rank , get_tmp_dir
39
43
from happypose .toolbox .utils .logging import get_logger
44
48
45
49
logger = get_logger (__name__ )
46
50
51
+ from happypose .pose_estimators .cosypose .cosypose .integrated .detector import Detector
47
52
from happypose .pose_estimators .cosypose .cosypose .training .detector_models_cfg import (
48
53
check_update_config as check_update_config_detector ,
49
54
)
50
55
from happypose .pose_estimators .cosypose .cosypose .training .detector_models_cfg import (
51
56
create_model_detector ,
52
57
)
53
- from happypose . pose_estimators . cosypose . cosypose . integrated . detector import Detector
58
+
54
59
55
60
def load_detector (run_id , ds_name ):
56
61
run_dir = EXP_DIR / run_id
@@ -68,7 +73,9 @@ def load_detector(run_id, ds_name):
68
73
return model
69
74
70
75
71
- def load_pose_models_cosypose (object_dataset , coarse_run_id , refiner_run_id , n_workers , renderer_type = "panda3d" ):
76
+ def load_pose_models_cosypose (
77
+ object_dataset , coarse_run_id , refiner_run_id , n_workers , renderer_type = "panda3d"
78
+ ):
72
79
run_dir = EXP_DIR / coarse_run_id
73
80
cfg = yaml .load ((run_dir / "config.yaml" ).read_text (), Loader = yaml .UnsafeLoader )
74
81
cfg = check_update_config_pose (cfg )
@@ -161,7 +168,7 @@ def run_eval(
161
168
162
169
logger .info (f"Running eval on ds_name={ cfg .ds_name } with setting={ save_key } " )
163
170
# e.g. "ycbv.bop19" -> "ycbv"
164
- ds_name_short = cfg .ds_name .split ('.' )[0 ]
171
+ ds_name_short = cfg .ds_name .split ("." )[0 ]
165
172
166
173
# Load the dataset
167
174
ds_kwargs = {"load_depth" : False }
@@ -195,15 +202,14 @@ def run_eval(
195
202
assert cfg .coarse_run_id is not None
196
203
assert cfg .refiner_run_id is not None
197
204
198
-
199
205
object_ds = make_object_dataset (ds_name_short )
200
206
201
207
coarse_model , refiner_model , mesh_db = load_pose_models_cosypose (
202
208
object_ds ,
203
209
coarse_run_id = cfg .coarse_run_id ,
204
210
refiner_run_id = cfg .refiner_run_id ,
205
211
n_workers = cfg .inference .n_workers ,
206
- renderer_type = cfg .inference .renderer
212
+ renderer_type = cfg .inference .renderer ,
207
213
)
208
214
209
215
renderer = refiner_model .renderer
0 commit comments