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

[feat] Add multi label support #230

Merged
merged 6 commits into from
Apr 20, 2021
Merged

[feat] Add multi label support #230

merged 6 commits into from
Apr 20, 2021

Conversation

tchaton
Copy link
Contributor

@tchaton tchaton commented Apr 20, 2021

What does this PR do?

This PR adds support for multi-label

Fixes #208

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 🙃

@tchaton tchaton added this to the 0.3 milestone Apr 20, 2021
@tchaton tchaton requested a review from Borda as a code owner April 20, 2021 10:54
@tchaton tchaton self-assigned this Apr 20, 2021
@codecov
Copy link

codecov bot commented Apr 20, 2021

Codecov Report

Merging #230 (7a807ba) into master (781fa98) will increase coverage by 0.06%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #230      +/-   ##
==========================================
+ Coverage   86.49%   86.56%   +0.06%     
==========================================
  Files          57       57              
  Lines        2829     2843      +14     
==========================================
+ Hits         2447     2461      +14     
  Misses        382      382              
Flag Coverage Δ
unittests 86.56% <100.00%> (+0.06%) ⬆️

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

Impacted Files Coverage Δ
flash/data/data_pipeline.py 87.18% <ø> (ø)
flash/core/classification.py 100.00% <100.00%> (ø)
flash/core/model.py 94.04% <100.00%> (ø)
flash/vision/classification/model.py 96.66% <100.00%> (+0.83%) ⬆️
flash/vision/embedding/model.py 74.35% <100.00%> (ø)

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 781fa98...7a807ba. Read the comment docs.

flash/core/model.py Outdated Show resolved Hide resolved
flash/core/classification.py Outdated Show resolved Hide resolved

def to_metrics_format(self, x: torch.Tensor) -> torch.Tensor:
if getattr(self.hparams, "multi_label", False):
return F.sigmoid(x).int()
Copy link
Contributor

Choose a reason for hiding this comment

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

why int ? .round() might work better

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My bad, it was a bug.

flash/core/model.py Outdated Show resolved Hide resolved
flash/core/model.py Outdated Show resolved Hide resolved
flash/vision/classification/model.py Outdated Show resolved Hide resolved
flash/vision/classification/model.py Outdated Show resolved Hide resolved
flash/core/classification.py Outdated Show resolved Hide resolved
tests/vision/classification/test_model.py Outdated Show resolved Hide resolved
@ethanwharris ethanwharris self-requested a review April 20, 2021 11:18
Copy link
Collaborator

@ethanwharris ethanwharris left a comment

Choose a reason for hiding this comment

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

Looks good, see above small comments, meant to click comment rather than request changes haha

@pep8speaks
Copy link

pep8speaks commented Apr 20, 2021

Hello @tchaton! Thanks for updating this PR.

Line 184:121: E501 line too long (124 > 120 characters)

Comment last updated at 2021-04-20 11:39:16 UTC

Copy link
Collaborator

@ethanwharris ethanwharris left a comment

Choose a reason for hiding this comment

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

LGTM 😃

@tchaton tchaton merged commit 42f8db4 into master Apr 20, 2021
@tchaton tchaton deleted the multilabel_feat branch April 20, 2021 12:00
@aribornstein
Copy link
Contributor

LGTM

@ethanwharris ethanwharris mentioned this pull request Apr 24, 2021
8 tasks
@ThakurRajAnand
Copy link

@tchaton Do we have a multi-label example of doing fine-tuning for merged features?

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

Successfully merging this pull request may close these issues.

multi-label inconsistencies in the API
6 participants