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] 多分类任务训练All-In-One #1736

Open
1 task done
bobo0810 opened this issue Aug 1, 2023 · 6 comments
Open
1 task done

[Feature] 多分类任务训练All-In-One #1736

bobo0810 opened this issue Aug 1, 2023 · 6 comments

Comments

@bobo0810
Copy link
Contributor

bobo0810 commented Aug 1, 2023

Describe the feature

描述这个功能

#481 不同,当前各分类任务之间独立,旨在通过一个通用强大的"单模型+多个分类头" 替代多个分类模型,实现All In One。

方案

例如:训练时给定4个分类任务,从各个任务中采样一些数据组成一个 batch,将该 batch 输入给共享的backbone,最后分出 4 个head,每个head负责一个任务的输出。4 个任务分别计算损失后求和作为总的损失。

动机

当前针对各个分类任务分别训练分类模型,线上推理成本与日俱增。通过多个分类任务的数据训练一个功能强大的通用模型,可直接处理多个分类任务,减少推理成本。

参考

Will you implement it?

  • I would like to implement this feature and create a PR!
@mm-assistant
Copy link

mm-assistant bot commented Aug 1, 2023

We recommend using English or English & Chinese for issues so that we could have broader discussion.

@bobo0810 bobo0810 changed the title [Feature] 多任务训练All-In-One [Feature] 多分类任务训练All-In-One Aug 1, 2023
@bobo0810
Copy link
Contributor Author

bobo0810 commented Aug 1, 2023

虽然多标签分类亦能解决该问题,但标注成本过高。还是多个haed负责不同子任务 成本更低、更清晰明了 。

@Ezra-Yu
Copy link
Collaborator

Ezra-Yu commented Aug 1, 2023

目前的multi-task head 应该可以解决这个需求,但是没有相关数据集以及配置文件。

@bobo0810
Copy link
Contributor Author

bobo0810 commented Aug 1, 2023

训练流程
image

@bobo0810
Copy link
Contributor Author

bobo0810 commented Aug 1, 2023

目前的multi-task head 应该可以解决这个需求,但是没有相关数据集以及配置文件。

@Ezra-Yu 非常感谢关注
假设数据集1是CIFAR、数据集2是MNIST,跑通整个链路。
我对实现该特性非常感兴趣,但是对整体结构和pipeline不熟悉。非常期待大佬们指导~

@Ezra-Yu
Copy link
Collaborator

Ezra-Yu commented Aug 1, 2023

假设数据集1是CIFAR、数据集2是MNIST,跑通整个链路。

这两个数据集的图片大小不一致,不容易组batch。硬要组的话,需要resize到相同大小。

我对实现该特性非常感兴趣,但是对整体结构和pipeline不熟悉。非常期待大佬们指导~

我们之前使用VOC数据集做多分类和检测任务,是可以训练,但没做下去,只是验证了可行性。

image
我觉得同一批数据,它同时做两个任务,也就红框部分的数据集同时有两种标注,可能更好。

当然,你说的,可能更适合说我用这个方法获取一个更完备的视觉预训练模型
可以关注PackMultiTaskInputsMultiTaskDataSample, MultiTaskHead 这几个类。
我们目前没有精力去完成这样demo以及实验,不过可以帮你和多任务PR的作者联系,他目前仍然做这方面的研究,他会很开心的与你沟通。

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

No branches or pull requests

2 participants