Skip to content

Commit 9912a41

Browse files
committed
Fork ape rpe
1 parent 2f882c8 commit 9912a41

File tree

3 files changed

+13
-130
lines changed

3 files changed

+13
-130
lines changed

evaluation_script/evo_ape_fork.py

Lines changed: 4 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,14 @@
2121
along with evo. If not, see <http://www.gnu.org/licenses/>.
2222
"""
2323

24-
import argparse
2524
import logging
2625
import typing
2726

2827
import numpy as np
2928

30-
import evo.common_ape_rpe as common
31-
from evo.core import lie_algebra, sync, metrics
29+
from evo.core import lie_algebra, metrics
3230
from evo.core.result import Result
3331
from evo.core.trajectory import PosePath3D, PoseTrajectory3D, Plane
34-
from evo.tools import log
3532
from evo.tools.settings import SETTINGS
3633

3734
logger = logging.getLogger(__name__)
@@ -115,56 +112,6 @@ def ape(traj_ref: PosePath3D, traj_est: PosePath3D,
115112
return ape_result
116113

117114

118-
def run(args: argparse.Namespace) -> None:
119-
log.configure_logging(args.verbose, args.silent, args.debug,
120-
local_logfile=args.logfile)
121-
if args.debug:
122-
from pprint import pformat
123-
parser_str = pformat({arg: getattr(args, arg) for arg in vars(args)})
124-
logger.debug("main_parser config:\n{}".format(parser_str))
125-
logger.debug(SEP)
126-
127-
traj_ref, traj_est, ref_name, est_name = common.load_trajectories(args)
128-
pose_relation = common.get_pose_relation(args)
129-
change_unit = metrics.Unit(args.change_unit) if args.change_unit else None
130-
plane = Plane(args.project_to_plane) if args.project_to_plane else None
131-
132-
traj_ref_full = None
133-
if args.plot_full_ref:
134-
import copy
135-
traj_ref_full = copy.deepcopy(traj_ref)
136-
137-
# Downsample or filtering has to be done before synchronization.
138-
# Otherwise filtering might mess up the sync.
139-
common.downsample_or_filter(args, traj_ref, traj_est)
140-
141-
if isinstance(traj_ref, PoseTrajectory3D) and isinstance(
142-
traj_est, PoseTrajectory3D):
143-
logger.debug(SEP)
144-
if args.t_start or args.t_end:
145-
if args.t_start:
146-
logger.info("Using time range start: {}s".format(args.t_start))
147-
if args.t_end:
148-
logger.info("Using time range end: {}s".format(args.t_end))
149-
traj_ref.reduce_to_time_range(args.t_start, args.t_end)
150-
logger.debug("Synchronizing trajectories...")
151-
traj_ref, traj_est = sync.associate_trajectories(
152-
traj_ref, traj_est, args.t_max_diff, args.t_offset,
153-
first_name=ref_name, snd_name=est_name)
154-
155-
result = ape(traj_ref=traj_ref, traj_est=traj_est,
156-
pose_relation=pose_relation, align=args.align,
157-
correct_scale=args.correct_scale, n_to_align=args.n_to_align,
158-
align_origin=args.align_origin, ref_name=ref_name,
159-
est_name=est_name, change_unit=change_unit,
160-
project_to_plane=plane)
161-
162-
if args.plot or args.save_plot or args.serialize_plot:
163-
common.plot_result(args, result, traj_ref,
164-
result.trajectories[est_name],
165-
traj_ref_full=traj_ref_full)
166-
167-
168-
if __name__ == '__main__':
169-
from evo import entry_points
170-
entry_points.ape()
115+
# if __name__ == '__main__':
116+
# from evo import entry_points
117+
# entry_points.ape()

evaluation_script/evo_rpe_fork.py

Lines changed: 2 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,13 @@
2121
along with evo. If not, see <http://www.gnu.org/licenses/>.
2222
"""
2323

24-
import argparse
2524
import logging
2625
import typing
2726

2827
import numpy as np
29-
30-
import evo.common_ape_rpe as common
31-
from evo.core import lie_algebra, sync, metrics
28+
from evo.core import lie_algebra, metrics
3229
from evo.core.result import Result
3330
from evo.core.trajectory import PosePath3D, PoseTrajectory3D, Plane
34-
from evo.tools import log
3531
from evo.tools.settings import SETTINGS
3632

