-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AttributeError: 'NoneType' object has no attribute 'shape' #21
Comments
Hey there, this is an error I usually get, if the datasets' folder structure is either not correct or if some of the images are missing/broken. In this case the opencv image loading function returns a None object, which has no attribute shape. Maybe you could double check, if the datasets are set up correctly? |
Thank you very much for your reply, I will check my data set according to your reply. |
Hi @17853313621 |
This is because the json file is inconsistent with the folder file, and the image is missing. |
Hello, I am creating an artificial intelligence algorithm and I encountered this error:
|
Hello, I have encountered this problem, but I don’t know how to solve it. I hope you can give me some help. Thank you very much.
python3 train.py --model-name zhou_full --depth-training-loaders "kitti_zhou_train" --train-batches-per-epoch 7293 --masking-enable --masking-from-epoch 15 --masking-linear-increase
Starting initialization
Loading training dataset metadata:
Loading validation dataset metadata:
Summary:
Epoch 0:
Traceback (most recent call last):
File "train.py", line 372, in
trainer.train()
File "train.py", line 340, in train
self._run_epoch()
File "train.py", line 228, in _run_epoch
for batch_idx, batch in enumerate(self.train_loaders):
File "/media/disk1/xgl/SGDepth-master/loaders/init.py", line 25, in iter
for batch_idx, *group in zip(length_iter, *infinite_iters):
File "/media/disk1/xgl/SGDepth-master/loaders/init.py", line 30, in _make_infinite
for batch in loader:
File "/home/xgl/anaconda3/envs/xgl/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 582, in next
return self._process_next_batch(batch)
File "/home/xgl/anaconda3/envs/xgl/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 608, in _process_next_batch
raise batch.exc_type(batch.exc_msg)
AttributeError: Traceback (most recent call last):
File "/home/xgl/anaconda3/envs/xgl/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 99, in _worker_loop
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/xgl/anaconda3/envs/xgl/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 99, in
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/xgl/anaconda3/envs/xgl/lib/python3.6/site-packages/torch/utils/data/dataset.py", line 85, in getitem
return self.datasets[dataset_idx][sample_idx]
File "/media/disk1/xgl/SGDepth-master/dataloader/pt_data_loader/basedataset.py", line 217, in getitem
sample = self.add_const_dataset_items(sample)
File "/media/disk1/xgl/SGDepth-master/dataloader/pt_data_loader/specialdatasets.py", line 47, in add_const_dataset_items
native_im_shape = sample[native_key].shape
AttributeError: 'NoneType' object has no attribute 'shape'
The text was updated successfully, but these errors were encountered: