Skip to content
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

ValueError: expected sequence of length 240000 at dim 2 (got 150010) #11

Open
mrkushalsharma opened this issue Jan 3, 2022 · 1 comment

Comments

@mrkushalsharma
Copy link

When I run following command:
sh scripts/preproc.sh

I faced #6 issue.
and after using the solution from #6 which is as follows:
I replaced the code in line 148 of preprocess.py with the following,
batch_x = batch_sample.batch_out_dict['waveform']

then I faced this issue

Extracting scalar......

 74%|███████████████████████████████▏          | 84/113 [01:16<00:26,  1.10it/s]
Traceback (most recent call last):
  File "seld/main.py", line 59, in <module>
    sys.exit(main(args, cfg))
  File "seld/main.py", line 36, in main
    preprocessor.extract_scalar()
  File "/home/csinuc10i5/esp32/EIN-SELD/seld/learning/preprocess.py", line 145, in extract_scalar
    for it, batch_sample in iterator:
  File "/home/csinuc10i5/anaconda3/envs/ein/lib/python3.7/site-packages/tqdm/std.py", line 1180, in __iter__
    for obj in iterable:
  File "/home/csinuc10i5/anaconda3/envs/ein/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 517, in __next__
    data = self._next_data()
  File "/home/csinuc10i5/anaconda3/envs/ein/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1179, in _next_data
    return self._process_data(data)
  File "/home/csinuc10i5/anaconda3/envs/ein/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1225, in _process_data
    data.reraise()
  File "/home/csinuc10i5/anaconda3/envs/ein/lib/python3.7/site-packages/torch/_utils.py", line 429, in reraise
    raise self.exc_type(msg)
ValueError: Caught ValueError in DataLoader worker process 4.
Original Traceback (most recent call last):
  File "/home/csinuc10i5/anaconda3/envs/ein/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 202, in _worker_loop
    data = fetcher.fetch(index)
  File "/home/csinuc10i5/anaconda3/envs/ein/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 47, in fetch
    return self.collate_fn(data)
  File "/home/csinuc10i5/esp32/EIN-SELD/seld/methods/data.py", line 134, in collate_fn
    return PinMemCustomBatch(batch_dict)
  File "/home/csinuc10i5/esp32/EIN-SELD/seld/methods/data.py", line 121, in __init__
    'waveform': torch.tensor(batch_x, dtype=torch.float32),
ValueError: expected sequence of length 240000 at dim 2 (got 150010)

My environment is as follows:
I am not using cuda.
I am using NUC11PAHi5()
Python version 3.7.11

I also managed to download the code and datasets from GitHub without issue and modified the code only to bypass issue#6 which I detailed above.

@yinkalario
Copy link
Owner

Thanks for raising the problem.

It seems there might be some issues with your data. The original sequence length is 4 secs in the config file, which has a length of 32,000 * 4 = 128,000. It seems you modified that to be 240,000, which is 7.5 secs. And there is one sample from your data that only has 150010 samples. So the segmentation of the original data is not divided with no remainder. Please confirm if you used the default config file.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants