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

Any plans to support anchor distillation #17

Closed
yarkable opened this issue Dec 24, 2021 · 3 comments
Closed

Any plans to support anchor distillation #17

yarkable opened this issue Dec 24, 2021 · 3 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@yarkable
Copy link

Describe the feature

Distill the anchor distribution.

Motivation

Not only distill nn.Module features, but also detection results, e.g., scores of positive and negative anchors.

Ex1. AAAI 2022 Anchor Distillation

@yarkable yarkable added the enhancement New feature or request label Dec 24, 2021
@pppppM pppppM added the good first issue Good for newcomers label Dec 25, 2021
@pppppM
Copy link
Collaborator

pppppM commented Dec 25, 2021

Hi, @yarkable , this is a good issue.
In mmrazor, you can not only add hooks to nn.Module, but also add hooks to ordinary python functions. Adding hooks to ordinary python functions is achieved through a context manager, which can be found in BaseDistiller.

There is an example to align the student's _preprocess to teacher in YOLOX.
You can modify align_methods according to your needs, such as aligning the result of label assign or the output of other python function.

distiller=dict(
    type='SingleTeacherDistiller',
    teacher=teacher,
    teacher_trainable=False,
    align_methods=[
        dict(method='YOLOX._preprocess', import_module='mmdet.models')
    ],
    components=[
        ...
    ]
)

@pppppM
Copy link
Collaborator

pppppM commented Dec 25, 2021

Because the paper seems not to release code, I'm unsure if this context manager can fully meet your needs.
If you are interested in reproducing this paper, welcome to make a PR, and we can improve the context manager together. @yarkable

@yarkable
Copy link
Author

OK, thanks for your reply. I'll check it.

@pppppM pppppM closed this as completed Jan 13, 2022
pppppM pushed a commit to pppppM/mmrazor that referenced this issue Jul 15, 2022
Co-authored-by: caoweihan <caoweihan@sensetime.com>
pppppM added a commit to pppppM/mmrazor that referenced this issue Jul 15, 2022
* Base Framework (open-mmlab#24)

* Base Framework

* [Feature] Add loss

* [Feature] Add op (open-mmlab#4)

* [Feature] Add mutator (open-mmlab#3)

* [Feature] Add mutable (open-mmlab#2)

* [Feature] Add architecture (open-mmlab#1)

* [Docs] Add Docs (open-mmlab#6)

* add docs

* fix known_third_party

Co-authored-by: qiufeng <qiufeng3217@gmail.com>

* update docs (open-mmlab#12)

Co-authored-by: qiufeng <qiufeng3217@gmail.com>

* [Docs] Add README (open-mmlab#10)

* add readme

* refactor readme

* add logo

* update release time

Co-authored-by: qiufeng <qiufeng3217@gmail.com>

* [Docs] Add Resources (open-mmlab#11)

* add resources

* fix known_third_party

* fix known_third_party

* fix known_third_party

* refactor resources

Co-authored-by: qiufeng <qiufeng3217@gmail.com>

* add pytest (open-mmlab#18)

Co-authored-by: caoweihan <caoweihan@sensetime.com>

* add utils (open-mmlab#17)

Co-authored-by: caoweihan <caoweihan@sensetime.com>

* add distillers (open-mmlab#16)

Co-authored-by: caoweihan <caoweihan@sensetime.com>

* add pruners (open-mmlab#15)

Co-authored-by: caoweihan <caoweihan@sensetime.com>

* fix bug

* update docstring (open-mmlab#20)

* Prepare for open source (open-mmlab#23)

* update MMRazor description

* update Github action

* add Mircosoft copyright

* update requirements

* fix  a bug

* fix a typo

Co-authored-by: humu789 <humu@pjlab.org.cn>
Co-authored-by: humu789 <88702197+humu789@users.noreply.github.com>
Co-authored-by: qiufeng <44188071+wutongshenqiu@users.noreply.github.com>
Co-authored-by: qiufeng <qiufeng3217@gmail.com>
Co-authored-by: whcao <41630003+HIT-cwh@users.noreply.github.com>
Co-authored-by: caoweihan <caoweihan@sensetime.com>

* fix readme and pre-commit

* rename tutorials

* fix a bug

* pass lint

Co-authored-by: pppppM <67539920+pppppM@users.noreply.github.com>
Co-authored-by: humu789 <humu@pjlab.org.cn>
Co-authored-by: humu789 <88702197+humu789@users.noreply.github.com>
Co-authored-by: qiufeng <44188071+wutongshenqiu@users.noreply.github.com>
Co-authored-by: qiufeng <qiufeng3217@gmail.com>
Co-authored-by: caoweihan <caoweihan@sensetime.com>
pppppM added a commit to pppppM/mmrazor that referenced this issue Jul 15, 2022
* Base Framework (open-mmlab#24)

* Base Framework

* [Feature] Add loss

* [Feature] Add op (open-mmlab#4)

* [Feature] Add mutator (open-mmlab#3)

* [Feature] Add mutable (open-mmlab#2)

* [Feature] Add architecture (open-mmlab#1)

* [Docs] Add Docs (open-mmlab#6)

* add docs

* fix known_third_party

Co-authored-by: qiufeng <qiufeng3217@gmail.com>

* update docs (open-mmlab#12)

Co-authored-by: qiufeng <qiufeng3217@gmail.com>

* [Docs] Add README (open-mmlab#10)

* add readme

* refactor readme

* add logo

* update release time

Co-authored-by: qiufeng <qiufeng3217@gmail.com>

* [Docs] Add Resources (open-mmlab#11)

* add resources

* fix known_third_party

* fix known_third_party

* fix known_third_party

* refactor resources

Co-authored-by: qiufeng <qiufeng3217@gmail.com>

* add pytest (open-mmlab#18)

Co-authored-by: caoweihan <caoweihan@sensetime.com>

* add utils (open-mmlab#17)

Co-authored-by: caoweihan <caoweihan@sensetime.com>

* add distillers (open-mmlab#16)

Co-authored-by: caoweihan <caoweihan@sensetime.com>

* add pruners (open-mmlab#15)

Co-authored-by: caoweihan <caoweihan@sensetime.com>

* fix bug

* update docstring (open-mmlab#20)

* Prepare for open source (open-mmlab#23)

* update MMRazor description

* update Github action

* add Mircosoft copyright

* update requirements

* fix  a bug

* fix a typo

Co-authored-by: humu789 <humu@pjlab.org.cn>
Co-authored-by: humu789 <88702197+humu789@users.noreply.github.com>
Co-authored-by: qiufeng <44188071+wutongshenqiu@users.noreply.github.com>
Co-authored-by: qiufeng <qiufeng3217@gmail.com>
Co-authored-by: whcao <41630003+HIT-cwh@users.noreply.github.com>
Co-authored-by: caoweihan <caoweihan@sensetime.com>

* fix readme and pre-commit

* rename tutorials

* fix a bug

* pass lint

Co-authored-by: pppppM <67539920+pppppM@users.noreply.github.com>
Co-authored-by: humu789 <humu@pjlab.org.cn>
Co-authored-by: humu789 <88702197+humu789@users.noreply.github.com>
Co-authored-by: qiufeng <44188071+wutongshenqiu@users.noreply.github.com>
Co-authored-by: qiufeng <qiufeng3217@gmail.com>
Co-authored-by: caoweihan <caoweihan@sensetime.com>
humu789 pushed a commit to humu789/mmrazor that referenced this issue Feb 13, 2023
* prepare for split

* mark multiclass nms

* redesign mark decorator to handle input/output names better (open-mmlab#17)

* redesign mark decorator to handle input/output names better

* fixed a bug in rename_value; robustify extract_model

* fix lint

* fix log in deploy pipeline

* fix onnxruntime config

* fix lint

* update connect init

* rename is_inspecting

* simplify function_mark

Co-authored-by: Li Zhang <lzhang329@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants