zjjMaiMai / TinyHITNet

HITNet: Hierarchical Iterative Tile Refinement Network for Real-time Stereo Matching
152 stars 21 forks source link

AttributeError: 'NoneType' object has no attribute 'shape' #16

Closed Jack47746 closed 2 years ago

Jack47746 commented 2 years ago

Thank you for sharing this work, I encountered such a problem in the process of running, do you know how to solve it?

Traceback (most recent call last): File "train.py", line 171, in trainer.fit(model) File "/usr/local/lib/python3.7/dist-packages/pytorch_lightning/trainer/trainer.py", line 769, in fit self._fit_impl, model, train_dataloaders, val_dataloaders, datamodule, ckpt_path File "/usr/local/lib/python3.7/dist-packages/pytorch_lightning/trainer/trainer.py", line 719, in _call_and_handle_interrupt return self.strategy.launcher.launch(trainer_fn, *args, trainer=self, kwargs) File "/usr/local/lib/python3.7/dist-packages/pytorch_lightning/strategies/launchers/subprocess_script.py", line 93, in launch return function(*args, *kwargs) File "/usr/local/lib/python3.7/dist-packages/pytorch_lightning/trainer/trainer.py", line 809, in _fit_impl results = self._run(model, ckpt_path=self.ckpt_path) File "/usr/local/lib/python3.7/dist-packages/pytorch_lightning/trainer/trainer.py", line 1234, in _run results = self._run_stage() File "/usr/local/lib/python3.7/dist-packages/pytorch_lightning/trainer/trainer.py", line 1321, in _run_stage return self._run_train() File "/usr/local/lib/python3.7/dist-packages/pytorch_lightning/trainer/trainer.py", line 1343, in _run_train self._run_sanity_check() File "/usr/local/lib/python3.7/dist-packages/pytorch_lightning/trainer/trainer.py", line 1411, in _run_sanity_check val_loop.run() File "/usr/local/lib/python3.7/dist-packages/pytorch_lightning/loops/base.py", line 204, in run self.advance(args, kwargs) File "/usr/local/lib/python3.7/dist-packages/pytorch_lightning/loops/dataloader/evaluation_loop.py", line 154, in advance dl_outputs = self.epoch_loop.run(self._data_fetcher, dl_max_batches, kwargs) File "/usr/local/lib/python3.7/dist-packages/pytorch_lightning/loops/base.py", line 204, in run self.advance(*args, **kwargs) File "/usr/local/lib/python3.7/dist-packages/pytorch_lightning/loops/epoch/evaluation_epoch_loop.py", line 111, in advance batch = next(data_fetcher) File "/usr/local/lib/python3.7/dist-packages/pytorch_lightning/utilities/fetching.py", line 184, in next return self.fetching_function() File "/usr/local/lib/python3.7/dist-packages/pytorch_lightning/utilities/fetching.py", line 259, in fetching_function self._fetch_next_batch(self.dataloader_iter) File "/usr/local/lib/python3.7/dist-packages/pytorch_lightning/utilities/fetching.py", line 273, in _fetch_next_batch batch = next(iterator) File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 530, in next data = self._next_data() File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 570, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/fetch.py", line 49, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/fetch.py", line 49, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataset.py", line 416, in getitem return self.datasets[dataset_idx][sample_idx] File "/content/drive/MyDrive/TinyHITNet/dataset/kitti2015.py", line 40, in getitem "left": np2torch(cv2.imread(str(left_path), cv2.IMREAD_COLOR), bgr=True), File "/content/drive/MyDrive/TinyHITNet/dataset/utils.py", line 9, in np2torch if len(x.shape) == 2: AttributeError: 'NoneType' object has no attribute 'shape'

Como93 commented 2 years ago

Hello @Jack47746 ,

I would like to ask you how do you fix this error because I'm trying HITNet but I'm facing with the same error that you posted.

Could you help me?

Thank You.

Michele Comotti

DWJ111 commented 1 year ago

Hello @Jack47746 @Como93 I have also encountered the same problem. May I ask how you resolved it? Thank you very much for your help.

Como93 commented 1 year ago

Hi @DWJ111, hope you are fine and sorry for the late reply! Did you try to build the "slant_window" folder with the repository instructions? Because I had problem there last time that I tried to launch the neural network and I solved it. If you want we can discuss it in separate way in order to solve you problem and know each other.

Best regards

Michele