vturrisi / solo-learn

solo-learn: a library of self-supervised methods for visual representation learning powered by Pytorch Lightning
MIT License
1.38k stars 181 forks source link

Re-index targets in knn to guarantee the continuity of indices #345

Closed realliyifei closed 7 months ago

realliyifei commented 1 year ago

Re-index targets in knn as [0, num_classes - 1] to guarantee the continuity of indices. Avoid errors for the datasets that have discontiguous indices.

codecov[bot] commented 1 year ago

Codecov Report

Merging #345 (3954a22) into main (66cad5b) will increase coverage by 0.02%. The diff coverage is 100.00%.

Additional details and impacted files | Flag | Coverage Δ | | *Carryforward flag | |---|---|---|---| | cpu | `80.97% <100.00%> (+0.02%)` | :arrow_up: | | | dali | `39.50% <ø> (ø)` | | Carriedforward from [66cad5b](https://app.codecov.io/gh/vturrisi/solo-learn/commit/66cad5b879e8062b813b3fdedfc518262143ab4b?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Victor+Turrisi) | *This pull request uses carry forward flags. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Victor+Turrisi) to find out more. | [Impacted Files](https://app.codecov.io/gh/vturrisi/solo-learn/pull/345?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Victor+Turrisi) | Coverage Δ | | |---|---|---| | [solo/utils/knn.py](https://app.codecov.io/gh/vturrisi/solo-learn/pull/345?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Victor+Turrisi#diff-c29sby91dGlscy9rbm4ucHk=) | `98.68% <100.00%> (+0.11%)` | :arrow_up: |