Non-AR-Spatial-Temporal-Transformer icon indicating copy to clipboard operation
Non-AR-Spatial-Temporal-Transformer copied to clipboard

how to train nuscenes dataset

Open k-lam opened this issue 3 years ago • 3 comments

I have downloaded the nuscenes mini dataset, and prepare it according to the README.md. I get the follow exception, when I run python run.py ./configs/non_ar_transformer_nuscenes.py. Should I provide the file path to data to run.py? And how?

File "run.py", line 73, in main trainer.fit(model) File "/usr/local/lib/python3.6/dist-packages/pytorch_lightning/trainer/states.py", line 48, in wrapped_fn result = fn(self, *args, **kwargs) File "/usr/local/lib/python3.6/dist-packages/pytorch_lightning/trainer/trainer.py", line 1073, in fit results = self.accelerator_backend.train(model) File "/usr/local/lib/python3.6/dist-packages/pytorch_lightning/accelerators/gpu_backend.py", line 51, in train results = self.trainer.run_pretrain_routine(model) File "/usr/local/lib/python3.6/dist-packages/pytorch_lightning/trainer/trainer.py", line 1224, in run_pretrain_routine self._run_sanity_check(ref_model, model) File "/usr/local/lib/python3.6/dist-packages/pytorch_lightning/trainer/trainer.py", line 1249, in _run_sanity_check self.reset_val_dataloader(ref_model) File "/usr/local/lib/python3.6/dist-packages/pytorch_lightning/trainer/data_loading.py", line 337, in reset_val_dataloader self.num_val_batches, self.val_dataloaders = self._reset_eval_dataloader(model, 'val') File "/usr/local/lib/python3.6/dist-packages/pytorch_lightning/trainer/data_loading.py", line 299, in _reset_eval_dataloader num_batches = len(dataloader) if _has_len(dataloader) else float('inf') File "/usr/local/lib/python3.6/dist-packages/pytorch_lightning/trainer/data_loading.py", line 70, in _has_len raise ValueError('Dataloader returned 0 length.' ValueError: Dataloader returned 0 length. Please make sure that your Dataloader at least returns 1 batch

k-lam avatar Nov 09 '21 03:11 k-lam

I have fixed it. We should change the dir path in line 82 of nuscenes.py file. The path must be the $SAVE_ROOT, where I run the script:

        python scripts/nuscenes_preprocess.py $YOUR_NUSCENES_DATA_ROOT $SAVE_ROOT -v $NUSCENES_VERSION

k-lam avatar Nov 11 '21 02:11 k-lam

Hello, @k-lam. I have the same problem. 截图_20225716025739 did you mean replace the "{self.root_dir}/annotations" to "SAVE_ROOT"? But after that, the problem still exists. The contents of my SAVE_ROOT as follows: 截图_20220416030454 截图_20220216030240 And After replacing the "{self.root_dir}/annotations" to "SAVE_ROOT/frames_ann", the problem also exists. Could you tell me how you solved it in detial, please? Thank you very much.

Salem-95 avatar Mar 16 '22 07:03 Salem-95

I have solved it. Since the program has been run before, the "os.path.exists(cache_dir)" is True. And "force_regenerate" default is False. So the "self._make_cache(cache_dir, scenes_list_file)" didn't run again after modifing the "SAVE_ROOT/frames_ann". Just delete the folder "cache_dir". 截图_20223216073211

Salem-95 avatar Mar 16 '22 11:03 Salem-95