-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[Feature] Support Multi-task. #1229
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* [Feature] Support MPS device. * Add `auto_select_device` * Add unit tests
* Fix albu BUG: using albu will cause the label from array(x) to array([x]) and crash the trainning * Fix common * Using copy incase potential bug in multi-label tasks * Improve coding * Improve code logic * Add unit test * Fix typo * Fix yapf
add mask to loss
Co-authored-by: Colle <piercus@users.noreply.github.com>
Multi task mzr
@mzr1996 we have updated metrics and unit tests following your suggestions. It creates unseen situations as input of following functions :
Please share your thoughts |
…ion into multi_task_mzr
add eval _mask
@mzr1996 an eval_mask has been added please share your feedback |
mzr1996
requested changes
Dec 16, 2022
Co-authored-by: Ma Zerun <mzr1996@163.com>
mzr1996
approved these changes
Dec 19, 2022
6 tasks
Thanks @marouaneamz for your work on this ! This has been a great internship :-) |
6 tasks
6 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Multi-tasking
This is inspired from #675 and #808
Inhomogenous dataset
One of the main change compared to #675 is to take into account some inhomogenous dataset.
By inhomogenous dataset, i mean, some sample may have ground truth value for one task, but not for another task, and we need to use mask in the mult-task training logic in order to modulate which sample to take into account with which loss.
1.x
We tried to follow 1.X standard as much as possible
Made with open-mmlab in mind, not only mmcls
The main idea is to provide a generic and flexible multi-task toolbox.
This is for mmclassification, but we tried to limit the deps between the MultiTask Implementation and mmcls, which is mostly related to the data_sample types that can be handled.
We hope this can be discussed further, and we think making a more generic version of it may be part of another PR.
Modification
Modifications are :
MultiTaskDataset
+ unit testsFormatMultiTaskLabels
+ unit testsMultiTaskMetric
+ unit testsMultiTaskHead
+ unit testsMultiTaskDataSample
+ unit testsBC-breaking (Optional)
No
Use cases (Optional)
Simple use case
The basic use case here it to classify multiple classes using the same neural network.
This can be useful if you want to "superclass" ImageNet for example (see https://robustness.readthedocs.io/en/latest/example_usage/custom_imagenet.html)
Nested use case
If you have 4 classification task, 2 about classifying the background, and 2 about classiying the foreground, you can decide to organize your task like
By doing this, you can share layers between some tasks
Checklist
Before PR:
After PR: