Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Fixes wrong label in FilePathDataset #94

Merged
merged 3 commits into from
Feb 9, 2021

Conversation

ibraheemmmoosa
Copy link
Contributor

@ibraheemmmoosa ibraheemmmoosa commented Feb 9, 2021

Instead of labels, file names were used for making label-to-class map.

What does this PR do?

Fixes #93

Before submitting

  • Was this discussed/approved via a Github issue? (no need for typos and docs improvements)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests? [not needed for typos/docs]
  • Did you verify new and existing tests pass locally with your changes?
  • If you made a notable change (that affects users), did you update the CHANGELOG?

PR review

  • Is this pull request ready for review? (if not, please submit in draft mode)

Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.

Did you have fun?

Make sure you had fun coding 🙃

Instead of labels, file names were used for making label-to-class map.
@codecov
Copy link

codecov bot commented Feb 9, 2021

Codecov Report

Merging #94 (7342cdf) into master (253063d) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #94   +/-   ##
=======================================
  Coverage   86.63%   86.64%           
=======================================
  Files          45       45           
  Lines        1369     1370    +1     
=======================================
+ Hits         1186     1187    +1     
  Misses        183      183           
Flag Coverage Δ
unittests 86.64% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
flash/vision/classification/data.py 77.77% <100.00%> (+0.17%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 253063d...b7d06b4. Read the comment docs.

@Borda Borda changed the title Fixes #93 Fixes wrong label in FilePathDataset Feb 9, 2021
@Borda Borda added the bug / fix Something isn't working label Feb 9, 2021
@@ -56,7 +56,7 @@ def __init__(
self.transform = transform
self.loader = loader
if self.has_labels:
self.label_to_class_mapping = {v: k for k, v in enumerate(list(sorted(list(set(self.fnames)))))}
self.label_to_class_mapping = {v: k for k, v in enumerate(list(sorted(list(set(self.labels)))))}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.label_to_class_mapping = {v: k for k, v in enumerate(list(sorted(list(set(self.labels)))))}
self.label_to_class_mapping = {v: k for k, v in enumerate(sorted(set(self.labels)))}

maybe we can just zip

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated the code. I think it now looks cleaner.

@williamFalcon williamFalcon merged commit c79e403 into Lightning-Universe:master Feb 9, 2021
@ibraheemmmoosa ibraheemmmoosa deleted the patch-2 branch February 10, 2021 04:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug / fix Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FilePathDataset is giving wrong labels.
3 participants