根据image_path获取对应的ground truth代码文件路径
(image_path: Path)
| 564 | } |
| 565 | |
| 566 | def get_gt_code_path(image_path: Path) -> Path: |
| 567 | """根据image_path获取对应的ground truth代码文件路径""" |
| 568 | # 将*_plot_*.png改为*_code_*.py |
| 569 | filename = image_path.name |
| 570 | # 替换plot为code,png为py |
| 571 | code_filename = filename.replace('_plot_', '_code_').replace('.png', '.py') |
| 572 | return image_path.parent / code_filename |
| 573 | |
| 574 | |
| 575 | def read_gt_code(gt_code_path: Path) -> str: |