3733
logger = logging.getLogger(__name__)
@@ -130,64 +126,4 @@ def rpe(traj_ref: PosePath3D, traj_est: PosePath3D,
130126
rpe_result.add_np_array("alignment_transformation_sim3",
131127
alignment_transformation)
132128

133-
return rpe_result
134-
135-
136-
def run(args: argparse.Namespace) -> None:
137-
138-
log.configure_logging(args.verbose, args.silent, args.debug,
139-
local_logfile=args.logfile)
140-
if args.debug:
141-
from pprint import pformat
142-
parser_str = pformat({arg: getattr(args, arg) for arg in vars(args)})
143-
logger.debug("main_parser config:\n{}".format(parser_str))
144-
logger.debug(SEP)
145-
146-
traj_ref, traj_est, ref_name, est_name = common.load_trajectories(args)
147-
pose_relation = common.get_pose_relation(args)
148-
delta_unit = common.get_delta_unit(args)
149-
change_unit = metrics.Unit(args.change_unit) if args.change_unit else None
150-
plane = Plane(args.project_to_plane) if args.project_to_plane else None
151-
152-
traj_ref_full = None
153-
if args.plot_full_ref:
154-
import copy
155-
traj_ref_full = copy.deepcopy(traj_ref)
156-
157-
# Downsample or filtering has to be done before synchronization.
158-
# Otherwise filtering might mess up the sync.
159-
common.downsample_or_filter(args, traj_ref, traj_est)
160-
161-
if isinstance(traj_ref, PoseTrajectory3D) and isinstance(
162-
traj_est, PoseTrajectory3D):
163-
logger.debug(SEP)
164-
if args.t_start or args.t_end:
165-
if args.t_start:
166-
logger.info("Using time range start: {}s".format(args.t_start))
167-
if args.t_end:
168-
logger.info("Using time range end: {}s".format(args.t_end))
169-
traj_ref.reduce_to_time_range(args.t_start, args.t_end)
170-
logger.debug("Synchronizing trajectories...")
171-
traj_ref, traj_est = sync.associate_trajectories(
172-
traj_ref, traj_est, args.t_max_diff, args.t_offset,
173-
first_name=ref_name, snd_name=est_name)
174-
175-
result = rpe(traj_ref=traj_ref, traj_est=traj_est,
176-
pose_relation=pose_relation, delta=args.delta,
177-
delta_unit=delta_unit, rel_delta_tol=args.delta_tol,
178-
all_pairs=args.all_pairs,
179-
pairs_from_reference=args.pairs_from_reference,
180-
align=args.align, correct_scale=args.correct_scale,
181-
n_to_align=args.n_to_align, align_origin=args.align_origin,
182-
ref_name=ref_name, est_name=est_name, change_unit=change_unit,
183-
project_to_plane=plane)
184-
185-
if args.plot or args.save_plot or args.serialize_plot:
186-
common.plot_result(args, result, traj_ref,
187-
result.trajectories[est_name],
188-
traj_ref_full=traj_ref_full)
189-
190-
191-
if __name__ == '__main__':
192-
from evo import entry_points
193-
entry_points.rpe()
129+
return rpe_result

evaluation_script/evo_script.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
# from evo.tools import file_interface
1515
# import evo.main_ape as main_ape
1616
# import evo.main_rpe as main_rpe
17-
from .evo_ape_fork import main_ape
18-
from .evo_rpe_fork import main_rpe
17+
from .evo_ape_fork import ape
18+
from .evo_rpe_fork import rpe
1919
class FileInterfaceException(Exception):
2020
pass
2121

@@ -183,7 +183,7 @@ def evaluate(self, traj_ref: str, traj_est: str) -> Dict[str, float]:
183183
traj_ref, traj_est, cfg["t_max_diff"], cfg["t_offset"]
184184
)
185185

186-
ape = main_ape.ape(
186+
ape_res = ape(
187187
traj_ref,
188188
traj_est,
189189
est_name="estimated",
@@ -196,7 +196,7 @@ def evaluate(self, traj_ref: str, traj_est: str) -> Dict[str, float]:
196196
project_to_plane=plane_param,
197197
)
198198

199-
rpe = main_rpe.rpe(
199+
rpe_res = rpe(
200200
traj_ref,
201201
traj_est,
202202
est_name="estimated",
@@ -213,9 +213,9 @@ def evaluate(self, traj_ref: str, traj_est: str) -> Dict[str, float]:
213213
)
214214

215215
return {
216-
"ATE": float(ape.stats["rmse"]),
217-
"RTE": float(rpe.stats["rmse"]),
218-
"LE": float(ape.np_arrays["error_array"][-1]),
216+
"ATE": float(ape_res.stats["rmse"]),
217+
"RTE": float(rpe_res.stats["rmse"]),
218+
"LE": float(ape_res.np_arrays["error_array"][-1]),
219219
}
220220

221221
# -- filters --------------------------------------------------------

0 commit comments

Comments
 (0)