Skip to content
This repository was archived by the owner on Nov 2, 2024. It is now read-only.

a problem in linear_svm.py #10

Open
MurphyHanxu opened this issue Jan 16, 2023 · 0 comments
Open

a problem in linear_svm.py #10

MurphyHanxu opened this issue Jan 16, 2023 · 0 comments

Comments

@MurphyHanxu
Copy link

Epoch 0/9

train - positive_num: 66 - negative_num: 66 - data size: 128
Traceback (most recent call last):
File "linear_svm.py", line 274, in
best_model = train_model(data_loaders, model, criterion, optimizer, lr_schduler, num_epochs=10, device=device)
File "linear_svm.py", line 150, in train_model
for inputs, labels, cache_dicts in data_loaders[phase]:
File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/dataloader.py", line 435, in iter
return self._get_iterator()
File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/dataloader.py", line 381, in _get_iterator
return _MultiProcessingDataLoaderIter(self)
File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/dataloader.py", line 1072, in init
self._reset(loader, first_iter=True)
File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/dataloader.py", line 1105, in _reset
self._try_put_index()
File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/dataloader.py", line 1339, in _try_put_index
index = self._next_index()
File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/dataloader.py", line 618, in _next_index
return next(self._sampler_iter) # may raise StopIteration
File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/sampler.py", line 244, in iter
sampler_iter = iter(self.sampler)
File "/content/drive/MyDrive/R-CNN/py/utils/data/custom_batch_sampler.py", line 45, in iter
random.sample(self.idx_list[self.num_positive:], self.batch_negative))
File "/usr/lib/python3.8/random.py", line 363, in sample
raise ValueError("Sample larger than population or is negative")
ValueError: Sample larger than population or is negative

how to solve it ?

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

No branches or pull requests

1 participant