CO3Dv2 trainer configs

Summary:
Adds yaml configs to train selected methods on CO3Dv2.

Few more updates:
1) moved some fields to base classes so that we can check is_multisequence in experiment.py
2) skip loading all train cameras for multisequence datasets, without this, co3d-fewview is untrainable
3) fix bug in json index dataset provider v2

Reviewed By: kjchalup

Differential Revision: D38952755

fbshipit-source-id: 3edac6fc8e20775aa70400bd73a0e6d52b091e0c
This commit is contained in:
David Novotny
2022-08-30 13:42:19 -07:00
committed by Facebook GitHub Bot
parent 03562d87f5
commit 1163eaab43
17 changed files with 120 additions and 21 deletions

View File

@@ -0,0 +1,8 @@
data_source_ImplicitronDataSource_args:
dataset_map_provider_class_type: JsonIndexDatasetMapProviderV2
dataset_map_provider_JsonIndexDatasetMapProviderV2_args:
category: teddybear
subset_name: fewview_dev
training_loop_ImplicitronTrainingLoop_args:
evaluator_ImplicitronEvaluator_args:
is_multisequence: true

View File

@@ -0,0 +1,4 @@
defaults:
- repro_multiseq_nerf_wce.yaml
- repro_multiseq_co3dv2_base.yaml
- _self_

View File

@@ -0,0 +1,4 @@
defaults:
- repro_multiseq_nerformer.yaml
- repro_multiseq_co3dv2_base.yaml
- _self_

View File

@@ -0,0 +1,4 @@
defaults:
- repro_multiseq_srn_ad_hypernet.yaml
- repro_multiseq_co3dv2_base.yaml
- _self_

View File

@@ -0,0 +1,4 @@
defaults:
- repro_multiseq_srn_wce.yaml
- repro_multiseq_co3dv2_base.yaml
- _self_

View File

@@ -0,0 +1,8 @@
data_source_ImplicitronDataSource_args:
dataset_map_provider_class_type: JsonIndexDatasetMapProviderV2
dataset_map_provider_JsonIndexDatasetMapProviderV2_args:
category: teddybear
subset_name: manyview_dev_0
training_loop_ImplicitronTrainingLoop_args:
evaluator_ImplicitronEvaluator_args:
is_multisequence: false

View File

@@ -0,0 +1,4 @@
defaults:
- repro_singleseq_idr.yaml
- repro_singleseq_co3dv2_base.yaml
- _self_

View File

@@ -0,0 +1,4 @@
defaults:
- repro_singleseq_nerf.yaml
- repro_singleseq_co3dv2_base.yaml
- _self_

View File

@@ -0,0 +1,4 @@
defaults:
- repro_singleseq_nerformer.yaml
- repro_singleseq_co3dv2_base.yaml
- _self_

View File

@@ -0,0 +1,4 @@
defaults:
- repro_singleseq_srn_noharm.yaml
- repro_singleseq_co3dv2_base.yaml
- _self_

View File

@@ -207,7 +207,10 @@ class Experiment(Configurable): # pyre-ignore: 13
val_loader,
) = accelerator.prepare(model, optimizer, train_loader, val_loader)
all_train_cameras = self.data_source.all_train_cameras
if not self.training_loop.evaluator.is_multisequence:
all_train_cameras = self.data_source.all_train_cameras
else:
all_train_cameras = None
# Enter the main training loop.
self.training_loop.run(

View File

@@ -30,6 +30,14 @@ logger = logging.getLogger(__name__)
class TrainingLoopBase(ReplaceableBase):
"""
Members:
evaluator: An EvaluatorBase instance, used to evaluate training results.
"""
evaluator: Optional[EvaluatorBase]
evaluator_class_type: Optional[str] = "ImplicitronEvaluator"
def run(
self,
train_loader: DataLoader,
@@ -58,7 +66,6 @@ class ImplicitronTrainingLoop(TrainingLoopBase): # pyre-ignore [13]
"""
Members:
eval_only: If True, only run evaluation using the test dataloader.
evaluator: An EvaluatorBase instance, used to evaluate training results.
max_epochs: Train for this many epochs. Note that if the model was
loaded from a checkpoint, we will restart training at the appropriate
epoch and run for (max_epochs - checkpoint_epoch) epochs.
@@ -82,8 +89,6 @@ class ImplicitronTrainingLoop(TrainingLoopBase): # pyre-ignore [13]
# Parameters of the outer training loop.
eval_only: bool = False
evaluator: EvaluatorBase
evaluator_class_type: str = "ImplicitronEvaluator"
max_epochs: int = 1000
store_checkpoints: bool = True
store_checkpoints_purge: int = 1

View File

@@ -406,8 +406,13 @@ optimizer_factory_ImplicitronOptimizerFactory_args:
linear_exponential_lr_milestone: 200
linear_exponential_start_gamma: 0.1
training_loop_ImplicitronTrainingLoop_args:
eval_only: false
evaluator_class_type: ImplicitronEvaluator
evaluator_ImplicitronEvaluator_args:
is_multisequence: false
camera_difficulty_bin_breaks:
- 0.97
- 0.98
eval_only: false
max_epochs: 1000
store_checkpoints: true
store_checkpoints_purge: 1
@@ -420,8 +425,3 @@ training_loop_ImplicitronTrainingLoop_args:
visdom_env: ''
visdom_port: 8097
visdom_server: http://127.0.0.1
evaluator_ImplicitronEvaluator_args:
camera_difficulty_bin_breaks:
- 0.97
- 0.98
is_multisequence: false

View File

@@ -190,6 +190,34 @@ class TestNerfRepro(unittest.TestCase):
experiment.dump_cfg(cfg)
experiment_runner.run()
@unittest.skip("This test runs nerf training on co3d v2 - manyview.")
def test_nerf_co3dv2_manyview(self):
# Train NERF
if not interactive_testing_requested():
return
with initialize_config_dir(config_dir=str(IMPLICITRON_CONFIGS_DIR)):
cfg = compose(
config_name="repro_singleseq_v2_nerf",
overrides=[],
)
experiment_runner = experiment.Experiment(**cfg)
experiment.dump_cfg(cfg)
experiment_runner.run()
@unittest.skip("This test runs nerformer training on co3d v2 - fewview.")
def test_nerformer_co3dv2_fewview(self):
# Train NeRFormer
if not interactive_testing_requested():
return
with initialize_config_dir(config_dir=str(IMPLICITRON_CONFIGS_DIR)):
cfg = compose(
config_name="repro_multiseq_v2_nerformer",
overrides=[],
)
experiment_runner = experiment.Experiment(**cfg)
experiment.dump_cfg(cfg)
experiment_runner.run()
@unittest.skip("This test checks resuming of the NeRF training.")
def test_nerf_blender_resume(self):
# Train one train batch of NeRF, then resume for one more batch.