[Feature] Add MultiTaskDataset to support multi-task training.#808
[Feature] Add MultiTaskDataset to support multi-task training.#808mzr1996 wants to merge 1 commit intoopen-mmlab:devfrom
MultiTaskDataset to support multi-task training.#808Conversation
Codecov Report
@@ Coverage Diff @@
## dev #808 +/- ##
==========================================
+ Coverage 87.02% 87.05% +0.03%
==========================================
Files 130 131 +1
Lines 8538 8739 +201
Branches 1468 1512 +44
==========================================
+ Hits 7430 7608 +178
- Misses 888 895 +7
- Partials 220 236 +16
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
|
Any update for this? |
|
FormatMultiTaskLabels |
|
@mzr1996 @Ezra-Yu This is great, thanks for this, i did only half of the job in #675 ! I have merged both MultiClsHead and MultiTaskDataset in my repo https://github.com/piercus/mmclassification/tree/multi-task What are the next steps for this : Thank you for your help |
|
Closed since #1229 is merged |
Motivation
To support using a single backbone to perform multiple classification tasks.
Modification
This PR is one part of the multi-task support plan, and it depends on #675 to build a network.
BC-breaking (Optional)
No
Use cases
Here is a detailed multi-task support design. First, the multi-task means using one backbone and multiple heads to do classification on an image with multiple kinds of labels.
Dataset
The current multi-task requires full labels on every image, which means you cannot use partial-labeled samples to train the multi-task model.
To create a multi-task dataset, you can use the
MultiTaskDatasetclass and prepare an annotation file. Here is a brief example:The annotation json file example
{ "metainfo": { "tasks": [ {"name": "gender", "type": "single-label", "categories": ["male", "female"]}, {"name": "wear", "type": "multi-label", "categories": ["shirt", "coat", "jeans", "pants"]} ] }, "data_list": [ { "img_path": "a.jpg", "gender_img_label": 0, "wear_img_label": [1, 0, 1, 0] }, { "img_path": "b.jpg", "gender_img_label": 1, "wear_img_label": [0, 1, 0, 1] }, ... ] }The detailed usage and example of the
MultiTaskDatasetcan be found hereAnd here is a script to use the CIFAR10 dataset to generate an example multi-task dataset, just run it in the
datafolder. And here is the file structure.And here is an example config to train on the multi-task dataset.
Then, we can train the dataset by
python tools/train.py configs/resnet/multi-task-demo.pyChecklist
Before PR:
After PR: