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

Fix TypeError when iterating MS1MV3 dataset #2137

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vinhtq115
Copy link
Contributor

Recently, I tried training with MS1MV3 dataset but I always encountered this exception:

Exception in thread Thread-3:
Traceback (most recent call last):
  File "/home/tran.quang.vinh/miniconda3/envs/gnn/lib/python3.10/threading.py", line 1009, in _bootstrap_inner
    self.run()
  File "/mnt/disk2/tran.quang.vinh/FR/insightface/recognition/arcface_torch/dataset.py", line 89, in run
    for item in self.generator:
  File "/home/tran.quang.vinh/miniconda3/envs/gnn/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 681, in __next__
    data = self._next_data()
  File "/home/tran.quang.vinh/miniconda3/envs/gnn/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 1376, in _next_data
    return self._process_data(data)
  File "/home/tran.quang.vinh/miniconda3/envs/gnn/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 1402, in _process_data
    data.reraise()
  File "/home/tran.quang.vinh/miniconda3/envs/gnn/lib/python3.10/site-packages/torch/_utils.py", line 461, in reraise
    raise exception
TypeError: Caught TypeError in DataLoader worker process 0.
Original Traceback (most recent call last):
  File "/home/tran.quang.vinh/miniconda3/envs/gnn/lib/python3.10/site-packages/torch/utils/data/_utils/worker.py", line 302, in _worker_loop
    data = fetcher.fetch(index)
  File "/home/tran.quang.vinh/miniconda3/envs/gnn/lib/python3.10/site-packages/torch/utils/data/_utils/fetch.py", line 49, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/home/tran.quang.vinh/miniconda3/envs/gnn/lib/python3.10/site-packages/torch/utils/data/_utils/fetch.py", line 49, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/mnt/disk2/tran.quang.vinh/FR/insightface/recognition/arcface_torch/dataset.py", line 166, in __getitem__
    label = torch.tensor(label, dtype=torch.long)
TypeError: 'numpy.float32' object cannot be interpreted as an integer

This PR simply converts label from float to int in order to fix the above exception.

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

Successfully merging this pull request may close these issues.

1 participant