Skip to content

Commit 51ad7cb

Browse files
authored
Fix ResourceWarning in Wandb and Update README.md (#8103)
* add hint in wandb * update readme * update readme * update hint of wandb
1 parent 44af55f commit 51ad7cb

File tree

3 files changed

+129
-64
lines changed

3 files changed

+129
-64
lines changed

README.md

Lines changed: 52 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
<img src="resources/mmdet-logo.png" width="600"/>
33
<div>&nbsp;</div>
44
<div align="center">
5-
<b>OpenMMLab website</b>
5+
<b><font size="5">OpenMMLab website</font></b>
66
<sup>
77
<a href="https://openmmlab.com">
8-
<i>HOT</i>
8+
<i><font size="4">HOT</font></i>
99
</a>
1010
</sup>
1111
&nbsp;&nbsp;&nbsp;&nbsp;
12-
<b>OpenMMLab platform</b>
12+
<b><font size="5">OpenMMLab platform</font></b>
1313
<sup>
1414
<a href="https://platform.openmmlab.com">
15-
<i>TRY IT OUT</i>
15+
<i><font size="4">TRY IT OUT</font></i>
1616
</a>
1717
</sup>
1818
</div>
@@ -24,27 +24,32 @@
2424
[![codecov](https://codecov.io/gh/open-mmlab/mmdetection/branch/master/graph/badge.svg)](https://codecov.io/gh/open-mmlab/mmdetection)
2525
[![license](https://img.shields.io/github/license/open-mmlab/mmdetection.svg)](https://github.com/open-mmlab/mmdetection/blob/master/LICENSE)
2626
[![open issues](https://isitmaintained.com/badge/open/open-mmlab/mmdetection.svg)](https://github.com/open-mmlab/mmdetection/issues)
27+
[![issue resolution](https://isitmaintained.com/badge/resolution/open-mmlab/mmdetection.svg)](https://github.com/open-mmlab/mmdetection/issues)
2728

28-
<img src="https://user-images.githubusercontent.com/12907710/137271636-56ba1cd2-b110-4812-8221-b4c120320aa9.png"/>
29-
30-
[📘Documentation](https://mmdetection.readthedocs.io/en/v2.21.0/) |
31-
[🛠️Installation](https://mmdetection.readthedocs.io/en/v2.21.0/get_started.html) |
32-
[👀Model Zoo](https://mmdetection.readthedocs.io/en/v2.21.0/model_zoo.html) |
33-
[🆕Update News](https://mmdetection.readthedocs.io/en/v2.21.0/changelog.html) |
29+
[📘Documentation](https://mmdetection.readthedocs.io/en/stable/) |
30+
[🛠️Installation](https://mmdetection.readthedocs.io/en/stable/get_started.html) |
31+
[👀Model Zoo](https://mmdetection.readthedocs.io/en/stable/model_zoo.html) |
32+
[🆕Update News](https://mmdetection.readthedocs.io/en/stable/changelog.html) |
3433
[🚀Ongoing Projects](https://github.com/open-mmlab/mmdetection/projects) |
3534
[🤔Reporting Issues](https://github.com/open-mmlab/mmdetection/issues/new/choose)
3635

3736
</div>
3837

39-
## Introduction
38+
<div align="center">
4039

4140
English | [简体中文](README_zh-CN.md)
4241

42+
</div>
43+
44+
## Introduction
45+
4346
MMDetection is an open source object detection toolbox based on PyTorch. It is
4447
a part of the [OpenMMLab](https://openmmlab.com/) project.
4548

4649
The master branch works with **PyTorch 1.5+**.
4750

51+
<img src="https://user-images.githubusercontent.com/12907710/137271636-56ba1cd2-b110-4812-8221-b4c120320aa9.png"/>
52+
4853
<details open>
4954
<summary>Major features</summary>
5055

@@ -68,22 +73,42 @@ The master branch works with **PyTorch 1.5+**.
6873

6974
Apart from MMDetection, we also released a library [mmcv](https://github.com/open-mmlab/mmcv) for computer vision research, which is heavily depended on by this toolbox.
7075

71-
## License
76+
## What's New
7277

73-
This project is released under the [Apache 2.0 license](LICENSE).
78+
**2.25.0** was released in 1/6/2022:
7479

75-
## Changelog
76-
77-
**2.24.1** was released in 30/4/2022:
78-
79-
- Support [Simple Copy Paste](configs/simple_copy_paste)
80-
- Support automatically scaling LR according to GPU number and samples per GPU
81-
- Support Class Aware Sampler that improves performance on OpenImages Dataset
80+
- Support dedicated `MMDetWandbHook` hook
81+
- Support [ConvNeXt](configs/convnext), [DDOD](configs/ddod), [SOLOv2](configs/solov2)
82+
- Support [Mask2Former](configs/mask2former) for instance segmentation
83+
- Rename [config files of Mask2Former](configs/mask2former)
8284

8385
Please refer to [changelog.md](docs/en/changelog.md) for details and release history.
8486

8587
For compatibility changes between different versions of MMDetection, please refer to [compatibility.md](docs/en/compatibility.md).
8688

89+
## Installation
90+
91+
Please refer to [Installation](docs/en/get_started.md/#Installation) for installation instructions.
92+
93+
## Getting Started
94+
95+
Please see [get_started.md](docs/en/get_started.md) for the basic usage of MMDetection. We provide [colab tutorial](demo/MMDet_Tutorial.ipynb) and [instance segmentation colab tutorial](demo/MMDet_InstanceSeg_Tutorial.ipynb), and other tutorials for:
96+
97+
- [with existing dataset](docs/en/1_exist_data_model.md)
98+
- [with new dataset](docs/en/2_new_data_model.md)
99+
- [with existing dataset_new_model](docs/en/3_exist_data_new_model.md)
100+
- [learn about configs](docs/en/tutorials/config.md)
101+
- [customize_datasets](docs/en/tutorials/customize_dataset.md)
102+
- [customize data pipelines](docs/en/tutorials/data_pipeline.md)
103+
- [customize_models](docs/en/tutorials/customize_models.md)
104+
- [customize runtime settings](docs/en/tutorials/customize_runtime.md)
105+
- [customize_losses](docs/en/tutorials/customize_losses.md)
106+
- [finetuning models](docs/en/tutorials/finetune.md)
107+
- [export a model to ONNX](docs/en/tutorials/pytorch2onnx.md)
108+
- [export ONNX to TRT](docs/en/tutorials/onnx2tensorrt.md)
109+
- [weight initialization](docs/en/tutorials/init_cfg.md)
110+
- [how to xxx](docs/en/tutorials/how_to.md)
111+
87112
## Overview of Benchmark and Model Zoo
88113

89114
Results and models are available in the [model zoo](docs/en/model_zoo.md).
@@ -144,6 +169,7 @@ Results and models are available in the [model zoo](docs/en/model_zoo.md).
144169
<li><a href="configs/yolox">YOLOX (CVPR'2021)</a></li>
145170
<li><a href="configs/deformable_detr">Deformable DETR (ICLR'2021)</a></li>
146171
<li><a href="configs/tood">TOOD (ICCV'2021)</a></li>
172+
<li><a href="configs/ddod">DDOD (ACM MM'2021)</a></li>
147173
</ul>
148174
</td>
149175
<td>
@@ -160,6 +186,7 @@ Results and models are available in the [model zoo](docs/en/model_zoo.md).
160186
<li><a href="configs/solov2">SOLOv2 (NeurIPS'2020)</a></li>
161187
<li><a href="configs/scnet">SCNet (AAAI'2021)</a></li>
162188
<li><a href="configs/queryinst">QueryInst (ICCV'2021)</a></li>
189+
<li><a href="configs/mask2former">Mask2Former (ArXiv'2021)</a></li>
163190
</ul>
164191
</td>
165192
<td>
@@ -272,15 +299,7 @@ Results and models are available in the [model zoo](docs/en/model_zoo.md).
272299

273300
Some other methods are also supported in [projects using MMDetection](./docs/en/projects.md).
274301

275-
## Installation
276-
277-
Please refer to [get_started.md](docs/en/get_started.md) for installation.
278-
279-
## Getting Started
280-
281-
Please see [get_started.md](docs/en/get_started.md) for the basic usage of MMDetection.
282-
We provide [detection colab tutorial](demo/MMDet_Tutorial.ipynb) and [instance segmentation colab tutorial](demo/MMDet_InstanceSeg_Tutorial.ipynb), and full guidance for quick run [with existing dataset](docs/en/1_exist_data_model.md) and [with new dataset](docs/en/2_new_data_model.md) for beginners.
283-
There are also tutorials for [finetuning models](docs/en/tutorials/finetune.md), [adding new dataset](docs/en/tutorials/customize_dataset.md), [designing data pipeline](docs/en/tutorials/data_pipeline.md), [customizing models](docs/en/tutorials/customize_models.md), [customizing runtime settings](docs/en/tutorials/customize_runtime.md) and [useful tools](docs/en/useful_tools.md).
302+
## FAQ
284303

285304
Please refer to [FAQ](docs/en/faq.md) for frequently asked questions.
286305

@@ -311,6 +330,10 @@ If you use this toolbox or benchmark in your research, please cite this project.
311330
}
312331
```
313332

333+
## License
334+
335+
This project is released under the [Apache 2.0 license](LICENSE).
336+
314337
## Projects in OpenMMLab
315338

316339
- [MMCV](https://github.com/open-mmlab/mmcv): OpenMMLab foundational library for computer vision.

README_zh-CN.md

Lines changed: 52 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,31 @@
2424
[![codecov](https://codecov.io/gh/open-mmlab/mmdetection/branch/master/graph/badge.svg)](https://codecov.io/gh/open-mmlab/mmdetection)
2525
[![license](https://img.shields.io/github/license/open-mmlab/mmdetection.svg)](https://github.com/open-mmlab/mmdetection/blob/master/LICENSE)
2626
[![open issues](https://isitmaintained.com/badge/open/open-mmlab/mmdetection.svg)](https://github.com/open-mmlab/mmdetection/issues)
27+
[![issue resolution](https://isitmaintained.com/badge/resolution/open-mmlab/mmdetection.svg)](https://github.com/open-mmlab/mmdetection/issues)
2728

28-
<img src="https://user-images.githubusercontent.com/12907710/137271636-56ba1cd2-b110-4812-8221-b4c120320aa9.png"/>
29-
30-
[📘使用文档](https://mmdetection.readthedocs.io/zh_CN/v2.21.0/) |
31-
[🛠️安装教程](https://mmdetection.readthedocs.io/zh_CN/v2.21.0/get_started.html) |
32-
[👀模型库](https://mmdetection.readthedocs.io/zh_CN/v2.21.0/model_zoo.html) |
33-
[🆕更新日志](https://mmdetection.readthedocs.io/en/v2.21.0/changelog.html) |
29+
[📘使用文档](https://mmdetection.readthedocs.io/zh_CN/stable/) |
30+
[🛠️安装教程](https://mmdetection.readthedocs.io/zh_CN/stable/get_started.html) |
31+
[👀模型库](https://mmdetection.readthedocs.io/zh_CN/stable/model_zoo.html) |
32+
[🆕更新日志](https://mmdetection.readthedocs.io/en/stable/changelog.html) |
3433
[🚀进行中的项目](https://github.com/open-mmlab/mmdetection/projects) |
3534
[🤔报告问题](https://github.com/open-mmlab/mmdetection/issues/new/choose)
3635

3736
</div>
3837

39-
## 简介
38+
<div align="center">
4039

4140
[English](README.md) | 简体中文
4241

42+
</div>
43+
44+
## 简介
45+
4346
MMDetection 是一个基于 PyTorch 的目标检测开源工具箱。它是 [OpenMMLab](https://openmmlab.com/) 项目的一部分。
4447

4548
主分支代码目前支持 PyTorch 1.5 以上的版本。
4649

50+
<img src="https://user-images.githubusercontent.com/12907710/137271636-56ba1cd2-b110-4812-8221-b4c120320aa9.png"/>
51+
4752
<details open>
4853
<summary>主要特性</summary>
4954

@@ -67,22 +72,45 @@ MMDetection 是一个基于 PyTorch 的目标检测开源工具箱。它是 [Ope
6772

6873
除了 MMDetection 之外,我们还开源了计算机视觉基础库 [MMCV](https://github.com/open-mmlab/mmcv),MMCV 是 MMDetection 的主要依赖。
6974

70-
## 开源许可证
71-
72-
该项目采用 [Apache 2.0 开源许可证](LICENSE)
73-
74-
## 更新日志
75+
## 最新进展
7576

76-
最新的 **2.24.1** 版本已经在 2022.04.30 发布:
77+
最新的 **2.25.0** 版本已经在 2022.06.01 发布:
7778

78-
- 支持算法 [Simple Copy Paste](configs/simple_copy_paste)
79-
- 支持训练时根据总 batch 数自动缩放学习率
80-
- 支持类别可知的采样器来提高算法在 OpenImages 数据集上的性能
79+
- 支持功能更丰富的 `MMDetWandbHook`
80+
- 支持算法 [ConvNeXt](configs/convnext), [DDOD](configs/ddod)[SOLOv2](configs/solov2)
81+
- [Mask2Former](configs/mask2former) 支持实例分割
82+
- 为了加入 Mask2Former 实例分割的模型,对 Mask2Former 原有的全景分割的配置文件进行了重命名
8183

8284
如果想了解更多版本更新细节和历史信息,请阅读[更新日志](docs/en/changelog.md)
8385

8486
如果想了解 MMDetection 不同版本之间的兼容性, 请参考[兼容性说明文档](docs/zh_cn/compatibility.md)
8587

88+
## 安装
89+
90+
请参考[安装指令](docs/zh_cn/get_started.md/#Installation)进行安装。
91+
92+
## 教程
93+
94+
请参考[快速入门文档](docs/zh_cn/get_started.md)学习 MMDetection 的基本使用。
95+
我们提供了 [检测的 colab 教程](demo/MMDet_Tutorial.ipynb)[实例分割的 colab 教程](demo/MMDet_InstanceSeg_Tutorial.ipynb),也为新手提供了完整的运行教程,其他教程如下
96+
97+
- [使用已有模型在标准数据集上进行推理](docs/zh_cn/1_exist_data_model.md)
98+
- [在自定义数据集上进行训练](docs/zh_cn/2_new_data_model.md)
99+
- [在标准数据集上训练自定义模型](docs/zh_cn/3_exist_data_new_model.md)
100+
- [学习配置文件](docs/zh_cn/tutorials/config.md)
101+
- [自定义数据集](docs/zh_cn/tutorials/customize_dataset.md)
102+
- [自定义数据预处理流程](docs/zh_cn/tutorials/data_pipeline.md)
103+
- [自定义模型](docs/zh_cn/tutorials/customize_models.md)
104+
- [自定义训练配置](docs/zh_cn/tutorials/customize_runtime.md)
105+
- [自定义损失函数](docs/zh_cn/tutorials/customize_losses.md)
106+
- [模型微调](docs/zh_cn/tutorials/finetune.md)
107+
- [Pytorch 到 ONNX 的模型转换](docs/zh_cn/tutorials/pytorch2onnx.md)
108+
- [ONNX 到 TensorRT 的模型转换](docs/zh_cn/tutorials/onnx2tensorrt.md)
109+
- [权重初始化](docs/zh_cn/tutorials/init_cfg.md)
110+
- [how to xxx](docs/zh_cn/tutorials/how_to.md)
111+
112+
同时,我们还提供了 [MMDetection 中文解读文案汇总](docs/zh_cn/article.md)
113+
86114
## 基准测试和模型库
87115

88116
测试结果和模型可以在[模型库](docs/zh_cn/model_zoo.md)中找到。
@@ -143,6 +171,7 @@ MMDetection 是一个基于 PyTorch 的目标检测开源工具箱。它是 [Ope
143171
<li><a href="configs/yolox">YOLOX (CVPR'2021)</a></li>
144172
<li><a href="configs/deformable_detr">Deformable DETR (ICLR'2021)</a></li>
145173
<li><a href="configs/tood">TOOD (ICCV'2021)</a></li>
174+
<li><a href="configs/ddod">DDOD (ACM MM'2021)</a></li>
146175
</ul>
147176
</td>
148177
<td>
@@ -159,6 +188,7 @@ MMDetection 是一个基于 PyTorch 的目标检测开源工具箱。它是 [Ope
159188
<li><a href="configs/solov2">SOLOv2 (NeurIPS'2020)</a></li>
160189
<li><a href="configs/scnet">SCNet (AAAI'2021)</a></li>
161190
<li><a href="configs/queryinst">QueryInst (ICCV'2021)</a></li>
191+
<li><a href="configs/mask2former">Mask2Former (ArXiv'2021)</a></li>
162192
</ul>
163193
</td>
164194
<td>
@@ -271,22 +301,9 @@ MMDetection 是一个基于 PyTorch 的目标检测开源工具箱。它是 [Ope
271301

272302
我们在[基于 MMDetection 的项目](./docs/zh_cn/projects.md)中列举了一些其他的支持的算法。
273303

274-
## 安装
275-
276-
请参考[快速入门文档](docs/zh_cn/get_started.md)进行安装。
277-
278-
## 快速入门
279-
280-
请参考[快速入门文档](docs/zh_cn/get_started.md)学习 MMDetection 的基本使用。
281-
我们提供了 [检测的 colab 教程](demo/MMDet_Tutorial.ipynb)[实例分割的 colab 教程](demo/MMDet_InstanceSeg_Tutorial.ipynb),也为新手提供了完整的运行教程,分别针对[已有数据集](docs/zh_cn/1_exist_data_model.md)[新数据集](docs/zh_cn/2_new_data_model.md) 完整的使用指南
282-
283-
我们也提供了一些进阶教程,内容覆盖了 [finetune 模型](docs/zh_cn/tutorials/finetune.md)[增加新数据集支持](docs/zh_cn/tutorials/customize_dataset.md)[设计新的数据预处理流程](docs/zh_cn/tutorials/data_pipeline.md)[增加自定义模型](docs/zh_cn/tutorials/customize_models.md)[增加自定义的运行时配置](docs/zh_cn/tutorials/customize_runtime.md)[常用工具和脚本](docs/zh_cn/useful_tools.md)
284-
285-
如果遇到问题,请参考 [常见问题解答](docs/zh_cn/faq.md)
286-
287-
## 相关教程
304+
## 常见问题
288305

289-
请参考 [MMDetection 中文解读文案汇总](docs/zh_cn/article.md)
306+
请参考 [FAQ](docs/zh_cn/faq.md) 了解其他用户的常见问题。
290307

291308
## 贡献指南
292309

@@ -314,6 +331,10 @@ MMDetection 是一款由来自不同高校和企业的研发人员共同参与
314331
}
315332
```
316333

334+
## 开源许可证
335+
336+
该项目采用 [Apache 2.0 开源许可证](LICENSE)
337+
317338
## OpenMMLab 的其他项目
318339

319340
- [MMCV](https://github.com/open-mmlab/mmcv): OpenMMLab 计算机视觉基础库

mmdet/core/hook/wandblogger_hook.py

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import importlib
33
import os.path as osp
44
import sys
5+
import warnings
56

67
import mmcv
78
import numpy as np
@@ -10,6 +11,7 @@
1011
from mmcv.runner.dist_utils import master_only
1112
from mmcv.runner.hooks.checkpoint import CheckpointHook
1213
from mmcv.runner.hooks.logger.wandb import WandbLoggerHook
14+
from mmcv.utils import digit_version
1315

1416
from mmdet.core import DistEvalHook, EvalHook
1517
from mmdet.core.mask.structures import polygon_to_bitmap
@@ -109,6 +111,25 @@ def __init__(self,
109111
self.ckpt_hook: CheckpointHook = None
110112
self.eval_hook: EvalHook = None
111113

114+
def import_wandb(self):
115+
try:
116+
import wandb
117+
from wandb import init # noqa
118+
119+
# Fix ResourceWarning when calling wandb.log in wandb v0.12.10.
120+
# https://github.com/wandb/client/issues/2837
121+
if digit_version(wandb.__version__) < digit_version('0.12.10'):
122+
warnings.warn(
123+
f'The current wandb {wandb.__version__} is '
124+
f'lower than v0.12.10 will cause ResourceWarning '
125+
f'when calling wandb.log, Please run '
126+
f'"pip install --upgrade wandb"')
127+
128+
except ImportError:
129+
raise ImportError(
130+
'Please run "pip install "wandb>=0.12.10"" to install wandb')
131+
self.wandb = wandb
132+
112133
@master_only
113134
def before_run(self, runner):
114135
super(MMDetWandbHook, self).before_run(runner)
@@ -198,9 +219,9 @@ def after_train_epoch(self, runner):
198219
}
199220
else:
200221
metadata = None
201-
aliases = [f'epoch_{runner.epoch+1}', 'latest']
222+
aliases = [f'epoch_{runner.epoch + 1}', 'latest']
202223
model_path = osp.join(self.ckpt_hook.out_dir,
203-
f'epoch_{runner.epoch+1}.pth')
224+
f'epoch_{runner.epoch + 1}.pth')
204225
self._log_ckpt_as_artifact(model_path, aliases, metadata)
205226

206227
# Save prediction table
@@ -238,9 +259,9 @@ def after_train_iter(self, runner):
238259
}
239260
else:
240261
metadata = None
241-
aliases = [f'iter_{runner.iter+1}', 'latest']
262+
aliases = [f'iter_{runner.iter + 1}', 'latest']
242263
model_path = osp.join(self.ckpt_hook.out_dir,
243-
f'iter_{runner.iter+1}.pth')
264+
f'iter_{runner.iter + 1}.pth')
244265
self._log_ckpt_as_artifact(model_path, aliases, metadata)
245266

246267
# Save prediction table

0 commit comments

Comments
 (0)