epica 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. epica-0.1.0/PKG-INFO +442 -0
  2. epica-0.1.0/README.md +419 -0
  3. epica-0.1.0/pyproject.toml +80 -0
  4. epica-0.1.0/setup.cfg +4 -0
  5. epica-0.1.0/src/epa/__init__.py +4 -0
  6. epica-0.1.0/src/epa/ape_tool.py +857 -0
  7. epica-0.1.0/src/epa/benchmark/__init__.py +2 -0
  8. epica-0.1.0/src/epa/benchmark/alignanything_harness.py +972 -0
  9. epica-0.1.0/src/epa/benchmark/case_rerun.py +168 -0
  10. epica-0.1.0/src/epa/benchmark/latex_summary.py +389 -0
  11. epica-0.1.0/src/epa/benchmark/metrics_res.py +133 -0
  12. epica-0.1.0/src/epa/benchmark/plot_summary.py +348 -0
  13. epica-0.1.0/src/epa/benchmark/res.py +612 -0
  14. epica-0.1.0/src/epa/cli.py +329 -0
  15. epica-0.1.0/src/epa/config.py +103 -0
  16. epica-0.1.0/src/epa/config_cli.py +204 -0
  17. epica-0.1.0/src/epa/config_tool.py +321 -0
  18. epica-0.1.0/src/epa/core/__init__.py +2 -0
  19. epica-0.1.0/src/epa/core/calibration.py +52 -0
  20. epica-0.1.0/src/epa/core/evaluation.py +299 -0
  21. epica-0.1.0/src/epa/core/io_utils.py +889 -0
  22. epica-0.1.0/src/epa/core/math_utils.py +84 -0
  23. epica-0.1.0/src/epa/core/pipeline_modular.py +1977 -0
  24. epica-0.1.0/src/epa/core/time_alignment.py +116 -0
  25. epica-0.1.0/src/epa/fig_tool.py +105 -0
  26. epica-0.1.0/src/epa/ipython_tool.py +81 -0
  27. epica-0.1.0/src/epa/metric_cli_common.py +466 -0
  28. epica-0.1.0/src/epa/openvins_runner.py +287 -0
  29. epica-0.1.0/src/epa/ov_eval_compat.py +804 -0
  30. epica-0.1.0/src/epa/rpe_tool.py +846 -0
  31. epica-0.1.0/src/epa/runner.py +49 -0
  32. epica-0.1.0/src/epa/traj_tool.py +1306 -0
  33. epica-0.1.0/src/epa/viz/__init__.py +2 -0
  34. epica-0.1.0/src/epa/viz/backend_bootstrap.py +54 -0
  35. epica-0.1.0/src/epa/viz/metric_plots.py +540 -0
  36. epica-0.1.0/src/epa/viz/plot_bundle.py +368 -0
  37. epica-0.1.0/src/epa/viz/plot_runtime.py +71 -0
  38. epica-0.1.0/src/epa/viz/rerun_viz.py +1216 -0
  39. epica-0.1.0/src/epica.egg-info/PKG-INFO +442 -0
  40. epica-0.1.0/src/epica.egg-info/SOURCES.txt +42 -0
  41. epica-0.1.0/src/epica.egg-info/dependency_links.txt +1 -0
  42. epica-0.1.0/src/epica.egg-info/entry_points.txt +24 -0
  43. epica-0.1.0/src/epica.egg-info/requires.txt +21 -0
  44. epica-0.1.0/src/epica.egg-info/top_level.txt +2 -0
