leeyeehoo / CSRNet-pytorch

CSRNet: Dilated Convolutional Neural Networks for Understanding the Highly Congested Scenes
647 stars 261 forks source link

Unable to open object (object 'density' doesn't exist) #78

Closed joseantoniovz1 closed 4 years ago

joseantoniovz1 commented 4 years ago

I'm implementing the project in colab, i did the changes in the paths and when i try to run the train.py with python3 train.py part_A_train.json part_A_val.json 0 0 i got the error: /usr/local/lib/python3.6/dist-packages/torch/nn/_reduction.py:43: UserWarning: size_average and reduce args will be deprecated, please use reduction='sum' instead. warnings.warn(warning.format(ret)) epoch 0, processed 0 samples, lr 0.0000001000 /content/drive/My Drive/CSRNet-pytorch/image.py:12: H5pyDeprecationWarning: The default file mode will change to 'r' (read-only) in h5py 3.0. To suppress this warning, pass the mode you need to h5py.File(), or set the global default h5.get_config().default_file_mode, or set the environment variable H5PY_DEFAULT_READONLY=1. Available modes are: 'r', 'r+', 'w', 'w-'/'x', 'a'. See the docs for details. gt_file = h5py.File(gt_path) Traceback (most recent call last): File "train.py", line 230, in <module> main() File "train.py", line 92, in main train(train_list, model, criterion, optimizer, epoch) File "train.py", line 131, in train for i,(img, target)in enumerate(train_loader): File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 345, in __next__ data = self._next_data() File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 385, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp> data = [self.dataset[idx] for idx in possibly_batched_index] File "/content/drive/My Drive/CSRNet-pytorch/dataset.py", line 33, in __getitem__ img,target = load_data(img_path,self.train) File "/content/drive/My Drive/CSRNet-pytorch/image.py", line 13, in load_data target = np.asarray(gt_file['density']) File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper File "/usr/local/lib/python3.6/dist-packages/h5py/_hl/group.py", line 264, in __getitem__ oid = h5o.open(self.id, self._e(name), lapl=self._lapl) File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper File "h5py/h5o.pyx", line 190, in h5py.h5o.open KeyError: "Unable to open object (object 'density' doesn't exist)"

1297rohit commented 3 years ago

How did you solve this error ? I am also getting the same error. Please Help !!