Skip to content
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 183 commits into from
Dec 30, 2022
Merged
Show file tree
Hide file tree
Changes from 181 commits
Commits
Show all changes
183 commits
Select commit Hold shift + click to select a range
1c2974f
unit test for multi_task_head
piercus Jan 26, 2022
7c20f41
[Feature] MultiTaskHead (#628, #481)
piercus Jan 26, 2022
ad20f36
[Fix] lint for multi_task_head
piercus Jan 27, 2022
21b0a38
[Feature] Add `MultiTaskDataset` to support multi-task training.
mzr1996 Apr 24, 2022
787fc94
Merge remote-tracking branch 'origin/dev' into multi_task_head
mzr1996 Apr 29, 2022
2098c7e
Update MultiTaskClsHead
mzr1996 Apr 29, 2022
df68f03
Update docs
mzr1996 Apr 29, 2022
812f3d4
[CI] Add test mim CI. (#879)
mzr1996 Jun 22, 2022
11df205
[Fix] Remove duplicated wide-resnet metafile.
mzr1996 Jul 5, 2022
c03efee
[Feature] Support MPS device. (#894)
mzr1996 Jul 28, 2022
00f0e0d
[Fix] Fix Albu crash bug. (#918)
PeterH0323 Jul 28, 2022
9300cc4
Bump version to 0.23.2. (#937)
mzr1996 Jul 28, 2022
71ef7ba
Merge remote-tracking branch 'origin/dev'
mzr1996 Jul 28, 2022
90254a8
[Improve] Use `forward_dummy` to calculate FLOPS. (#953)
twmht Aug 8, 2022
982cab4
Update README
mzr1996 Sep 7, 2022
8d1bc55
[Docs] Fix typo for wrong reference. (#1036)
Crescent-Saturn Sep 16, 2022
a1b644b
[Doc] Fix typo in tutorial 2 (#1043)
Crescent-Saturn Sep 19, 2022
75ae845
[Docs] Fix a typo in ImageClassifier (#1050)
wangruohui Sep 22, 2022
6dce428
Merge branch 'mzr1996-multi-task' into multi-task
piercus Sep 22, 2022
49b91a7
Merge branch 'master' into multi-task
piercus Sep 23, 2022
4dc273a
Merge branch 'multi_task_head' into multi-task
piercus Sep 23, 2022
83df1e5
add mask to loss
marouaneamz Oct 7, 2022
2bbe5e2
add another pipeline
marouaneamz Oct 10, 2022
5ee0534
adpat the pipeline if there is no mask
marouaneamz Oct 12, 2022
b2c42fa
switch mask and task
marouaneamz Oct 17, 2022
8784684
Merge pull request #1 from marouaneamz/add_mask_loss
piercus Oct 18, 2022
7e24822
first version of multi data smaple
marouaneamz Oct 31, 2022
6c70927
fix problem with attribut by getattr
marouaneamz Oct 31, 2022
e362f22
rm img_label suffix, fix 'LabelData' object has no attribute 'gt_label'
piercus Nov 1, 2022
d274960
training without evaluation
marouaneamz Nov 2, 2022
67ff94a
first version work
marouaneamz Nov 3, 2022
b7063b2
add others metrics
marouaneamz Nov 4, 2022
b290d92
delete evaluation from dataset
marouaneamz Nov 4, 2022
cdf331d
fix linter
marouaneamz Nov 4, 2022
1cfbdf4
fix linter
marouaneamz Nov 4, 2022
b8b520f
multi metrics
marouaneamz Nov 7, 2022
4c6147c
first version of test
marouaneamz Nov 7, 2022
e46d482
change evaluate metric
marouaneamz Nov 7, 2022
9ad1b09
Merge branch 'my_multi_task_1_x' into issue2
marouaneamz Nov 7, 2022
9e8e683
Update tests/test_models/test_heads.py
marouaneamz Nov 8, 2022
ded2196
Update tests/test_models/test_heads.py
marouaneamz Nov 8, 2022
72c24e5
add tests
marouaneamz Nov 8, 2022
abeeb81
add test for multidatasample
marouaneamz Nov 8, 2022
d2d072f
create a generic test
marouaneamz Nov 8, 2022
518b6a4
create a generic test
marouaneamz Nov 8, 2022
a449690
create a generic test
marouaneamz Nov 8, 2022
2078392
change multi data sample
marouaneamz Nov 9, 2022
6264f1a
correct test
marouaneamz Nov 9, 2022
08aafd5
test
marouaneamz Nov 9, 2022
9f1396a
add new test
marouaneamz Nov 9, 2022
639d360
add test for dataset
marouaneamz Nov 9, 2022
aacd1bc
correct test
marouaneamz Nov 10, 2022
23433a4
correct test
marouaneamz Nov 10, 2022
2d13b23
correct test
marouaneamz Nov 10, 2022
b259dc3
correct test
marouaneamz Nov 10, 2022
d36ce6f
fix : #5
marouaneamz Nov 10, 2022
34df146
run yapf
marouaneamz Nov 10, 2022
1e9b836
fix linter
marouaneamz Nov 10, 2022
cb7921b
fix linter
marouaneamz Nov 10, 2022
2484669
fix linter
marouaneamz Nov 10, 2022
ad10eaf
fix isort
marouaneamz Nov 10, 2022
30b6bda
fix isort
marouaneamz Nov 10, 2022
502d9c5
fix docformmater
marouaneamz Nov 10, 2022
31e05a9
fix docformmater
marouaneamz Nov 10, 2022
9763a37
fix linter
marouaneamz Nov 10, 2022
982420a
fix linter
marouaneamz Nov 14, 2022
52901bb
fix data sample
marouaneamz Nov 14, 2022
aff44ff
Update mmcls/structures/multi_task_data_sample.py
marouaneamz Nov 14, 2022
93c9f6c
Update mmcls/structures/multi_task_data_sample.py
marouaneamz Nov 14, 2022
67aa7da
Update mmcls/structures/multi_task_data_sample.py
marouaneamz Nov 14, 2022
aacaf42
Update mmcls/structures/multi_task_data_sample.py
marouaneamz Nov 14, 2022
45f9258
Update mmcls/structures/multi_task_data_sample.py
marouaneamz Nov 14, 2022
4f07cf1
Update mmcls/structures/multi_task_data_sample.py
marouaneamz Nov 14, 2022
0b98eee
Update tests/test_structures/test_datasample.py
marouaneamz Nov 14, 2022
30683f6
Update mmcls/structures/multi_task_data_sample.py
marouaneamz Nov 14, 2022
b14f2ed
Update tests/test_structures/test_datasample.py
marouaneamz Nov 14, 2022
34f2fc6
Update tests/test_structures/test_datasample.py
marouaneamz Nov 14, 2022
1666db5
update data sample
marouaneamz Nov 14, 2022
0a9da7c
update head
marouaneamz Nov 14, 2022
8f4d930
update head
marouaneamz Nov 14, 2022
6024be6
update multi data sample
marouaneamz Nov 14, 2022
10d7841
fix linter
marouaneamz Nov 14, 2022
2c391fe
fix linter
marouaneamz Nov 14, 2022
49d399b
fix linter
marouaneamz Nov 14, 2022
d95a484
merge with my_multi
marouaneamz Nov 14, 2022
c184998
fix linter
marouaneamz Nov 14, 2022
8abe181
fix linter
marouaneamz Nov 14, 2022
f2bb527
fix linter
marouaneamz Nov 14, 2022
9956301
Merge branch 'my_multi_task_1_x' into issue5
marouaneamz Nov 14, 2022
e9dc751
Merge pull request #6 from marouaneamz/issue5
marouaneamz Nov 14, 2022
00a1f1e
merge with my_multi_task
marouaneamz Nov 14, 2022
2bdfafe
update head
marouaneamz Nov 14, 2022
e920ee2
fix problem we don't set pred or gt
marouaneamz Nov 14, 2022
cc839d3
fix problem we don't set pred or gt
marouaneamz Nov 14, 2022
583318a
fix problem we don't set pred or gt
marouaneamz Nov 14, 2022
61410b1
fix linter
marouaneamz Nov 14, 2022
8d02ac0
Merge pull request #9 from marouaneamz/setpredgt
marouaneamz Nov 14, 2022
80c23af
Merge branch 'my_multi_task_1_x' into issue2
marouaneamz Nov 14, 2022
de0428b
fix : #2
marouaneamz Nov 14, 2022
71ccf4b
fix : linter
marouaneamz Nov 14, 2022
fa275be
update multi head
marouaneamz Nov 16, 2022
1b48410
fix linter
marouaneamz Nov 16, 2022
b54199a
fix linter
marouaneamz Nov 16, 2022
5ece04f
update data sample
marouaneamz Nov 17, 2022
6b5034b
update data sample
marouaneamz Nov 17, 2022
6691901
fix ; linter
marouaneamz Nov 17, 2022
5e50e6a
Merge pull request #3 from marouaneamz/issue2
marouaneamz Nov 17, 2022
7215730
Merge branch 'my_multi_task_1_x' into issue7
marouaneamz Nov 17, 2022
8c0bbbf
update test
marouaneamz Nov 17, 2022
876fec8
test pipeline
marouaneamz Nov 17, 2022
01b480c
update pipeline
marouaneamz Nov 17, 2022
b656477
update test
marouaneamz Nov 17, 2022
0251f66
update dataset
marouaneamz Nov 18, 2022
deff8b8
update dataset
marouaneamz Nov 18, 2022
0689286
fix linter
marouaneamz Nov 18, 2022
f9d41f6
fix linter
marouaneamz Nov 18, 2022
3f13cca
Merge pull request #8 from marouaneamz/issue7
marouaneamz Nov 18, 2022
0577dd8
Merge branch 'my_multi_task_1_x' into pipeline
marouaneamz Nov 18, 2022
7cdc6a4
update formatting
marouaneamz Nov 18, 2022
1523355
add test for multi-task-eval
marouaneamz Nov 18, 2022
7eb6fe4
update formatting
marouaneamz Nov 18, 2022
9407214
fix linter
marouaneamz Nov 18, 2022
3a03842
update test
marouaneamz Nov 18, 2022
1148709
update
marouaneamz Nov 21, 2022
13a3d9c
Merge pull request #10 from marouaneamz/pipeline
marouaneamz Nov 21, 2022
2a45cad
Merge branch 'my_multi_task_1_x' into metrics
marouaneamz Nov 22, 2022
936f6d7
add test
marouaneamz Nov 23, 2022
5854322
update metrics
marouaneamz Nov 23, 2022
ce11749
update metrics
marouaneamz Nov 23, 2022
9aa6785
add doc for functions
marouaneamz Nov 23, 2022
6ad02d9
fix linter
marouaneamz Nov 23, 2022
7ee882f
training for multitask 1.x
marouaneamz Nov 23, 2022
7ea5765
fix linter
marouaneamz Nov 23, 2022
04bc7a9
run flake8
marouaneamz Nov 24, 2022
581bd82
run linter
marouaneamz Nov 24, 2022
522135d
update test
marouaneamz Nov 24, 2022
5d26026
add mask in evaluation
marouaneamz Nov 24, 2022
77e180e
update metric doc
marouaneamz Nov 24, 2022
d3d9c2f
update metric doc
marouaneamz Nov 25, 2022
b15105b
Update mmcls/evaluation/metrics/multi_task.py
marouaneamz Nov 25, 2022
59aed15
Update mmcls/evaluation/metrics/multi_task.py
marouaneamz Nov 25, 2022
3ee49df
Update mmcls/evaluation/metrics/multi_task.py
marouaneamz Nov 25, 2022
d071eab
Update mmcls/evaluation/metrics/multi_task.py
marouaneamz Nov 25, 2022
6f735e7
Update mmcls/evaluation/metrics/multi_task.py
marouaneamz Nov 25, 2022
0c90c00
Update mmcls/evaluation/metrics/multi_task.py
marouaneamz Nov 25, 2022
360b864
update metric doc
marouaneamz Nov 25, 2022
54b4108
update metric doc
marouaneamz Nov 25, 2022
d860e4a
Merge pull request #11 from marouaneamz/metrics
marouaneamz Nov 25, 2022
23a5382
Merge branch 'multi-task' into marouaneamz/my_multi_task_1_x
piercus Nov 25, 2022
f472453
Merge branch 'multi-task' of github.com:piercus/mmclassification into…
piercus Nov 25, 2022
15fb9b0
merge with 1.x
piercus Nov 25, 2022
404d15d
Fix cannot import name MultiTaskDataSample
marouaneamz Nov 28, 2022
25049e7
Merge pull request #3 from marouaneamz/my_multi_task_1_x
piercus Nov 28, 2022
e5af45f
fix test_datasets
marouaneamz Nov 28, 2022
f5014f4
fix test_datasets
marouaneamz Nov 28, 2022
fa05028
Merge pull request #4 from marouaneamz/my_multi_task_1_x
piercus Nov 28, 2022
2a80c2a
fix linter
marouaneamz Nov 29, 2022
798fc9a
add an example of multitask
marouaneamz Nov 29, 2022
c67408f
Merge branch 'my_multi_task_1_x' of github.com:marouaneamz/mmclassifi…
marouaneamz Nov 29, 2022
c6552e3
change name of configs dataset
marouaneamz Nov 29, 2022
87d78fd
Merge pull request #5 from marouaneamz/my_multi_task_1_x
piercus Nov 29, 2022
73473b0
Refactor the multi-task support
mzr1996 Dec 1, 2022
99969d1
correct test and metric
marouaneamz Dec 2, 2022
c742154
add test to multidatasample
marouaneamz Dec 5, 2022
1f7cfad
add test to multidatasample
marouaneamz Dec 5, 2022
70be3ae
correct test
marouaneamz Dec 5, 2022
ecdfb87
correct metrics and clshead
marouaneamz Dec 6, 2022
3dc8324
Update mmcls/models/heads/cls_head.py
marouaneamz Dec 6, 2022
3fe628e
Merge pull request #7 from marouaneamz/multi_task_mzr
piercus Dec 6, 2022
ad9f2ec
Merge branch '1.x' into multi-task
piercus Dec 6, 2022
81b605b
update cls_head.py documentation
piercus Dec 6, 2022
b5890d9
lint
piercus Dec 6, 2022
7c07ea2
lint
piercus Dec 6, 2022
7983caf
fix: lint
piercus Dec 6, 2022
0ac2f5c
fix linter
marouaneamz Dec 9, 2022
3d10f95
Merge branch 'multi_task_mzr' of github.com:marouaneamz/mmclassificat…
marouaneamz Dec 9, 2022
c3654d3
add eval mask
marouaneamz Dec 9, 2022
e6ad209
Merge remote-tracking branch 'pier_multi/multi-task' into multi_task_mzr
marouaneamz Dec 9, 2022
da32c23
fix documentation
marouaneamz Dec 9, 2022
deb3bf4
Merge pull request #8 from marouaneamz/multi_task_mzr
piercus Dec 9, 2022
0a655d8
fix: single_label.py back to 1.x
piercus Dec 9, 2022
172952c
Update mmcls/models/heads/multi_task_head.py
piercus Dec 16, 2022
83c8cb7
Remove multi-task configs.
mzr1996 Dec 30, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
61 changes: 61 additions & 0 deletions configs/_base_/datasets/multi_task_medic_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# dataset settings
dataset_type = 'MultiTaskDataset'
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='Resize', scale=(256, 200), backend='pillow'),
dict(type='CenterCrop', crop_size=224),
dict(type='PackMultiTaskInputs'),
]
test_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='Resize', scale=(256, 200), backend='pillow'),
dict(type='CenterCrop', crop_size=224),
dict(type='PackMultiTaskInputs')
]

train_dataloader = dict(
batch_size=16,
num_workers=16,
dataset=dict(
type=dataset_type,
ann_file='data/MEDIC_train.json',
data_root='../dataset',
pipeline=train_pipeline),
sampler=dict(type='DefaultSampler', shuffle=True),
persistent_workers=True,
)

val_dataloader = dict(
batch_size=16,
num_workers=16,
dataset=dict(
type=dataset_type,
ann_file='data/MEDIC_test.json',
data_root='../dataset',
pipeline=test_pipeline),
sampler=dict(type='DefaultSampler', shuffle=True),
persistent_workers=True,
)
test_dataloader = dict(
batch_size=16,
num_workers=16,
dataset=dict(
type=dataset_type,
ann_file='data/MEDIC_test.json',
data_root='../dataset',
pipeline=test_pipeline),
sampler=dict(type='DefaultSampler', shuffle=True),
persistent_workers=True,
)

val_evaluator = dict(
type='MultiTasksMetric',
task_metrics={
'damage_severity': [dict(type='Accuracy', topk=(1, ))],
'informative': [dict(type='Accuracy', topk=(1, ))],
'disaster_types': [dict(type='Accuracy', topk=(1, ))],
'humanitarian': [dict(type='Accuracy', topk=(1, ))]
})

test_dataloader = val_dataloader
test_evaluator = val_evaluator
23 changes: 23 additions & 0 deletions configs/_base_/models/mobilenet_v2_1x_multitask.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# model settings
model = dict(
type='ImageClassifier',
backbone=dict(
type='MobileNetV2',
widen_factor=1.0,
init_cfg=dict(
type='Pretrained',
checkpoint='https://download.openmmlab.com/mmclassification/v0/mobi\
lenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth',
prefix='backbone')),
neck=dict(type='GlobalAveragePooling'),
head=dict(
type='MultiTaskHead',
task_heads={
'damage_severity': dict(type='LinearClsHead', num_classes=3),
'informative': dict(type='LinearClsHead', num_classes=2),
'humanitarian': dict(type='LinearClsHead', num_classes=4),
'disaster_types': dict(type='LinearClsHead', num_classes=7)
},
in_channels=1280,
loss=dict(type='CrossEntropyLoss', loss_weight=1.0),
))
6 changes: 6 additions & 0 deletions configs/mobilenet_v2/mobilenet_multi_task.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
_base_ = [
'../_base_/datasets/multi_task_medic_data.py',
'../_base_/models/mobilenet_v2_1x_multitask.py',
'../_base_/schedules/imagenet_bs256_epochstep.py',
'../_base_/default_runtime.py'
]
3 changes: 2 additions & 1 deletion mmcls/datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
from .imagenet import ImageNet, ImageNet21k
from .mnist import MNIST, FashionMNIST
from .multi_label import MultiLabelDataset
from .multi_task import MultiTaskDataset
from .samplers import * # noqa: F401,F403
from .transforms import * # noqa: F401,F403
from .voc import VOC

__all__ = [
'BaseDataset', 'ImageNet', 'CIFAR10', 'CIFAR100', 'MNIST', 'FashionMNIST',
'VOC', 'build_dataset', 'ImageNet21k', 'KFoldDataset', 'CUB',
'CustomDataset', 'MultiLabelDataset'
'CustomDataset', 'MultiLabelDataset', 'MultiTaskDataset'
]