(local_rank: int, world_rank, world_size: int, cfg: Config)
| 1106 | os.makedirs(path) |
| 1107 | |
| 1108 | def main(local_rank: int, world_rank, world_size: int, cfg: Config): |
| 1109 | runner = Runner(local_rank, world_rank, world_size, cfg) |
| 1110 | |
| 1111 | render_stats = runner.eval('val') |
| 1112 | |
| 1113 | ### function test for transform and inverse transform |
| 1114 | # transform_stats = runner.test_transform() |
| 1115 | # runner.compare_render_stats(render_stats, transform_stats) |
| 1116 | compress_dir = f"{cfg.result_dir}/compression" |
| 1117 | if not cfg.decode_only: |
| 1118 | create_dir(compress_dir) |
| 1119 | |
| 1120 | if cfg.anchor_type == "video": # TODO: change "video" to "video_deprecated" |
| 1121 | splats_list_c = runner.compress(compress_dir) |
| 1122 | elif cfg.anchor_type == "video_codec": # TODO: change "video_codec" to "video" |
| 1123 | if not cfg.decode_only: |
| 1124 | runner.video_encode(compress_dir) |
| 1125 | splats_list_c = runner.video_decode(compress_dir) |
| 1126 | elif cfg.anchor_type == "pcc": |
| 1127 | splats_list_c = runner.pcc_compress(compress_dir) |
| 1128 | else: |
| 1129 | raise NotImplementedError(f"{cfg.anchor_type} Anchor has not been implemented.") |
| 1130 | |
| 1131 | # save the sequences of decoded gaussian splats into the sequences of ply files |
| 1132 | decoded_ply_dir = f"{cfg.result_dir}/decoded_ply" |
| 1133 | create_dir(decoded_ply_dir) |
| 1134 | for idx, splats_c in enumerate(splats_list_c): |
| 1135 | decoded_ply_filename = os.path.basename(runner.ply_filename_list[idx]) |
| 1136 | save_ply(splats_c, os.path.join(decoded_ply_dir, decoded_ply_filename)) |
| 1137 | |
| 1138 | for splats, splats_c in zip(runner.splats_list, splats_list_c): |
| 1139 | for k in splats.keys(): |
| 1140 | splats[k].data = splats_c[k].to(runner.device) |
| 1141 | |
| 1142 | compress_stats = runner.eval(stage="compress") |
| 1143 | runner.compare_render_stats(render_stats, compress_stats, name1="Uncompressed", name2="Compressed") |
| 1144 | |
| 1145 | runner.stack_render_img_to_vid() |
| 1146 | runner.eval_pngs_with_gsc_ctc_metrics() |
| 1147 | # runner.summary() |
| 1148 | |
| 1149 | if __name__ == "__main__": |
| 1150 | configs = { |
nothing calls this directly
no test coverage detected