LunarShen / SECRET

SECRET: Self-Consistent Pseudo Label Refinement for Unsupervised Domain Adaptive Person Re-Identification
MIT License
17 stars 5 forks source link

StopIteration after refine dataset #1

Closed hoahoa1808 closed 1 year ago

hoahoa1808 commented 2 years ago

@LunarShen , Sorry if my quest seem quite silly. I have tried to reimplement your SECRET repo. In phase 2 training with target dataset, i got the below bug:

Traceback (most recent call last):
  File "main.py", line 25, in <module>
    main(args)
  File "main.py", line 20, in main
    engine.run()
  File "/content/hahaha/secret/engine/mutualrefine.py", line 98, in run
    self.generate_pseudo_dataset(epoch)
  File "/content/hahaha/secret/engine/mutualrefine.py", line 215, in generate_pseudo_dataset
    x = next(loader)
  File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 517, in __next__
    data = self._next_data()
  File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 1172, in _next_data
    raise StopIteration
StopIteration

I tried finding out about that error then perceived that Sampler RandomMultipleGallerySampler is the source of the bug. Specifically, after refine global labels in the first epoch I have only 3 classes, thus only 12 samples are selected. I wonder whether that is reason why I have the bug?

Please check my issue. Thank you.

LunarShen commented 1 year ago

The Hyper-parameter K controls the mutual refinement procedure. If K is too large, it is very easy to filter out most instances, resulting in insufficient training data to form a single mini-batch and will be dropped in the dataloader. You can follow the provided scripts to reproduce the paper results.