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

Modify the number of positive samples #31

Open
qxpBlog opened this issue Dec 21, 2024 · 1 comment
Open

Modify the number of positive samples #31

qxpBlog opened this issue Dec 21, 2024 · 1 comment

Comments

@qxpBlog
Copy link

qxpBlog commented Dec 21, 2024

Sorry, @rm-wu @ga1i13o @gmberton @Enrico-Chiavassa . I want to modify the number of positive samples per round during training, but the following error occurred. How can I solve this problem:

Traceback (most recent call last):
  File "train.py", line 153, in <module>
    for images, triplets_local_indexes, _ in tqdm(triplets_dl, ncols=100):
  File "/home/qxp/anaconda3/envs/vpr/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__
    for obj in iterable:
  File "/home/qxp/anaconda3/envs/vpr/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 630, in __next__
    data = self._next_data()
  File "/home/qxp/anaconda3/envs/vpr/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1344, in _next_data
    return self._process_data(data)
  File "/home/qxp/anaconda3/envs/vpr/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1370, in _process_data
    data.reraise()
  File "/home/qxp/anaconda3/envs/vpr/lib/python3.8/site-packages/torch/_utils.py", line 706, in reraise
    raise exception
RuntimeError: Caught RuntimeError in DataLoader worker process 0.
Original Traceback (most recent call last):
  File "/home/qxp/anaconda3/envs/vpr/lib/python3.8/site-packages/torch/utils/data/_utils/worker.py", line 309, in _worker_loop
    data = fetcher.fetch(index)  # type: ignore[possibly-undefined]
  File "/home/qxp/anaconda3/envs/vpr/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 52, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/home/qxp/anaconda3/envs/vpr/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 52, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/data/qxp/VPR/vpr/datasets_ws.py", line 278, in __getitem__
    query_index, best_positive_index, neg_indexes = torch.split(self.triplets_global_indexes[index], (1, 1, self.negs_num_per_query))
  File "/home/qxp/anaconda3/envs/vpr/lib/python3.8/site-packages/torch/functional.py", line 196, in split
    return tensor.split(split_size_or_sections, dim)
  File "/home/qxp/anaconda3/envs/vpr/lib/python3.8/site-packages/torch/_tensor.py", line 917, in split
    return torch._VF.split_with_sizes(self, split_size, dim)
RuntimeError: split_with_sizes expects split_sizes to sum exactly to 21 (input tensor's size at dimension 0), but got split_sizes=[1, 1, 10]

@gmberton
Copy link
Owner

Can you share the info.log file?

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