Save the point cloud as a ply file and a npz.
(
self,
output_dir: str,
overwrite: bool = False,
save_ply: bool = True,
save_pt: bool = True,
)
| 650 | return self |
| 651 | |
| 652 | def save( |
| 653 | self, |
| 654 | output_dir: str, |
| 655 | overwrite: bool = False, |
| 656 | save_ply: bool = True, |
| 657 | save_pt: bool = True, |
| 658 | ): |
| 659 | """Save the point cloud as a ply file and a npz.""" |
| 660 | if os.path.exists(output_dir) and not overwrite: |
| 661 | raise RuntimeError |
| 662 | os.makedirs(output_dir, exist_ok=True) |
| 663 | |
| 664 | # o3d point cloud |
| 665 | if save_ply: |
| 666 | o3d_pcds = self.get_o3d_pcds() |
| 667 | for i in range(self.xyz_w.size(0)): |
| 668 | filename = os.path.join(output_dir, f'pcd_{i}.ply') |
| 669 | o3d.io.write_point_cloud( |
| 670 | filename=filename, |
| 671 | pointcloud=o3d_pcds[i], |
| 672 | ) |
| 673 | |
| 674 | # pt |
| 675 | if save_pt: |
| 676 | filename = os.path.join(output_dir, f'state_dict.pt') |
| 677 | state_dict = self.state_dict() |
| 678 | torch.save(state_dict, filename) |
| 679 | |
| 680 | def save_as_npbgpp( |
| 681 | self, |
nothing calls this directly
no test coverage detected