epica-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,442 @@
1
+ Metadata-Version: 2.4
2
+ Name: epica
3
+ Version: 0.1.0
4
+ Summary: Trajectory alignment and evaluation toolkit for Vicon-grounded workflows
5
+ Requires-Python: >=3.10
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: numpy>=1.21
8
+ Requires-Dist: scipy>=1.8
9
+ Requires-Dist: matplotlib>=3.5
10
+ Provides-Extra: rerun
11
+ Requires-Dist: rerun-sdk>=0.20; extra == "rerun"
12
+ Provides-Extra: ros
13
+ Requires-Dist: rosbags>=0.11.0; extra == "ros"
14
+ Provides-Extra: geo
15
+ Requires-Dist: contextily>=1.5; extra == "geo"
16
+ Requires-Dist: pyyaml>=6.0; extra == "geo"
17
+ Provides-Extra: dev
18
+ Requires-Dist: pytest>=7.0; extra == "dev"
19
+ Requires-Dist: mypy>=1.0; extra == "dev"
20
+ Requires-Dist: ruff>=0.6; extra == "dev"
21
+ Provides-Extra: ipython
22
+ Requires-Dist: ipython>=8.0; extra == "ipython"
23
+
24
+ # Epic Alignment (epa)
25
+ 2026/4/21
26
+ 找到了一些不能正常对齐的case, 正在解决
27
+
28
+ 2026/4/15
29
+
30
+ 完善了文档, 内容更完整, 加了点配色, 代码块, 数学公式块
31
+
32
+ ---
33
+ 2026/4/14
34
+
35
+ 解决了昨天大部分todo, 代码已推送, 文档已部署至[Documentation website](https://epic-lab-gwu.github.io/epa/)
36
+
37
+ ---
38
+ 2026/4/13
39
+
40
+ 参考evo, 给epa
41
+ 1. 补齐了工具链的接口
42
+ 2. 做了可安装化: pyproject.toml + entry points
43
+ 3. 加了各种指标的可视化和绘图
44
+ 4. 配置好了rerun, 增加了一些细节(增加轨迹说明标签, 只对step3轨迹做渐变色映射)
45
+ 5. 增加了一些todo:
46
+
47
+ - [x] 起个名字, 方便代码统一
48
+ - [x] 弄得差不多了, 可以做个wiki网站, 然后完善一下readme
49
+
50
+ ---
51
+ 2026/4/12
52
+ 1. 扩展了输入格式, 但有一些格式还没实测能否work, 比如rosbag
53
+ 2. 优化了部分代码结构, 今天晚点上传
54
+ 3. evo的time offset换成非epa的offset, 重新跑了师兄给的case, 结果更新至summary.md
55
+ 4. 总共跑出来的有138个case, 有一些case fail了, 后面再看看原因; 有一些case没有匹配到对应的ground truth和estimation, 没跑
56
+
57
+ ---
58
+ 2026/4/10
59
+
60
+ ## TODO:
61
+
62
+ - [x] 重写了项目结构, 使其易于扩展和复用;
63
+ - [x] 把evo的metrics加了进来, 再看看有什么可以新增的metrics;
64
+ - [x] 用现在的epa和evo分别跑了alignanything, 结果在epa/summary_final.md;
65
+ - [x] evo支持更多的格式输入, vicon后面可以加上 # 4/12
66
+ - [x] 可考虑模仿evo, 补齐成一个完整的工具链cli # 4/13
67
+ - [x] 指标可视化支持 rerun(APE/RPE/traj/3-step) # 4/13
68
+ - [x] rerun 配置补齐(工具入口支持 `--rerun` 与 `--rerun-rec-id`) # 4/13
69
+ - [x] 现在evo的结果用了epa的offset, 后面可以改成人工sweep最优 # 4/12
70
+
71
+ ---
72
+ `epa` 是一个轨迹对齐与评估工具集,包含:
73
+
74
+ - 三步对齐主流程(时间对齐 -> 外参求解 -> 世界系对齐)
75
+ - evo 风格的轨迹工具链(`traj / ape / rpe / res / config`)
76
+ - 可选的 Rerun 可视化
77
+ - AlignAnything 独立 benchmark harness
78
+
79
+ 核心算法代码在 `src/epa/core`。
80
+
81
+ ## 安装
82
+
83
+ ```bash
84
+ pip install -e .
85
+ ```
86
+
87
+ 可选依赖:
88
+
89
+ ```bash
90
+ # Rerun 可视化
91
+ pip install -e .[rerun]
92
+
93
+ # bag / bag2 / mcap
94
+ pip install -e .[ros]
95
+
96
+ # 地图底图(contextily)
97
+ pip install -e .[geo]
98
+
99
+ # 开发与测试
100
+ pip install -e .[dev]
101
+
102
+ # IPython 交互入口(可选)
103
+ pip install -e .[ipython]
104
+ ```
105
+
106
+ ## 命令入口
107
+
108
+ 安装后可直接使用:
109
+
110
+ - `epa`
111
+ - `epa_traj`
112
+ - `epa_ape`
113
+ - `epa_rpe`
114
+ - `epa_fig`
115
+ - `epa_res`
116
+ - `epa_config`
117
+ - `epa_benchmark`
118
+ - `epa_case_rerun`
119
+ - `epa_rerun`
120
+ - `epa_plot_summary`
121
+ - `epa_latex_summary`
122
+ - `epa_metric_res`
123
+ - `epa_ipython`
124
+
125
+ ## 快速开始
126
+
127
+ ### 1) 三步主流程(modular engine)
128
+
129
+ ```bash
130
+ epa \
131
+ --engine modular \
132
+ --gt-csv data/gt.csv \
133
+ --est-path outputs/traj_estimate_v1_01.txt \
134
+ --est-format tum \
135
+ --t-max-diff 0.02 \
136
+ --plot
137
+ ```
138
+
139
+ 启用 Rerun:
140
+
141
+ ```bash
142
+ epa \
143
+ --engine modular \
144
+ --gt-csv data/gt.csv \
145
+ --est-path outputs/traj_estimate_v1_01.txt \
146
+ --est-format tum \
147
+ --t-max-diff 0.02 \
148
+ --plot \
149
+ --rerun
150
+ ```
151
+
152
+ ### 2) 轨迹工具 `epa_traj`
153
+
154
+ ```bash
155
+ # 轨迹对比绘图
156
+ epa_traj --format tum --plot --plot-mode xz gt.tum est.tum
157
+
158
+ # evo 风格子命令也兼容
159
+ epa_traj tum gt.tum est.tum --plot
160
+
161
+ # bag 的 evo 风格 topics 位置参数也兼容
162
+ epa_traj bag /path/run.bag /vicon/pose /odom --plot
163
+
164
+ # 交互式窗口(evo 风格)
165
+ epa_traj --format tum --plot --plot-interactive --plot-backend qtagg gt.tum est.tum
166
+
167
+ # 对齐与同步
168
+ epa_traj --format tum --sync --align --ref 1 gt.tum est.tum --plot
169
+
170
+ # 导出格式
171
+ epa_traj --format auto --save-as tum --out-dir outputs/traj_exports traj_a traj_b
172
+ ```
173
+
174
+ ### 3) APE / RPE 工具
175
+
176
+ ```bash
177
+ # APE
178
+ epa_ape tum gt.tum est.tum \
179
+ --pose_relation trans_part \
180
+ --align \
181
+ --t_max_diff 0.02 \
182
+ --plot --plot_mode xz
183
+
184
+ # RPE
185
+ epa_rpe tum gt.tum est.tum \
186
+ --pose_relation trans_part \
187
+ --delta 1 --delta_unit f \
188
+ --all_pairs \
189
+ --align \
190
+ --plot --plot_mode xz
191
+
192
+ # 若需要交互式窗口,可附加:
193
+ # --plot 默认在 TTY 终端会尝试弹交互窗口(evo 风格);
194
+ # 也可显式指定:--plot-interactive --plot-backend qtagg
195
+ ```
196
+
197
+ ### 4) 结果对比 `epa_res`
198
+
199
+ ```bash
200
+ epa_res outputs/results/run_a.zip outputs/results/run_b.zip \
201
+ --metric all --stage step3 --plot --out-dir outputs/res_compare
202
+
203
+ # 交互式窗口
204
+ epa_res outputs/results/run_a.zip outputs/results/run_b.zip \
205
+ --metric all --stage step3 --plot --plot-interactive --plot-backend qtagg
206
+
207
+ # 也支持 evo 原生结果包(info.json + stats.json + error_array.npz)
208
+ epa_res /home/yifu/evo/test/data/res_files/orb_ape.zip \
209
+ /home/yifu/evo/test/data/res_files/sptam_ape.zip \
210
+ --metric ape --ape-relation trans_part --plot
211
+ ```
212
+
213
+ ### 5) 图序列化与重绘 `epa_fig`
214
+
215
+ ```bash
216
+ # 先在 ape/rpe 中序列化绘图规格
217
+ epa_ape tum gt.tum est.tum \
218
+ --pose_relation trans_part \
219
+ --serialize_plot outputs/ape_plot.json
220
+
221
+ # 后续可独立重绘(不重算指标)
222
+ epa_fig outputs/ape_plot.json --save_plot outputs/ape_rerender.png
223
+ ```
224
+
225
+ ### 6) 全局配置 `epa_config`
226
+
227
+ ```bash
228
+ # 根级默认(所有工具都可继承)
229
+ epa_config set plot false rpe_delta 3
230
+
231
+ # 工具级默认(更细粒度,推荐)
232
+ epa_config set --tool epa_ape plot_mode xy t_max_diff 0.05
233
+ epa_config set --tool epa_traj plot_mode xyz sync_max_diff 0.01
234
+
235
+ # 查看某个工具生效配置(global + tool 合并后)
236
+ epa_config show --tool epa_ape
237
+
238
+ epa_config show
239
+ epa_config unset plot
240
+ ```
241
+
242
+ ## 配置系统
243
+
244
+ 所有核心工具支持 `--config <file.json>`。
245
+
246
+ 优先级(高 -> 低):
247
+
248
+ 1. `--config` 文件
249
+ 2. CLI 参数
250
+ 3. `epa_config` 全局配置
251
+
252
+ 生成模板:
253
+
254
+ ```bash
255
+ epa_config generate --tool epa_ape --out ape_config.json
256
+ ```
257
+
258
+ 也支持分层配置(类似 evo settings):
259
+
260
+ ```json
261
+ {
262
+ "_global": {
263
+ "plot": true
264
+ },
265
+ "epa_ape": {
266
+ "plot_mode": "xy",
267
+ "t_max_diff": 0.05
268
+ },
269
+ "epa_traj": {
270
+ "plot_mode": "xyz",
271
+ "sync_max_diff": 0.01
272
+ }
273
+ }
274
+ ```
275
+
276
+ ## 支持输入格式
277
+
278
+ 主流程与工具链支持:
279
+
280
+ - `auto`
281
+ - `csv` / `euroc`
282
+ - `tum`
283
+ - `kitti`
284
+ - `bag`(ROS1)
285
+ - `bag2` / `mcap`(ROS2)
286
+
287
+ bag 读取时可指定 topic:
288
+
289
+ ```bash
290
+ epa \
291
+ --gt-csv /path/to/run.bag --gt-format bag --gt-topic /vicon/pose \
292
+ --est-path /path/to/run.bag --est-format bag --est-topic /odom
293
+ ```
294
+
295
+ TF 语法也支持:
296
+
297
+ ```bash
298
+ --est-topic /tf:map.base_link
299
+ ```
300
+
301
+ ## Rerun 说明
302
+
303
+ `epa` / `traj` / `ape` / `rpe` 都支持 `--rerun`。
304
+
305
+ 常用参数:
306
+
307
+ - `--rerun`
308
+ - `--rerun-rec-id <id>`
309
+ - `--rerun-no-spawn`
310
+ - `--rerun-stride N`
311
+ - `--rerun-motion-stride N`
312
+
313
+ 说明:行为与 evo 一致,默认仅 viewer logging,不自动写 `.rrd`。
314
+
315
+ ## IPython 入口
316
+
317
+ ```bash
318
+ # 进入预加载 epa 模块的 IPython
319
+ epa_ipython
320
+
321
+ # 先查看预加载符号
322
+ epa_ipython --list
323
+ ```
324
+
325
+ ## Benchmark(AlignAnything)
326
+
327
+ 建议把数据集放在仓库外,例如:`/home/yifu/epa_data`。
328
+
329
+ ```bash
330
+ export EPA_DATA_ROOT=/home/yifu/epa_data
331
+ ```
332
+
333
+ 运行独立 benchmark harness(`epa` 与 `evo` 独立运行,offset 不共享):
334
+
335
+ ```bash
336
+ epa_benchmark \
337
+ --alignanything-root /home/yifu/epa_data/AlignAnything/AlignAnything \
338
+ --repo-root /home/yifu/epa \
339
+ --evo-repo /home/yifu/evo
340
+ ```
341
+
342
+ 从 harness 的 `summary.csv` 生成图:
343
+
344
+ ```bash
345
+ epa_plot_summary \
346
+ --summary-csv outputs/alignanything_harness/run_xxx/summary.csv
347
+ ```
348
+
349
+ 从 harness 的 `summary.csv` 生成可直接放论文的 LaTeX 表格:
350
+
351
+ ```bash
352
+ epa_latex_summary \
353
+ --summary-csv outputs/alignanything_harness/run_xxx/summary.csv
354
+ ```
355
+
356
+ 输出目录默认是 `<summary_dir>/paper_tables/`,包含:
357
+
358
+ - `main_table.tex`:正文短表(超长时自动抽样压缩)
359
+ - `dataset_table.tex`:按数据集聚合表
360
+ - `appendix_full_table.tex`:完整长表(适合附录)
361
+
362
+ 在论文里使用(两种方式):
363
+
364
+ 1. 方式 A:拖入 Overleaf
365
+
366
+ - 把 `paper_tables/*.tex` 拖到 Overleaf 项目根目录(或子目录)
367
+ - 在论文主文件导言区加:`\usepackage{booktabs}` 和 `\usepackage{longtable}`
368
+ - 在正文中插入(若你放在子目录,例如 `tables/`,则用 `\input{tables/main_table.tex}` 这种相对路径):
369
+
370
+ ```tex
371
+ % 主文短表
372
+ \input{main_table.tex}
373
+
374
+ % 数据集聚合表
375
+ \input{dataset_table.tex}
376
+
377
+ % 附录长表
378
+ \input{appendix_full_table.tex}
379
+ ```
380
+
381
+ 2. 方式 B:复制粘贴
382
+
383
+ - 直接打开对应 `.tex` 文件,复制表格代码并粘贴到论文正文/附录位置
384
+ - 同样需要在导言区加入:`\usepackage{booktabs}` 和 `\usepackage{longtable}`
385
+ - `main_table.tex` 与 `dataset_table.tex` 是 `table` 环境,`appendix_full_table.tex` 是 `longtable` 环境
386
+
387
+ ## 输出目录
388
+
389
+ 典型输出:
390
+
391
+ - 主流程:`outputs/run_YYYYmmdd_HHMMSS/`
392
+ - traj:`outputs/traj_tool/run_YYYYmmdd_HHMMSS/`
393
+ - ape:`outputs/ape/run_YYYYmmdd_HHMMSS/`
394
+ - rpe:`outputs/rpe/run_YYYYmmdd_HHMMSS/`
395
+ - res:`outputs/res/run_YYYYmmdd_HHMMSS/`
396
+ - harness:`outputs/alignanything_harness/run_YYYYmmdd_HHMMSS/`
397
+
398
+ 主流程目录常见文件:
399
+
400
+ - `metrics.json`
401
+ - `metrics_summary.csv`
402
+ - `report_zh.md`
403
+ - `report_en.md`
404
+ - `plots/*.png`
405
+
406
+ ## 代码结构
407
+
408
+ ```text
409
+ epa/
410
+ ├── pyproject.toml
411
+ ├── src/epa/
412
+ │ ├── cli.py # epa 主 CLI
413
+ │ ├── runner.py # engine 分发
414
+ │ ├── config.py # PipelineOptions
415
+ │ ├── config_cli.py # --config / 全局配置注入
416
+ │ ├── config_tool.py # epa_config
417
+ │ ├── traj_tool.py # epa_traj
418
+ │ ├── ape_tool.py # epa_ape
419
+ │ ├── rpe_tool.py # epa_rpe
420
+ │ ├── metric_cli_common.py # APE/RPE 共享 CLI 逻辑
421
+ │ ├── core/
422
+ │ │ ├── pipeline_modular.py # modular 三步主流程
423
+ │ │ ├── time_alignment.py
424
+ │ │ ├── calibration.py
425
+ │ │ ├── evaluation.py
426
+ │ │ ├── math_utils.py
427
+ │ │ └── io_utils.py
428
+ │ ├── viz/
429
+ │ │ ├── rerun_viz.py # Rerun logging
430
+ │ │ └── metric_plots.py # 指标绘图/聚合图
431
+ │ └── benchmark/
432
+ │ ├── alignanything_harness.py
433
+ │ ├── plot_summary.py
434
+ │ ├── metrics_res.py
435
+ │ └── res.py # epa_res
436
+ ├── docs/
437
+ │ ├── architecture.md
438
+ │ └── evaluation_inputs.md
439
+ └── tests/
440
+ ├── unit/
441
+ └── smoke/
442
+ ```