integrating record3d and fix checkpoint delete issue (#722)

* integrating record3d

* fix save checkpoint logic

* added record3d data
This commit is contained in:
Ethan Weber authored and GitHub committed 2022-10-07 00:34:51 -07:00
1 parent fe5f7ea97d
commit 2531242d1d
3 files changed
+28 -12

No files matched your search

@@ -41,7 +41,7 @@ class Record3DDataParserConfig(DataParserConfig):
_target: Type = field(default_factory=lambda: Record3D)
"""target class to instantiate"""
data: Path = Path("data/record3d/garden")
data: Path = Path("data/record3d/bear")
"""Location of data"""
val_skip: int = 8
"""1/val_skip images to use for validation."""
@@ -49,7 +49,7 @@ class Record3DDataParserConfig(DataParserConfig):
"""Scene scale."""
orientation_method: Literal["pca", "up"] = "up"
"""The method to use for orientation"""
max_dataset_size: int = 150
max_dataset_size: int = 300
"""Max number of images to train on. If the dataset has
more, images will be sampled approximately evenly."""
@@ -69,7 +69,7 @@ class Record3D(DataParser):
image_filenames = []
for f in image_dir.iterdir():
if f.stem.isdigit(): # removes possible duplicate images (for example, 123(3).jpg)
image_filenames.append(image_dir / f)
image_filenames.append(f)
image_filenames = sorted(image_filenames, key=lambda fn: int(fn.stem))
image_filenames = np.array(image_filenames)
+3 -3
View File
@@ -285,6 +285,9 @@ class Trainer:
pipeline = self.pipeline.module.state_dict() # type: ignore
else:
pipeline = self.pipeline.state_dict()
if len(self.prev_ckpt_paths) == self.config.trainer.num_ckpt_to_save:
self.prev_ckpt_paths[0].unlink(missing_ok=True)
self.prev_ckpt_paths.pop(0)
torch.save(
{
"step": step,
@@ -295,9 +298,6 @@ class Trainer:
ckpt_path,
)
self.prev_ckpt_paths.append(ckpt_path)
if len(self.prev_ckpt_paths) > self.config.trainer.num_ckpt_to_save:
self.prev_ckpt_paths[0].unlink(missing_ok=True)
self.prev_ckpt_paths.pop(0)
@profiler.time_function
def train_iteration(self, step: int) -> Tuple[torch.Tensor, Dict[str, torch.Tensor], Dict[str, torch.Tensor]]: