Skip to content

Commit

Permalink
[Docs] Replace markdownlint with mdformat (#163)
Browse files Browse the repository at this point in the history
* markdonwlint -> mdformat

* update mmcv min and max version

* fix README_zh-CN links
  • Loading branch information
pppppM authored May 31, 2022
1 parent 2dad240 commit b8daedf
Show file tree
Hide file tree
Showing 25 changed files with 635 additions and 604 deletions.
19 changes: 12 additions & 7 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,42 @@
---
name: Bug report
about: Create a report to help us improve
title: "[Bug]"
title: '[Bug]'
labels: bug
assignees: ''

---

### Describe the bug

A clear and concise description of what the bug is.

[here]
\[here\]

### To Reproduce

The command you executed.

```shell
[here]
```

### Post related information

1. The output of `pip list | grep "mmcv\|mmrazor\|^torch"`
[here]
\[here\]
2. Your config file if you modified it or created a new one.

```python
[here]
```

3. Your train log file if you meet the problem during training.
[here]
\[here\]
4. Other code you modified in the `mmrazor` folder.
[here]
\[here\]

### Additional context

Add any other context about the problem here.

[here]
\[here\]
18 changes: 10 additions & 8 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
---
name: Feature request
about: Suggest an idea for this project
title: "[Feature]"
title: '[Feature]'
labels: enhancement
assignees: ''

---

### Describe the feature

[here]
\[here\]

### Motivation

A clear and concise description of the motivation of the feature.
Ex1. It is inconvenient when [....].
Ex2. There is a recent paper [....], which is very helpful for [....].
Ex1. It is inconvenient when \[....\].
Ex2. There is a recent paper \[....\], which is very helpful for \[....\].

[here]
\[here\]

### Related resources

If there is an official code release or third-party implementation, please also provide the information here, which would be very helpful.

[here]
\[here\]

### Additional context

Add any other context or screenshots about the feature request here.
If you would like to implement the feature and create a PR, please leave a comment here and that would be much appreciated.

[here]
\[here\]
13 changes: 8 additions & 5 deletions .github/ISSUE_TEMPLATE/general-questions.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,28 @@ about: 'Ask general questions to get help '
title: ''
labels: help wanted
assignees: ''

---

### Checklist

- I have searched related issues but cannot get the expected help.
- I have read related documents and don't know what to do.

### Describe the question you meet

[here]
\[here\]

### Post related information

1. The output of `pip list | grep "mmcv\|mmrazor\|^torch"`
[here]
\[here\]
2. Your config file if you modified it or created a new one.

```python
[here]
```

3. Your train log file if you meet the problem during training.
[here]
\[here\]
4. Other code you modified in the `mmrazor` folder.
[here]
\[here\]
21 changes: 12 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
exclude: ^tests/data/
repos:
- repo: https://gitlab.com/pycqa/flake8.git
rev: 3.8.3
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
- repo: https://github.com/PyCQA/isort
- repo: https://github.com/timothycrosley/isort
rev: 5.10.1
hooks:
- id: isort
Expand All @@ -25,12 +25,6 @@ repos:
args: ["--remove"]
- id: mixed-line-ending
args: ["--fix=lf"]
- repo: https://github.com/markdownlint/markdownlint
rev: v0.11.0
hooks:
- id: markdownlint
args: ["-r", "~MD002,~MD013,~MD029,~MD033,~MD034",
"-t", "allow_different_nesting"]
- repo: https://github.com/codespell-project/codespell
rev: v2.1.0
hooks:
Expand All @@ -40,6 +34,15 @@ repos:
hooks:
- id: docformatter
args: ["--in-place", "--wrap-descriptions", "79"]
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.14
hooks:
- id: mdformat
args: ["--number"]
additional_dependencies:
- mdformat-gfm
- mdformat_frontmatter
- linkify-it-py
- repo: https://github.com/open-mmlab/pre-commit-hooks
rev: v0.2.0
hooks:
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ MMRazor is a model compression toolkit for model slimming and AutoML, which incl
It is a part of the [OpenMMLab](https://openmmlab.com/) project.

Major features:

- **Compatibility**

MMRazor can be easily applied to various projects in OpenMMLab, due to the similar architecture design of OpenMMLab as well as the decoupling of slimming algorithms and vision tasks.
Expand All @@ -58,6 +59,7 @@ Major features:
With better modular design, developers can implement new model compression algorithms with only a few codes, or even by simply modifying config files.

Below is an overview of MMRazor's design and implementation, please refer to [tutorials](/docs/en/tutorials/Tutorial_1_overview.md) for more details.

<div align="center">
<img src="resources/design_and_implement.png" style="zoom:100%"/>
</div>
Expand Down Expand Up @@ -92,6 +94,7 @@ pip install -v -e . # or "python setup.py develop"
```

## Getting Started

Please refer to [train.md](/docs/en/train.md) and [test.md](/docs/en/test.md) for the basic usage of MMRazor. There are also tutorials:

- [overview](/docs/en/tutorials/Tutorial_1_overview.md)
Expand Down
30 changes: 14 additions & 16 deletions README_zh-CN.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div align="center">
<img src="resources/mmrazor-logo.png" width="600"/>
<img src="./resources/mmrazor-logo.png" width="600"/>
<div>&nbsp;</div>
<div align="center">
<b><font size="5">OpenMMLab 官网</font></b>
Expand Down Expand Up @@ -44,7 +44,6 @@ MMRazor是一个可用于模型瘦身和AutoML的模型压缩工具箱,包含

MMRazor是[OpenMMLab](https://openmmlab.com/)项目的一部分。


主要特性

- **兼容性**
Expand All @@ -59,8 +58,8 @@ MMRazor是[OpenMMLab](https://openmmlab.com/)项目的一部分。

得益于更好的模块化设计,开发者仅用修改少量代码,甚至只用修改配置文件即可实现新的轻量化算法。


下面是MMRazor设计和实现的概括图, 如果想了解更多的细节,请参考 [tutorials](/docs/en/tutorials/Tutorial_1_overview.md)

<div align="center">
<img src="resources/design_and_implement.png" style="zoom:100%"/>
</div>
Expand All @@ -76,30 +75,27 @@ v0.1.0 版本已经在 2021.12.23 发布

## 基准测试和模型库

测试结果可以在 [模型库](/docs/en/model_zoo.md) 中找到.
测试结果可以在 [模型库](docs/en/model_zoo.md) 中找到.

已经支持的算法:

- <details open><summary>Neural Architecture Search</summary>
Neural Architecture Search

- [x] [DARTS(ICLR'2019)](/configs/nas/darts)
- [x] [DARTS(ICLR'2019)](configs/nas/darts)

- [x] [DetNAS(NeurIPS'2019)](/configs/nas/detnas)
- [x] [DetNAS(NeurIPS'2019)](configs/nas/detnas)

- [x] [SPOS(ECCV'2020)](/configs/nas/spos)
</details>
- [x] [SPOS(ECCV'2020)](configs/nas/spos)

- <details open><summary>Pruning</summary>
Pruning

- [x] [AutoSlim(NeurIPS'2019)](/configs/pruning/autoslim)
</details>
- [x] [AutoSlim(NeurIPS'2019)](/configs/pruning/autoslim)

- <details open><summary>Knowledge Distillation</summary>
Knowledge Distillation

- [x] [CWD(ICCV'2021)](/configs/distill/cwd)
- [x] [CWD(ICCV'2021)](/configs/distill/cwd)

- [x] [WSLD(ICLR'2021)](/configs/distill/wsld)
</details>
- [x] [WSLD(ICLR'2021)](/configs/distill/wsld)

## 安装

Expand All @@ -117,6 +113,7 @@ pip install -v -e . # or "python setup.py develop"
```

## 快速入门

请参考 [get_started.md](/docs/en/get_started.md) 学习 MMRazor 的基本使用。 我们也提供了一些进阶教程:

- [overview](/docs/en/tutorials/Tutorial_1_overview.md)
Expand Down Expand Up @@ -171,6 +168,7 @@ MMRazor 是一款由来自不同高校和企业的研发人员共同参与贡献
- [MMEditing](https://github.com/open-mmlab/mmediting): OpenMMLab 图像视频编辑工具箱
- [MMGeneration](https://github.com/open-mmlab/mmgeneration): OpenMMLab 图片视频生成模型工具箱
- [MMDeploy](https://github.com/open-mmlab/mmdeploy): OpenMMLab 模型部署框架

## 欢迎加入 OpenMMLab 社区

扫描下方的二维码可关注 OpenMMLab 团队的 [知乎官方账号](https://www.zhihu.com/people/openmmlab),加入 OpenMMLab 团队的 [官方交流 QQ 群](https://jq.qq.com/?_wv=1027&k=aCvMxdr3)
Expand Down
19 changes: 10 additions & 9 deletions configs/distill/cwd/README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
# CWD

> [Channel-wise Knowledge Distillation for Dense Prediction](https://arxiv.org/abs/2011.13256)
<!-- [ALGORITHM] -->

## Abstract

Knowledge distillation (KD) has been proven to be a simple and effective tool for training compact models. Almost all KD variants for dense prediction tasks align the student and teacher networks' feature maps in the spatial domain, typically by minimizing point-wise and/or pair-wise discrepancy. Observing that in semantic segmentation, some layers' feature activations of each channel tend to encode saliency of scene categories (analogue to class activation mapping), we propose to align features channel-wise between the student and teacher networks. To this end, we first transform the feature map of each channel into a probability map using softmax normalization, and then minimize the Kullback-Leibler (KL) divergence of the corresponding channels of the two networks. By doing so, our method focuses on mimicking the soft distributions of channels between networks. In particular, the KL divergence enables learning to pay more attention to the most salient regions of the channel-wise maps, presumably corresponding to the most useful signals for semantic segmentation. Experiments demonstrate that our channel-wise distillation outperforms almost all existing spatial distillation methods for semantic segmentation considerably, and requires less computational cost during training. We consistently achieve superior performance on three benchmarks with various network structures.


![pipeline](/docs/en/imgs/model_zoo/cwd/pipeline.png)



## Results and models

### Segmentation
|Location|Dataset|Teacher|Student|mIoU|mIoU(T)|mIou(S)|Config | Download |
:--------:|:---------:|:---------:|:---------:|:---------:|:---------:|:---------:|:------:|:---------|
| logits |cityscapes|[pspnet_r101](https://github.com/open-mmlab/mmsegmentation/blob/master/configs/pspnet/pspnet_r101-d8_512x1024_80k_cityscapes.py)|[pspnet_r18](https://github.com/open-mmlab/mmsegmentation/blob/master/configs/pspnet/pspnet_r18-d8_512x1024_80k_cityscapes.py)| 75.54 | 79.76 | 74.87 |[config]()|[teacher](https://download.openmmlab.com/mmsegmentation/v0.5/pspnet/pspnet_r101-d8_512x1024_80k_cityscapes/pspnet_r101-d8_512x1024_80k_cityscapes_20200606_112211-e1e1100f.pth) &#124;[model](https://download.openmmlab.com/mmrazor/v0.1/distill/cwd/cwd_cls_head_pspnet_r101_d8_pspnet_r18_d8_512x1024_cityscapes_80k/cwd_cls_head_pspnet_r101_d8_pspnet_r18_d8_512x1024_cityscapes_80k_mIoU-75.54_20211222-3a26ee1c.pth) &#124; [log](https://download.openmmlab.com/mmrazor/v0.1/distill/cwd/cwd_cls_head_pspnet_r101_d8_pspnet_r18_d8_512x1024_cityscapes_80k/cwd_cls_head_pspnet_r101_d8_pspnet_r18_d8_512x1024_cityscapes_80k_20211212_205711.log.json?)|

| Location | Dataset | Teacher | Student | mIoU | mIoU(T) | mIou(S) | Config | Download |
| :------: | :--------: | :------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------: | :---: | :-----: | :-----: | :----------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| logits | cityscapes | [pspnet_r101](https://github.com/open-mmlab/mmsegmentation/blob/master/configs/pspnet/pspnet_r101-d8_512x1024_80k_cityscapes.py) | [pspnet_r18](https://github.com/open-mmlab/mmsegmentation/blob/master/configs/pspnet/pspnet_r18-d8_512x1024_80k_cityscapes.py) | 75.54 | 79.76 | 74.87 | [config](<>) | [teacher](https://download.openmmlab.com/mmsegmentation/v0.5/pspnet/pspnet_r101-d8_512x1024_80k_cityscapes/pspnet_r101-d8_512x1024_80k_cityscapes_20200606_112211-e1e1100f.pth) \|[model](https://download.openmmlab.com/mmrazor/v0.1/distill/cwd/cwd_cls_head_pspnet_r101_d8_pspnet_r18_d8_512x1024_cityscapes_80k/cwd_cls_head_pspnet_r101_d8_pspnet_r18_d8_512x1024_cityscapes_80k_mIoU-75.54_20211222-3a26ee1c.pth) \| [log](https://download.openmmlab.com/mmrazor/v0.1/distill/cwd/cwd_cls_head_pspnet_r101_d8_pspnet_r18_d8_512x1024_cityscapes_80k/cwd_cls_head_pspnet_r101_d8_pspnet_r18_d8_512x1024_cityscapes_80k_20211212_205711.log.json?) |

### Detection
|Location|Dataset|Teacher|Student|mAP|mAP(T)|mAP(S)|Config | Download |
:--------:|:---------:|:---------:|:---------:|:---------:|:---------:|:---------:|:------:|:---------|
| cls head |COCO|[gfl_r101_2x](https://github.com/open-mmlab/mmdetection/tree/master/configs/gfl/gfl_r101_fpn_mstrain_2x_coco.py)|[gfl_r50_1x](https://github.com/open-mmlab/mmdetection/tree/master/configs/gfl/gfl_r50_fpn_1x_coco.py)| 41.9 | 44.7 | 40.2 |[config]()|[teacher](https://download.openmmlab.com/mmdetection/v2.0/gfl/gfl_r101_fpn_mstrain_2x_coco/gfl_r101_fpn_mstrain_2x_coco_20200629_200126-dd12f847.pth) &#124;[model](https://download.openmmlab.com/mmrazor/v0.1/distill/cwd/cwd_cls_head_gfl_r101_fpn_gfl_r50_fpn_1x_coco/cwd_cls_head_gfl_r101_fpn_gfl_r50_fpn_1x_coco_20211222-655dff39.pth) &#124; [log](https://download.openmmlab.com/mmrazor/v0.1/distill/cwd/cwd_cls_head_gfl_r101_fpn_gfl_r50_fpn_1x_coco/cwd_cls_head_gfl_r101_fpn_gfl_r50_fpn_1x_coco_20211212_205444.log.json)|

| Location | Dataset | Teacher | Student | mAP | mAP(T) | mAP(S) | Config | Download |
| :------: | :-----: | :--------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------: | :--: | :----: | :----: | :----------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| cls head | COCO | [gfl_r101_2x](https://github.com/open-mmlab/mmdetection/tree/master/configs/gfl/gfl_r101_fpn_mstrain_2x_coco.py) | [gfl_r50_1x](https://github.com/open-mmlab/mmdetection/tree/master/configs/gfl/gfl_r50_fpn_1x_coco.py) | 41.9 | 44.7 | 40.2 | [config](<>) | [teacher](https://download.openmmlab.com/mmdetection/v2.0/gfl/gfl_r101_fpn_mstrain_2x_coco/gfl_r101_fpn_mstrain_2x_coco_20200629_200126-dd12f847.pth) \|[model](https://download.openmmlab.com/mmrazor/v0.1/distill/cwd/cwd_cls_head_gfl_r101_fpn_gfl_r50_fpn_1x_coco/cwd_cls_head_gfl_r101_fpn_gfl_r50_fpn_1x_coco_20211222-655dff39.pth) \| [log](https://download.openmmlab.com/mmrazor/v0.1/distill/cwd/cwd_cls_head_gfl_r101_fpn_gfl_r50_fpn_1x_coco/cwd_cls_head_gfl_r101_fpn_gfl_r50_fpn_1x_coco_20211212_205444.log.json) |

## Citation

Expand Down
Loading

0 comments on commit b8daedf

Please sign in to comment.