Commit 4a950602 authored by dengjb's avatar dengjb
Browse files

update codes

parent 3e89e256
Pipeline #1044 failed with stages
in 0 seconds
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/en/_build/
docs/zh_cn/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
data/
data
.vscode
.idea
.DS_Store
# custom
*.pkl
*.pkl.json
*.log.json
docs/modelzoo_statistics.md
mmdet/.mim
work_dirs/
# Pytorch
*.pth
*.py~
*.sh~
assign:
strategy:
# random
daily-shift-based
scedule:
'*/1 * * * *'
assignees:
- Czm369
- hhaAndroid
- jbwang1997
- RangiLyu
- BIGWangYuDong
- chhluo
- ZwwWayne
exclude: ^tests/data/
repos:
- repo: https://gitee.com/openmmlab/mirrors-flake8
rev: 5.0.4
hooks:
- id: flake8
- repo: https://gitee.com/openmmlab/mirrors-isort
rev: 5.11.5
hooks:
- id: isort
- repo: https://gitee.com/openmmlab/mirrors-yapf
rev: v0.32.0
hooks:
- id: yapf
- repo: https://gitee.com/openmmlab/mirrors-pre-commit-hooks
rev: v4.3.0
hooks:
- id: trailing-whitespace
- id: check-yaml
- id: end-of-file-fixer
- id: requirements-txt-fixer
- id: double-quote-string-fixer
- id: check-merge-conflict
- id: fix-encoding-pragma
args: ["--remove"]
- id: mixed-line-ending
args: ["--fix=lf"]
- repo: https://gitee.com/openmmlab/mirrors-mdformat
rev: 0.7.9
hooks:
- id: mdformat
args: ["--number"]
additional_dependencies:
- mdformat-openmmlab
- mdformat_frontmatter
- linkify-it-py
- repo: https://gitee.com/openmmlab/mirrors-codespell
rev: v2.2.1
hooks:
- id: codespell
- repo: https://gitee.com/openmmlab/mirrors-docformatter
rev: v1.3.1
hooks:
- id: docformatter
args: ["--in-place", "--wrap-descriptions", "79"]
- repo: https://gitee.com/openmmlab/mirrors-pyupgrade
rev: v3.0.0
hooks:
- id: pyupgrade
args: ["--py36-plus"]
- repo: https://gitee.com/open-mmlab/pre-commit-hooks
rev: v0.2.0
hooks:
- id: check-algo-readme
- id: check-copyright
args: ["mmdet"]
# - repo: https://gitee.com/openmmlab/mirrors-mypy
# rev: v0.812
# hooks:
# - id: mypy
# exclude: "docs"
repos:
- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
hooks:
- id: flake8
- repo: https://github.com/PyCQA/isort
rev: 5.11.5
hooks:
- id: isort
- repo: https://github.com/pre-commit/mirrors-yapf
rev: v0.32.0
hooks:
- id: yapf
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: trailing-whitespace
- id: check-yaml
- id: end-of-file-fixer
- id: requirements-txt-fixer
- id: double-quote-string-fixer
- id: check-merge-conflict
- id: fix-encoding-pragma
args: ["--remove"]
- id: mixed-line-ending
args: ["--fix=lf"]
- repo: https://github.com/codespell-project/codespell
rev: v2.2.1
hooks:
- id: codespell
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.9
hooks:
- id: mdformat
args: ["--number"]
additional_dependencies:
- mdformat-openmmlab
- mdformat_frontmatter
- linkify-it-py
- repo: https://github.com/myint/docformatter
rev: v1.3.1
hooks:
- id: docformatter
args: ["--in-place", "--wrap-descriptions", "79"]
- repo: https://github.com/open-mmlab/pre-commit-hooks
rev: v0.2.0 # Use the ref you want to point at
hooks:
- id: check-algo-readme
- id: check-copyright
args: ["mmdet"] # replace the dir_to_check with your expected directory to check
version: 2
build:
os: ubuntu-22.04
tools:
python: "3.8"
formats:
- epub
python:
install:
- requirements: requirements/docs.txt
- requirements: requirements/readthedocs.txt
cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- name: "MMDetection Contributors"
title: "OpenMMLab Detection Toolbox and Benchmark"
date-released: 2018-08-22
url: "https://github.com/open-mmlab/mmdetection"
license: Apache-2.0
Copyright 2018-2023 OpenMMLab. All rights reserved.
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2018-2023 OpenMMLab.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
include requirements/*.txt
include mmdet/VERSION
include mmdet/.mim/model-index.yml
include mmdet/.mim/dataset-index.yml
include mmdet/.mim/demo/*/*
recursive-include mmdet/.mim/configs *.py *.yml
recursive-include mmdet/.mim/tools *.sh *.py
<div align="center">
<img src="resources/mmdet-logo.png" width="600"/>
<div>&nbsp;</div>
<div align="center">
<b><font size="5">OpenMMLab website</font></b>
<sup>
<a href="https://openmmlab.com">
<i><font size="4">HOT</font></i>
</a>
</sup>
&nbsp;&nbsp;&nbsp;&nbsp;
<b><font size="5">OpenMMLab platform</font></b>
<sup>
<a href="https://platform.openmmlab.com">
<i><font size="4">TRY IT OUT</font></i>
</a>
</sup>
</div>
<div>&nbsp;</div>
[![PyPI](https://img.shields.io/pypi/v/mmdet)](https://pypi.org/project/mmdet)
[![docs](https://img.shields.io/badge/docs-latest-blue)](https://mmdetection.readthedocs.io/en/latest/)
[![badge](https://github.com/open-mmlab/mmdetection/workflows/build/badge.svg)](https://github.com/open-mmlab/mmdetection/actions)
[![codecov](https://codecov.io/gh/open-mmlab/mmdetection/branch/main/graph/badge.svg)](https://codecov.io/gh/open-mmlab/mmdetection)
[![license](https://img.shields.io/github/license/open-mmlab/mmdetection.svg)](https://github.com/open-mmlab/mmdetection/blob/main/LICENSE)
[![open issues](https://isitmaintained.com/badge/open/open-mmlab/mmdetection.svg)](https://github.com/open-mmlab/mmdetection/issues)
[![issue resolution](https://isitmaintained.com/badge/resolution/open-mmlab/mmdetection.svg)](https://github.com/open-mmlab/mmdetection/issues)
[![Open in OpenXLab](https://cdn-static.openxlab.org.cn/app-center/openxlab_demo.svg)](https://openxlab.org.cn/apps?search=mmdet)
[📘Documentation](https://mmdetection.readthedocs.io/en/latest/) |
[🛠️Installation](https://mmdetection.readthedocs.io/en/latest/get_started.html) |
[👀Model Zoo](https://mmdetection.readthedocs.io/en/latest/model_zoo.html) |
[🆕Update News](https://mmdetection.readthedocs.io/en/latest/notes/changelog.html) |
[🚀Ongoing Projects](https://github.com/open-mmlab/mmdetection/projects) |
[🤔Reporting Issues](https://github.com/open-mmlab/mmdetection/issues/new/choose)
</div>
<div align="center">
English | [简体中文](README_zh-CN.md)
</div>
<div align="center">
<a href="https://openmmlab.medium.com/" style="text-decoration:none;">
<img src="https://user-images.githubusercontent.com/25839884/219255827-67c1a27f-f8c5-46a9-811d-5e57448c61d1.png" width="3%" alt="" /></a>
<img src="https://user-images.githubusercontent.com/25839884/218346358-56cc8e2f-a2b8-487f-9088-32480cceabcf.png" width="3%" alt="" />
<a href="https://discord.com/channels/1037617289144569886/1046608014234370059" style="text-decoration:none;">
<img src="https://user-images.githubusercontent.com/25839884/218347213-c080267f-cbb6-443e-8532-8e1ed9a58ea9.png" width="3%" alt="" /></a>
<img src="https://user-images.githubusercontent.com/25839884/218346358-56cc8e2f-a2b8-487f-9088-32480cceabcf.png" width="3%" alt="" />
<a href="https://twitter.com/OpenMMLab" style="text-decoration:none;">
<img src="https://user-images.githubusercontent.com/25839884/218346637-d30c8a0f-3eba-4699-8131-512fb06d46db.png" width="3%" alt="" /></a>
<img src="https://user-images.githubusercontent.com/25839884/218346358-56cc8e2f-a2b8-487f-9088-32480cceabcf.png" width="3%" alt="" />
<a href="https://www.youtube.com/openmmlab" style="text-decoration:none;">
<img src="https://user-images.githubusercontent.com/25839884/218346691-ceb2116a-465a-40af-8424-9f30d2348ca9.png" width="3%" alt="" /></a>
<img src="https://user-images.githubusercontent.com/25839884/218346358-56cc8e2f-a2b8-487f-9088-32480cceabcf.png" width="3%" alt="" />
<a href="https://space.bilibili.com/1293512903" style="text-decoration:none;">
<img src="https://user-images.githubusercontent.com/25839884/219026751-d7d14cce-a7c9-4e82-9942-8375fca65b99.png" width="3%" alt="" /></a>
<img src="https://user-images.githubusercontent.com/25839884/218346358-56cc8e2f-a2b8-487f-9088-32480cceabcf.png" width="3%" alt="" />
<a href="https://www.zhihu.com/people/openmmlab" style="text-decoration:none;">
<img src="https://user-images.githubusercontent.com/25839884/219026120-ba71e48b-6e94-4bd4-b4e9-b7d175b5e362.png" width="3%" alt="" /></a>
</div>
<div align="center">
<img src="https://github.com/open-mmlab/mmdetection/assets/17425982/6c29886f-ae7a-4a55-8be4-352ee85b7d3e"/>
</div>
## Introduction
MMDetection is an open source object detection toolbox based on PyTorch. It is
a part of the [OpenMMLab](https://openmmlab.com/) project.
The main branch works with **PyTorch 1.8+**.
<img src="https://user-images.githubusercontent.com/12907710/187674113-2074d658-f2fb-42d1-ac15-9c4a695e64d7.png"/>
<details open>
<summary>Major features</summary>
- **Modular Design**
We decompose the detection framework into different components and one can easily construct a customized object detection framework by combining different modules.
- **Support of multiple tasks out of box**
The toolbox directly supports multiple detection tasks such as **object detection**, **instance segmentation**, **panoptic segmentation**, and **semi-supervised object detection**.
- **High efficiency**
All basic bbox and mask operations run on GPUs. The training speed is faster than or comparable to other codebases, including [Detectron2](https://github.com/facebookresearch/detectron2), [maskrcnn-benchmark](https://github.com/facebookresearch/maskrcnn-benchmark) and [SimpleDet](https://github.com/TuSimple/simpledet).
- **State of the art**
The toolbox stems from the codebase developed by the *MMDet* team, who won [COCO Detection Challenge](http://cocodataset.org/#detection-leaderboard) in 2018, and we keep pushing it forward.
The newly released [RTMDet](configs/rtmdet) also obtains new state-of-the-art results on real-time instance segmentation and rotated object detection tasks and the best parameter-accuracy trade-off on object detection.
</details>
Apart from MMDetection, we also released [MMEngine](https://github.com/open-mmlab/mmengine) for model training and [MMCV](https://github.com/open-mmlab/mmcv) for computer vision research, which are heavily depended on by this toolbox.
## What's New
💎 **We have released the pre-trained weights for MM-Grounding-DINO Swin-B and Swin-L, welcome to try and give feedback.**
### Highlight
**v3.3.0** was released in 5/1/2024:
**[MM-Grounding-DINO: An Open and Comprehensive Pipeline for Unified Object Grounding and Detection](https://arxiv.org/abs/2401.02361)**
Grounding DINO is a grounding pre-training model that unifies 2d open vocabulary object detection and phrase grounding, with wide applications. However, its training part has not been open sourced. Therefore, we propose MM-Grounding-DINO, which not only serves as an open source replication version of Grounding DINO, but also achieves significant performance improvement based on reconstructed data types, exploring different dataset combinations and initialization strategies. Moreover, we conduct evaluations from multiple dimensions, including OOD, REC, Phrase Grounding, OVD, and Fine-tune, to fully excavate the advantages and disadvantages of Grounding pre-training, hoping to provide inspiration for future work.
code: [mm_grounding_dino/README.md](configs/mm_grounding_dino/README.md)
<div align=center>
<img src="https://github.com/open-mmlab/mmdetection/assets/17425982/fb14d1ee-5469-44d2-b865-aac9850c429c"/>
</div>
We are excited to announce our latest work on real-time object recognition tasks, **RTMDet**, a family of fully convolutional single-stage detectors. RTMDet not only achieves the best parameter-accuracy trade-off on object detection from tiny to extra-large model sizes but also obtains new state-of-the-art performance on instance segmentation and rotated object detection tasks. Details can be found in the [technical report](https://arxiv.org/abs/2212.07784). Pre-trained models are [here](configs/rtmdet).
[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/rtmdet-an-empirical-study-of-designing-real/real-time-instance-segmentation-on-mscoco)](https://paperswithcode.com/sota/real-time-instance-segmentation-on-mscoco?p=rtmdet-an-empirical-study-of-designing-real)
[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/rtmdet-an-empirical-study-of-designing-real/object-detection-in-aerial-images-on-dota-1)](https://paperswithcode.com/sota/object-detection-in-aerial-images-on-dota-1?p=rtmdet-an-empirical-study-of-designing-real)
[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/rtmdet-an-empirical-study-of-designing-real/object-detection-in-aerial-images-on-hrsc2016)](https://paperswithcode.com/sota/object-detection-in-aerial-images-on-hrsc2016?p=rtmdet-an-empirical-study-of-designing-real)
| Task | Dataset | AP | FPS(TRT FP16 BS1 3090) |
| ------------------------ | ------- | ------------------------------------ | ---------------------- |
| Object Detection | COCO | 52.8 | 322 |
| Instance Segmentation | COCO | 44.6 | 188 |
| Rotated Object Detection | DOTA | 78.9(single-scale)/81.3(multi-scale) | 121 |
<div align=center>
<img src="https://user-images.githubusercontent.com/12907710/208044554-1e8de6b5-48d8-44e4-a7b5-75076c7ebb71.png"/>
</div>
## Installation
Please refer to [Installation](https://mmdetection.readthedocs.io/en/latest/get_started.html) for installation instructions.
## Getting Started
Please see [Overview](https://mmdetection.readthedocs.io/en/latest/get_started.html) for the general introduction of MMDetection.
For detailed user guides and advanced guides, please refer to our [documentation](https://mmdetection.readthedocs.io/en/latest/):
- User Guides
<details>
- [Train & Test](https://mmdetection.readthedocs.io/en/latest/user_guides/index.html#train-test)
- [Learn about Configs](https://mmdetection.readthedocs.io/en/latest/user_guides/config.html)
- [Inference with existing models](https://mmdetection.readthedocs.io/en/latest/user_guides/inference.html)
- [Dataset Prepare](https://mmdetection.readthedocs.io/en/latest/user_guides/dataset_prepare.html)
- [Test existing models on standard datasets](https://mmdetection.readthedocs.io/en/latest/user_guides/test.html)
- [Train predefined models on standard datasets](https://mmdetection.readthedocs.io/en/latest/user_guides/train.html)
- [Train with customized datasets](https://mmdetection.readthedocs.io/en/latest/user_guides/train.html#train-with-customized-datasets)
- [Train with customized models and standard datasets](https://mmdetection.readthedocs.io/en/latest/user_guides/new_model.html)
- [Finetuning Models](https://mmdetection.readthedocs.io/en/latest/user_guides/finetune.html)
- [Test Results Submission](https://mmdetection.readthedocs.io/en/latest/user_guides/test_results_submission.html)
- [Weight initialization](https://mmdetection.readthedocs.io/en/latest/user_guides/init_cfg.html)
- [Use a single stage detector as RPN](https://mmdetection.readthedocs.io/en/latest/user_guides/single_stage_as_rpn.html)
- [Semi-supervised Object Detection](https://mmdetection.readthedocs.io/en/latest/user_guides/semi_det.html)
- [Useful Tools](https://mmdetection.readthedocs.io/en/latest/user_guides/index.html#useful-tools)
</details>
- Advanced Guides
<details>
- [Basic Concepts](https://mmdetection.readthedocs.io/en/latest/advanced_guides/index.html#basic-concepts)
- [Component Customization](https://mmdetection.readthedocs.io/en/latest/advanced_guides/index.html#component-customization)
- [How to](https://mmdetection.readthedocs.io/en/latest/advanced_guides/index.html#how-to)
</details>
We also provide object detection colab tutorial [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](demo/MMDet_Tutorial.ipynb) and instance segmentation colab tutorial [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](demo/MMDet_InstanceSeg_Tutorial.ipynb).
To migrate from MMDetection 2.x, please refer to [migration](https://mmdetection.readthedocs.io/en/latest/migration.html).
## Overview of Benchmark and Model Zoo
Results and models are available in the [model zoo](docs/en/model_zoo.md).
<div align="center">
<b>Architectures</b>
</div>
<table align="center">
<tbody>
<tr align="center" valign="bottom">
<td>
<b>Object Detection</b>
</td>
<td>
<b>Instance Segmentation</b>
</td>
<td>
<b>Panoptic Segmentation</b>
</td>
<td>
<b>Other</b>
</td>
</tr>
<tr valign="top">
<td>
<ul>
<li><a href="configs/fast_rcnn">Fast R-CNN (ICCV'2015)</a></li>
<li><a href="configs/faster_rcnn">Faster R-CNN (NeurIPS'2015)</a></li>
<li><a href="configs/rpn">RPN (NeurIPS'2015)</a></li>
<li><a href="configs/ssd">SSD (ECCV'2016)</a></li>
<li><a href="configs/retinanet">RetinaNet (ICCV'2017)</a></li>
<li><a href="configs/cascade_rcnn">Cascade R-CNN (CVPR'2018)</a></li>
<li><a href="configs/yolo">YOLOv3 (ArXiv'2018)</a></li>
<li><a href="configs/cornernet">CornerNet (ECCV'2018)</a></li>
<li><a href="configs/grid_rcnn">Grid R-CNN (CVPR'2019)</a></li>
<li><a href="configs/guided_anchoring">Guided Anchoring (CVPR'2019)</a></li>
<li><a href="configs/fsaf">FSAF (CVPR'2019)</a></li>
<li><a href="configs/centernet">CenterNet (CVPR'2019)</a></li>
<li><a href="configs/libra_rcnn">Libra R-CNN (CVPR'2019)</a></li>
<li><a href="configs/tridentnet">TridentNet (ICCV'2019)</a></li>
<li><a href="configs/fcos">FCOS (ICCV'2019)</a></li>
<li><a href="configs/reppoints">RepPoints (ICCV'2019)</a></li>
<li><a href="configs/free_anchor">FreeAnchor (NeurIPS'2019)</a></li>
<li><a href="configs/cascade_rpn">CascadeRPN (NeurIPS'2019)</a></li>
<li><a href="configs/foveabox">Foveabox (TIP'2020)</a></li>
<li><a href="configs/double_heads">Double-Head R-CNN (CVPR'2020)</a></li>
<li><a href="configs/atss">ATSS (CVPR'2020)</a></li>
<li><a href="configs/nas_fcos">NAS-FCOS (CVPR'2020)</a></li>
<li><a href="configs/centripetalnet">CentripetalNet (CVPR'2020)</a></li>
<li><a href="configs/autoassign">AutoAssign (ArXiv'2020)</a></li>
<li><a href="configs/sabl">Side-Aware Boundary Localization (ECCV'2020)</a></li>
<li><a href="configs/dynamic_rcnn">Dynamic R-CNN (ECCV'2020)</a></li>
<li><a href="configs/detr">DETR (ECCV'2020)</a></li>
<li><a href="configs/paa">PAA (ECCV'2020)</a></li>
<li><a href="configs/vfnet">VarifocalNet (CVPR'2021)</a></li>
<li><a href="configs/sparse_rcnn">Sparse R-CNN (CVPR'2021)</a></li>
<li><a href="configs/yolof">YOLOF (CVPR'2021)</a></li>
<li><a href="configs/yolox">YOLOX (CVPR'2021)</a></li>
<li><a href="configs/deformable_detr">Deformable DETR (ICLR'2021)</a></li>
<li><a href="configs/tood">TOOD (ICCV'2021)</a></li>
<li><a href="configs/ddod">DDOD (ACM MM'2021)</a></li>
<li><a href="configs/rtmdet">RTMDet (ArXiv'2022)</a></li>
<li><a href="configs/conditional_detr">Conditional DETR (ICCV'2021)</a></li>
<li><a href="configs/dab_detr">DAB-DETR (ICLR'2022)</a></li>
<li><a href="configs/dino">DINO (ICLR'2023)</a></li>
<li><a href="configs/glip">GLIP (CVPR'2022)</a></li>
<li><a href="configs/ddq">DDQ (CVPR'2023)</a></li>
<li><a href="projects/DiffusionDet">DiffusionDet (ArXiv'2023)</a></li>
<li><a href="projects/EfficientDet">EfficientDet (CVPR'2020)</a></li>
<li><a href="projects/ViTDet">ViTDet (ECCV'2022)</a></li>
<li><a href="projects/Detic">Detic (ECCV'2022)</a></li>
<li><a href="projects/CO-DETR">CO-DETR (ICCV'2023)</a></li>
</ul>
</td>
<td>
<ul>
<li><a href="configs/mask_rcnn">Mask R-CNN (ICCV'2017)</a></li>
<li><a href="configs/cascade_rcnn">Cascade Mask R-CNN (CVPR'2018)</a></li>
<li><a href="configs/ms_rcnn">Mask Scoring R-CNN (CVPR'2019)</a></li>
<li><a href="configs/htc">Hybrid Task Cascade (CVPR'2019)</a></li>
<li><a href="configs/yolact">YOLACT (ICCV'2019)</a></li>
<li><a href="configs/instaboost">InstaBoost (ICCV'2019)</a></li>
<li><a href="configs/solo">SOLO (ECCV'2020)</a></li>
<li><a href="configs/point_rend">PointRend (CVPR'2020)</a></li>
<li><a href="configs/detectors">DetectoRS (ArXiv'2020)</a></li>
<li><a href="configs/solov2">SOLOv2 (NeurIPS'2020)</a></li>
<li><a href="configs/scnet">SCNet (AAAI'2021)</a></li>
<li><a href="configs/queryinst">QueryInst (ICCV'2021)</a></li>
<li><a href="configs/mask2former">Mask2Former (ArXiv'2021)</a></li>
<li><a href="configs/condinst">CondInst (ECCV'2020)</a></li>
<li><a href="projects/SparseInst">SparseInst (CVPR'2022)</a></li>
<li><a href="configs/rtmdet">RTMDet (ArXiv'2022)</a></li>
<li><a href="configs/boxinst">BoxInst (CVPR'2021)</a></li>
<li><a href="projects/ConvNeXt-V2">ConvNeXt-V2 (Arxiv'2023)</a></li>
</ul>
</td>
<td>
<ul>
<li><a href="configs/panoptic_fpn">Panoptic FPN (CVPR'2019)</a></li>
<li><a href="configs/maskformer">MaskFormer (NeurIPS'2021)</a></li>
<li><a href="configs/mask2former">Mask2Former (ArXiv'2021)</a></li>
<li><a href="configs/XDecoder">XDecoder (CVPR'2023)</a></li>
</ul>
</td>
<td>
</ul>
<li><b>Contrastive Learning</b></li>
<ul>
<ul>
<li><a href="configs/selfsup_pretrain">SwAV (NeurIPS'2020)</a></li>
<li><a href="configs/selfsup_pretrain">MoCo (CVPR'2020)</a></li>
<li><a href="configs/selfsup_pretrain">MoCov2 (ArXiv'2020)</a></li>
</ul>
</ul>
</ul>
<li><b>Distillation</b></li>
<ul>
<ul>
<li><a href="configs/ld">Localization Distillation (CVPR'2022)</a></li>
<li><a href="configs/lad">Label Assignment Distillation (WACV'2022)</a></li>
</ul>
</ul>
<li><b>Semi-Supervised Object Detection</b></li>
<ul>
<ul>
<li><a href="configs/soft_teacher">Soft Teacher (ICCV'2021)</a></li>
</ul>
</ul>
</ul>
</td>
</tr>
</td>
</tr>
</tbody>
</table>
<div align="center">
<b>Components</b>
</div>
<table align="center">
<tbody>
<tr align="center" valign="bottom">
<td>
<b>Backbones</b>
</td>
<td>
<b>Necks</b>
</td>
<td>
<b>Loss</b>
</td>
<td>
<b>Common</b>
</td>
</tr>
<tr valign="top">
<td>
<ul>
<li>VGG (ICLR'2015)</li>
<li>ResNet (CVPR'2016)</li>
<li>ResNeXt (CVPR'2017)</li>
<li>MobileNetV2 (CVPR'2018)</li>
<li><a href="configs/hrnet">HRNet (CVPR'2019)</a></li>
<li><a href="configs/empirical_attention">Generalized Attention (ICCV'2019)</a></li>
<li><a href="configs/gcnet">GCNet (ICCVW'2019)</a></li>
<li><a href="configs/res2net">Res2Net (TPAMI'2020)</a></li>
<li><a href="configs/regnet">RegNet (CVPR'2020)</a></li>
<li><a href="configs/resnest">ResNeSt (ArXiv'2020)</a></li>
<li><a href="configs/pvt">PVT (ICCV'2021)</a></li>
<li><a href="configs/swin">Swin (CVPR'2021)</a></li>
<li><a href="configs/pvt">PVTv2 (ArXiv'2021)</a></li>
<li><a href="configs/resnet_strikes_back">ResNet strikes back (ArXiv'2021)</a></li>
<li><a href="configs/efficientnet">EfficientNet (ArXiv'2021)</a></li>
<li><a href="configs/convnext">ConvNeXt (CVPR'2022)</a></li>
<li><a href="projects/ConvNeXt-V2">ConvNeXtv2 (ArXiv'2023)</a></li>
</ul>
</td>
<td>
<ul>
<li><a href="configs/pafpn">PAFPN (CVPR'2018)</a></li>
<li><a href="configs/nas_fpn">NAS-FPN (CVPR'2019)</a></li>
<li><a href="configs/carafe">CARAFE (ICCV'2019)</a></li>
<li><a href="configs/fpg">FPG (ArXiv'2020)</a></li>
<li><a href="configs/groie">GRoIE (ICPR'2020)</a></li>
<li><a href="configs/dyhead">DyHead (CVPR'2021)</a></li>
</ul>
</td>
<td>
<ul>
<li><a href="configs/ghm">GHM (AAAI'2019)</a></li>
<li><a href="configs/gfl">Generalized Focal Loss (NeurIPS'2020)</a></li>
<li><a href="configs/seesaw_loss">Seasaw Loss (CVPR'2021)</a></li>
</ul>
</td>
<td>
<ul>
<li><a href="configs/faster_rcnn/faster-rcnn_r50_fpn_ohem_1x_coco.py">OHEM (CVPR'2016)</a></li>
<li><a href="configs/gn">Group Normalization (ECCV'2018)</a></li>
<li><a href="configs/dcn">DCN (ICCV'2017)</a></li>
<li><a href="configs/dcnv2">DCNv2 (CVPR'2019)</a></li>
<li><a href="configs/gn+ws">Weight Standardization (ArXiv'2019)</a></li>
<li><a href="configs/pisa">Prime Sample Attention (CVPR'2020)</a></li>
<li><a href="configs/strong_baselines">Strong Baselines (CVPR'2021)</a></li>
<li><a href="configs/resnet_strikes_back">Resnet strikes back (ArXiv'2021)</a></li>
</ul>
</td>
</tr>
</td>
</tr>
</tbody>
</table>
Some other methods are also supported in [projects using MMDetection](./docs/en/notes/projects.md).
## FAQ
Please refer to [FAQ](docs/en/notes/faq.md) for frequently asked questions.
## Contributing
We appreciate all contributions to improve MMDetection. Ongoing projects can be found in out [GitHub Projects](https://github.com/open-mmlab/mmdetection/projects). Welcome community users to participate in these projects. Please refer to [CONTRIBUTING.md](.github/CONTRIBUTING.md) for the contributing guideline.
## Acknowledgement
MMDetection is an open source project that is contributed by researchers and engineers from various colleges and companies. We appreciate all the contributors who implement their methods or add new features, as well as users who give valuable feedbacks.
We wish that the toolbox and benchmark could serve the growing research community by providing a flexible toolkit to reimplement existing methods and develop their own new detectors.
## Citation
If you use this toolbox or benchmark in your research, please cite this project.
```
@article{mmdetection,
title = {{MMDetection}: Open MMLab Detection Toolbox and Benchmark},
author = {Chen, Kai and Wang, Jiaqi and Pang, Jiangmiao and Cao, Yuhang and
Xiong, Yu and Li, Xiaoxiao and Sun, Shuyang and Feng, Wansen and
Liu, Ziwei and Xu, Jiarui and Zhang, Zheng and Cheng, Dazhi and
Zhu, Chenchen and Cheng, Tianheng and Zhao, Qijie and Li, Buyu and
Lu, Xin and Zhu, Rui and Wu, Yue and Dai, Jifeng and Wang, Jingdong
and Shi, Jianping and Ouyang, Wanli and Loy, Chen Change and Lin, Dahua},
journal= {arXiv preprint arXiv:1906.07155},
year={2019}
}
```
## License
This project is released under the [Apache 2.0 license](LICENSE).
## Projects in OpenMMLab
- [MMEngine](https://github.com/open-mmlab/mmengine): OpenMMLab foundational library for training deep learning models.
- [MMCV](https://github.com/open-mmlab/mmcv): OpenMMLab foundational library for computer vision.
- [MMPreTrain](https://github.com/open-mmlab/mmpretrain): OpenMMLab pre-training toolbox and benchmark.
- [MMagic](https://github.com/open-mmlab/mmagic): Open**MM**Lab **A**dvanced, **G**enerative and **I**ntelligent **C**reation toolbox.
- [MMDetection](https://github.com/open-mmlab/mmdetection): OpenMMLab detection toolbox and benchmark.
- [MMDetection3D](https://github.com/open-mmlab/mmdetection3d): OpenMMLab's next-generation platform for general 3D object detection.
- [MMRotate](https://github.com/open-mmlab/mmrotate): OpenMMLab rotated object detection toolbox and benchmark.
- [MMYOLO](https://github.com/open-mmlab/mmyolo): OpenMMLab YOLO series toolbox and benchmark.
- [MMSegmentation](https://github.com/open-mmlab/mmsegmentation): OpenMMLab semantic segmentation toolbox and benchmark.
- [MMOCR](https://github.com/open-mmlab/mmocr): OpenMMLab text detection, recognition, and understanding toolbox.
- [MMPose](https://github.com/open-mmlab/mmpose): OpenMMLab pose estimation toolbox and benchmark.
- [MMHuman3D](https://github.com/open-mmlab/mmhuman3d): OpenMMLab 3D human parametric model toolbox and benchmark.
- [MMSelfSup](https://github.com/open-mmlab/mmselfsup): OpenMMLab self-supervised learning toolbox and benchmark.
- [MMRazor](https://github.com/open-mmlab/mmrazor): OpenMMLab model compression toolbox and benchmark.
- [MMFewShot](https://github.com/open-mmlab/mmfewshot): OpenMMLab fewshot learning toolbox and benchmark.
- [MMAction2](https://github.com/open-mmlab/mmaction2): OpenMMLab's next-generation action understanding toolbox and benchmark.
- [MMTracking](https://github.com/open-mmlab/mmtracking): OpenMMLab video perception toolbox and benchmark.
- [MMFlow](https://github.com/open-mmlab/mmflow): OpenMMLab optical flow toolbox and benchmark.
- [MMEditing](https://github.com/open-mmlab/mmediting): OpenMMLab image and video editing toolbox.
- [MMGeneration](https://github.com/open-mmlab/mmgeneration): OpenMMLab image and video generative models toolbox.
- [MMDeploy](https://github.com/open-mmlab/mmdeploy): OpenMMLab model deployment framework.
- [MIM](https://github.com/open-mmlab/mim): MIM installs OpenMMLab packages.
- [MMEval](https://github.com/open-mmlab/mmeval): A unified evaluation library for multiple machine learning libraries.
- [Playground](https://github.com/open-mmlab/playground): A central hub for gathering and showcasing amazing projects built upon OpenMMLab.
# co-detr_mmcv # co-detr_mmcv
## 论文
`DETRs with Collaborative Hybrid Assignments Training`<br>
[论文链接](https://arxiv.org/abs/2211.12860)<br>
## 模型结构
为了缓解解码器中较少的正向查询对编码器输出的稀疏监督,我们引入了具有不同一对多标签分配范式的通用辅助头,例如ATSS和Faster R-CNN。不同的标签分配丰富了对编码器输出的监督,这迫使它具有足够的鉴别力,以支持这些头部的训练收敛。
辅助分支只在训练时使用,推理时不需要。
![model_framework.png](asserts%2Fmodel_framework.png)
## 算法原理
co-detr通过增加辅助分支优化query稀疏问题--由于使用匈牙利批量,每个真值只能匹配1个query导致的。辅助分支利用一对多的样本匹配方法,比如atss,faster-rcnn等,一个真值匹配多个预测值,提高样本数量。
![model_head.png](asserts%2Fmodel_head.png)
## 环境配置
### Docker(方法一)
Co-DETR for learn more efficient and effective DETR-based detectors from versatile label assignment manners ```
\ No newline at end of file docker pull image.sourcefind.cn:5000/dcu/admin/base/pytorch:2.1.0-centos7.6-dtk24.04-py310
docker run -it -v /path/your_code_data/:/path/your_code_data/ -v /opt/hyhal/:/opt/hyhal/:ro --shm-size=80G --privileged=true --device=/dev/kfd --device=/dev/dri/ --group-add video --name docker_name imageID bash
cd /your_code_path/co-detr_mmcv
pip install mmdet -i https://mirrors.aliyun.com/pypi/simple/
```
### Dockerfile(方法二)
```
cd ./docker
docker build --no-cache -t mmdet:last .
docker run -it -v /path/your_code_data/:/path/your_code_data/ -v /opt/hyhal/:/opt/hyhal/:ro --shm-size=80G --privileged=true --device=/dev/kfd --device=/dev/dri/ --group-add video --name docker_name imageID bash
cd /your_code_path/co-detr_mmcv
pip install mmdet -i https://mirrors.aliyun.com/pypi/simple/
```
### Anaconda(方法三)
1、关于本项目DCU显卡所需的特殊深度学习库可从光合开发者社区下载安装: https://developer.hpccube.com/tool/
```
DTK软件栈: dtk24.04
python: python3.10
torch: 2.1
mmcv: 2.0.0
```
Tips:以上dtk软件栈、python、torch、mmcv等DCU相关工具版本需要严格一一对应
2、其他非特殊库直接按照requirements.txt安装
```
cd /your_code_path/co-detr_mmcv
pip install mmdet -i https://mirrors.aliyun.com/pypi/simple/
```
## 数据集
COCO2017(在网络良好的情况下,如果没有下载数据集,程序会默认在线下载数据集)
[训练数据](http://images.cocodataset.org/zips/train2017.zip)
[验证数据](http://images.cocodataset.org/zips/val2017.zip)
[测试数据](http://images.cocodataset.org/zips/test2017.zip)
[标签数据](https://github.com/ultralytics/yolov5/releases/download/v1.0/coco2017labels.zip)
数据集的目录结构如下:
```
├── images
│ ├── train2017
│ ├── val2017
│ ├── test2017
├── labels
│ ├── train2017
│ ├── val2017
├── annotations
│ ├── instances_val2017.json
├── LICENSE
├── README.txt
├── test-dev2017.txt
├── train2017.txt
├── val2017.txt
```
我们通过了mini数据集,供验证训练使用,如需正式使用,请下载完整COCO数据集或使用定制化数据集。
```bash
cd /your_code_path/co-detr_mmcv
cd datasets/
unzip coco_mini.zip
```
## 训练
- 数据集放置位置默认为当前目录下 datasets/
- 如需要变更数据集目录 请修改 [co_dino_5scale_r50_lsj_8xb2_1x_coco.py](projects%2FCO-DETR%2Fconfigs%2Fcodino%2Fco_dino_5scale_r50_lsj_8xb2_1x_coco.py)下的 data_root
### 单机单卡
```bash
cd /your_code_path/co-detr_mmcv
chmod -R 7777 train.sh
bash ./train.sh
```
### 单机四卡
```bash
cd /your_code_path/co-detr_mmcv
chmod -R 7777 train_multi.sh
bash ./train_multi.sh
```
## 推理
- 可使用官方模型权重进行推理,也可使用自己训练模型权重进行推理
- 这里以官方模型推理举例[[下载地址:co_dino_5scale_r50_lsj_8xb2_1x_coco-69a72d67.pth](https://download.openmmlab.com/mmdetection/v3.0/codetr/co_dino_5scale_r50_lsj_8xb2_1x_coco/co_dino_5scale_r50_lsj_8xb2_1x_coco-69a72d67.pth)]
```python
# 官方推理代码
python demo/image_demo.py demo/demo.jpg ./projects/CO-DETR/configs/codino/co_dino_5scale_r50_lsj_8xb2_1x_coco.py --weights co_dino_5scale_r50_lsj_8xb2_1x_coco-69a72d67.pth --device cuda
```
## result
![result.png](asserts%2Fresult.png)
### 精度
| 模型名称 | Backbone | Epochs | Aug | Dataset | amp混精 | Box AP |
|:-------:|:---------:|:------:|:---:|:-------:|:-----:|:------:|
| Co-detr | R50 | 12 | LSJ | COCO | on | 51.3 |
## 应用场景
### 算法类别
`目标检测`
### 热点应用行业
`金融,交通,教育`
## 源码仓库及问题反馈
- https://developer.hpccube.com/codes/modelzoo/co-detr_mmcv
## 参考资料
- https://github.com/open-mmlab/mmdetection/tree/main
<div align="center">
<img src="resources/mmdet-logo.png" width="600"/>
<div>&nbsp;</div>
<div align="center">
<b><font size="5">OpenMMLab 官网</font></b>
<sup>
<a href="https://openmmlab.com">
<i><font size="4">HOT</font></i>
</a>
</sup>
&nbsp;&nbsp;&nbsp;&nbsp;
<b><font size="5">OpenMMLab 开放平台</font></b>
<sup>
<a href="https://platform.openmmlab.com">
<i><font size="4">TRY IT OUT</font></i>
</a>
</sup>
</div>
<div>&nbsp;</div>
[![PyPI](https://img.shields.io/pypi/v/mmdet)](https://pypi.org/project/mmdet)
[![docs](https://img.shields.io/badge/docs-latest-blue)](https://mmdetection.readthedocs.io/en/latest/)
[![badge](https://github.com/open-mmlab/mmdetection/workflows/build/badge.svg)](https://github.com/open-mmlab/mmdetection/actions)
[![codecov](https://codecov.io/gh/open-mmlab/mmdetection/branch/main/graph/badge.svg)](https://codecov.io/gh/open-mmlab/mmdetection)
[![license](https://img.shields.io/github/license/open-mmlab/mmdetection.svg)](https://github.com/open-mmlab/mmdetection/blob/main/LICENSE)
[![open issues](https://isitmaintained.com/badge/open/open-mmlab/mmdetection.svg)](https://github.com/open-mmlab/mmdetection/issues)
[![issue resolution](https://isitmaintained.com/badge/resolution/open-mmlab/mmdetection.svg)](https://github.com/open-mmlab/mmdetection/issues)
[![Open in OpenXLab](https://cdn-static.openxlab.org.cn/app-center/openxlab_demo.svg)](https://openxlab.org.cn/apps?search=mmdet)
[📘使用文档](https://mmdetection.readthedocs.io/zh_CN/latest/) |
[🛠️安装教程](https://mmdetection.readthedocs.io/zh_CN/latest/get_started.html) |
[👀模型库](https://mmdetection.readthedocs.io/zh_CN/latest/model_zoo.html) |
[🆕更新日志](https://mmdetection.readthedocs.io/en/latest/notes/changelog.html) |
[🚀进行中的项目](https://github.com/open-mmlab/mmdetection/projects) |
[🤔报告问题](https://github.com/open-mmlab/mmdetection/issues/new/choose)
</div>
<div align="center">
[English](README.md) | 简体中文
</div>
<div align="center">
<a href="https://openmmlab.medium.com/" style="text-decoration:none;">
<img src="https://user-images.githubusercontent.com/25839884/219255827-67c1a27f-f8c5-46a9-811d-5e57448c61d1.png" width="3%" alt="" /></a>
<img src="https://user-images.githubusercontent.com/25839884/218346358-56cc8e2f-a2b8-487f-9088-32480cceabcf.png" width="3%" alt="" />
<a href="https://discord.com/channels/1037617289144569886/1046608014234370059" style="text-decoration:none;">
<img src="https://user-images.githubusercontent.com/25839884/218347213-c080267f-cbb6-443e-8532-8e1ed9a58ea9.png" width="3%" alt="" /></a>
<img src="https://user-images.githubusercontent.com/25839884/218346358-56cc8e2f-a2b8-487f-9088-32480cceabcf.png" width="3%" alt="" />
<a href="https://twitter.com/OpenMMLab" style="text-decoration:none;">
<img src="https://user-images.githubusercontent.com/25839884/218346637-d30c8a0f-3eba-4699-8131-512fb06d46db.png" width="3%" alt="" /></a>
<img src="https://user-images.githubusercontent.com/25839884/218346358-56cc8e2f-a2b8-487f-9088-32480cceabcf.png" width="3%" alt="" />
<a href="https://www.youtube.com/openmmlab" style="text-decoration:none;">
<img src="https://user-images.githubusercontent.com/25839884/218346691-ceb2116a-465a-40af-8424-9f30d2348ca9.png" width="3%" alt="" /></a>
<img src="https://user-images.githubusercontent.com/25839884/218346358-56cc8e2f-a2b8-487f-9088-32480cceabcf.png" width="3%" alt="" />
<a href="https://space.bilibili.com/1293512903" style="text-decoration:none;">
<img src="https://user-images.githubusercontent.com/25839884/219026751-d7d14cce-a7c9-4e82-9942-8375fca65b99.png" width="3%" alt="" /></a>
<img src="https://user-images.githubusercontent.com/25839884/218346358-56cc8e2f-a2b8-487f-9088-32480cceabcf.png" width="3%" alt="" />
<a href="https://www.zhihu.com/people/openmmlab" style="text-decoration:none;">
<img src="https://user-images.githubusercontent.com/25839884/219026120-ba71e48b-6e94-4bd4-b4e9-b7d175b5e362.png" width="3%" alt="" /></a>
</div>
<div align="center">
<img src="https://github.com/open-mmlab/mmdetection/assets/17425982/6c29886f-ae7a-4a55-8be4-352ee85b7d3e"/>
</div>
## 简介
MMDetection 是一个基于 PyTorch 的目标检测开源工具箱。它是 [OpenMMLab](https://openmmlab.com/) 项目的一部分。
主分支代码目前支持 PyTorch 1.8 及其以上的版本。
<img src="https://user-images.githubusercontent.com/12907710/187674113-2074d658-f2fb-42d1-ac15-9c4a695e64d7.png"/>
<details open>
<summary>主要特性</summary>
- **模块化设计**
MMDetection 将检测框架解耦成不同的模块组件,通过组合不同的模块组件,用户可以便捷地构建自定义的检测模型
- **支持多种检测任务**
MMDetection 支持了各种不同的检测任务,包括**目标检测****实例分割****全景分割**,以及**半监督目标检测**
- **速度快**
基本的框和 mask 操作都实现了 GPU 版本,训练速度比其他代码库更快或者相当,包括 [Detectron2](https://github.com/facebookresearch/detectron2), [maskrcnn-benchmark](https://github.com/facebookresearch/maskrcnn-benchmark)[SimpleDet](https://github.com/TuSimple/simpledet)
- **性能高**
MMDetection 这个算法库源自于 COCO 2018 目标检测竞赛的冠军团队 *MMDet* 团队开发的代码,我们在之后持续进行了改进和提升。
新发布的 [RTMDet](configs/rtmdet) 还在实时实例分割和旋转目标检测任务中取得了最先进的成果,同时也在目标检测模型中取得了最佳的的参数量和精度平衡。
</details>
除了 MMDetection 之外,我们还开源了深度学习训练库 [MMEngine](https://github.com/open-mmlab/mmengine) 和计算机视觉基础库 [MMCV](https://github.com/open-mmlab/mmcv),它们是 MMDetection 的主要依赖。
## 最新进展
💎 **我们已经发布了 MM-Grounding-DINO Swin-B 和 Swin-L 预训练权重,欢迎试用和反馈.**
### 亮点
**v3.3.0** 版本已经在 2024.1.5 发布:
**MM-Grounding-DINO: 轻松涨点,数据到评测全面开源**
Grounding DINO 是一个统一了 2d 开放词汇目标检测和 Phrase Grounding 的检测预训练模型,应用广泛,但是其训练部分并未开源,为此提出了 MM-Grounding-DINO。其不仅作为 Grounding DINO 的开源复现版,MM-Grounding-DINO 基于重新构建的数据类型出发,在探索了不同数据集组合和初始化策略基础上实现了 Grounding DINO 的性能极大提升,并且从多个维度包括 OOD、REC、Phrase Grounding、OVD 和 Finetune 等方面进行评测,充分挖掘 Grounding 预训练优缺点,希望能为后续工作提供启发。
arxiv 技术报告:https://arxiv.org/abs/2401.02361
代码地址: [mm_grounding_dino/README.md](configs/mm_grounding_dino/README.md)
<div align=center>
<img src="https://github.com/open-mmlab/mmdetection/assets/17425982/fb14d1ee-5469-44d2-b865-aac9850c429c"/>
</div>
我们很高兴向大家介绍我们在实时目标识别任务方面的最新成果 RTMDet,包含了一系列的全卷积单阶段检测模型。 RTMDet 不仅在从 tiny 到 extra-large 尺寸的目标检测模型上实现了最佳的参数量和精度的平衡,而且在实时实例分割和旋转目标检测任务上取得了最先进的成果。 更多细节请参阅[技术报告](https://arxiv.org/abs/2212.07784)。 预训练模型可以在[这里](configs/rtmdet)找到。
[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/rtmdet-an-empirical-study-of-designing-real/real-time-instance-segmentation-on-mscoco)](https://paperswithcode.com/sota/real-time-instance-segmentation-on-mscoco?p=rtmdet-an-empirical-study-of-designing-real)
[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/rtmdet-an-empirical-study-of-designing-real/object-detection-in-aerial-images-on-dota-1)](https://paperswithcode.com/sota/object-detection-in-aerial-images-on-dota-1?p=rtmdet-an-empirical-study-of-designing-real)
[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/rtmdet-an-empirical-study-of-designing-real/object-detection-in-aerial-images-on-hrsc2016)](https://paperswithcode.com/sota/object-detection-in-aerial-images-on-hrsc2016?p=rtmdet-an-empirical-study-of-designing-real)
| Task | Dataset | AP | FPS(TRT FP16 BS1 3090) |
| ------------------------ | ------- | ------------------------------------ | ---------------------- |
| Object Detection | COCO | 52.8 | 322 |
| Instance Segmentation | COCO | 44.6 | 188 |
| Rotated Object Detection | DOTA | 78.9(single-scale)/81.3(multi-scale) | 121 |
<div align=center>
<img src="https://user-images.githubusercontent.com/12907710/208044554-1e8de6b5-48d8-44e4-a7b5-75076c7ebb71.png"/>
</div>
## 安装
请参考[快速入门文档](https://mmdetection.readthedocs.io/zh_CN/latest/get_started.html)进行安装。
## 教程
请阅读[概述](https://mmdetection.readthedocs.io/zh_CN/latest/get_started.html)对 MMDetection 进行初步的了解。
为了帮助用户更进一步了解 MMDetection,我们准备了用户指南和进阶指南,请阅读我们的[文档](https://mmdetection.readthedocs.io/zh_CN/latest/)
- 用户指南
<details>
- [训练 & 测试](https://mmdetection.readthedocs.io/zh_CN/latest/user_guides/index.html#train-test)
- [学习配置文件](https://mmdetection.readthedocs.io/zh_CN/latest/user_guides/config.html)
- [使用已有模型在标准数据集上进行推理](https://mmdetection.readthedocs.io/en/latest/user_guides/inference.html)
- [数据集准备](https://mmdetection.readthedocs.io/zh_CN/latest/user_guides/dataset_prepare.html)
- [测试现有模型](https://mmdetection.readthedocs.io/zh_CN/latest/user_guides/test.html)
- [在标准数据集上训练预定义的模型](https://mmdetection.readthedocs.io/zh_CN/latest/user_guides/train.html)
- [在自定义数据集上进行训练](https://mmdetection.readthedocs.io/zh_CN/latest/user_guides/train.html#train-with-customized-datasets)
- [在标准数据集上训练自定义模型](https://mmdetection.readthedocs.io/zh_CN/latest/user_guides/new_model.html)
- [模型微调](https://mmdetection.readthedocs.io/zh_CN/latest/user_guides/finetune.html)
- [提交测试结果](https://mmdetection.readthedocs.io/zh_CN/latest/user_guides/test_results_submission.html)
- [权重初始化](https://mmdetection.readthedocs.io/zh_CN/latest/user_guides/init_cfg.html)
- [将单阶段检测器作为 RPN](https://mmdetection.readthedocs.io/zh_CN/latest/user_guides/single_stage_as_rpn.html)
- [半监督目标检测](https://mmdetection.readthedocs.io/zh_CN/latest/user_guides/semi_det.html)
- [实用工具](https://mmdetection.readthedocs.io/zh_CN/latest/user_guides/index.html#useful-tools)
</details>
- 进阶指南
<details>
- [基础概念](https://mmdetection.readthedocs.io/zh_CN/latest/advanced_guides/index.html#basic-concepts)
- [组件定制](https://mmdetection.readthedocs.io/zh_CN/latest/advanced_guides/index.html#component-customization)
- [How to](https://mmdetection.readthedocs.io/zh_CN/latest/advanced_guides/index.html#how-to)
</details>
我们提供了检测的 colab 教程 [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](demo/MMDet_Tutorial.ipynb) 和 实例分割的 colab 教程 [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](demo/MMDet_Tutorial.ipynb)
同时,我们还提供了 [MMDetection 中文解读文案汇总](docs/zh_cn/article.md)
若需要将2.x版本的代码迁移至新版,请参考[迁移文档](https://mmdetection.readthedocs.io/en/latest/migration.html)
## 基准测试和模型库
测试结果和模型可以在[模型库](docs/zh_cn/model_zoo.md)中找到。
<div align="center">
<b>算法架构</b>
</div>
<table align="center">
<tbody>
<tr align="center" valign="bottom">
<td>
<b>Object Detection</b>
</td>
<td>
<b>Instance Segmentation</b>
</td>
<td>
<b>Panoptic Segmentation</b>
</td>
<td>
<b>Other</b>
</td>
</tr>
<tr valign="top">
<td>
<ul>
<li><a href="configs/fast_rcnn">Fast R-CNN (ICCV'2015)</a></li>
<li><a href="configs/faster_rcnn">Faster R-CNN (NeurIPS'2015)</a></li>
<li><a href="configs/rpn">RPN (NeurIPS'2015)</a></li>
<li><a href="configs/ssd">SSD (ECCV'2016)</a></li>
<li><a href="configs/retinanet">RetinaNet (ICCV'2017)</a></li>
<li><a href="configs/cascade_rcnn">Cascade R-CNN (CVPR'2018)</a></li>
<li><a href="configs/yolo">YOLOv3 (ArXiv'2018)</a></li>
<li><a href="configs/cornernet">CornerNet (ECCV'2018)</a></li>
<li><a href="configs/grid_rcnn">Grid R-CNN (CVPR'2019)</a></li>
<li><a href="configs/guided_anchoring">Guided Anchoring (CVPR'2019)</a></li>
<li><a href="configs/fsaf">FSAF (CVPR'2019)</a></li>
<li><a href="configs/centernet">CenterNet (CVPR'2019)</a></li>
<li><a href="configs/libra_rcnn">Libra R-CNN (CVPR'2019)</a></li>
<li><a href="configs/tridentnet">TridentNet (ICCV'2019)</a></li>
<li><a href="configs/fcos">FCOS (ICCV'2019)</a></li>
<li><a href="configs/reppoints">RepPoints (ICCV'2019)</a></li>
<li><a href="configs/free_anchor">FreeAnchor (NeurIPS'2019)</a></li>
<li><a href="configs/cascade_rpn">CascadeRPN (NeurIPS'2019)</a></li>
<li><a href="configs/foveabox">Foveabox (TIP'2020)</a></li>
<li><a href="configs/double_heads">Double-Head R-CNN (CVPR'2020)</a></li>
<li><a href="configs/atss">ATSS (CVPR'2020)</a></li>
<li><a href="configs/nas_fcos">NAS-FCOS (CVPR'2020)</a></li>
<li><a href="configs/centripetalnet">CentripetalNet (CVPR'2020)</a></li>
<li><a href="configs/autoassign">AutoAssign (ArXiv'2020)</a></li>
<li><a href="configs/sabl">Side-Aware Boundary Localization (ECCV'2020)</a></li>
<li><a href="configs/dynamic_rcnn">Dynamic R-CNN (ECCV'2020)</a></li>
<li><a href="configs/detr">DETR (ECCV'2020)</a></li>
<li><a href="configs/paa">PAA (ECCV'2020)</a></li>
<li><a href="configs/vfnet">VarifocalNet (CVPR'2021)</a></li>
<li><a href="configs/sparse_rcnn">Sparse R-CNN (CVPR'2021)</a></li>
<li><a href="configs/yolof">YOLOF (CVPR'2021)</a></li>
<li><a href="configs/yolox">YOLOX (CVPR'2021)</a></li>
<li><a href="configs/deformable_detr">Deformable DETR (ICLR'2021)</a></li>
<li><a href="configs/tood">TOOD (ICCV'2021)</a></li>
<li><a href="configs/ddod">DDOD (ACM MM'2021)</a></li>
<li><a href="configs/rtmdet">RTMDet (ArXiv'2022)</a></li>
<li><a href="configs/conditional_detr">Conditional DETR (ICCV'2021)</a></li>
<li><a href="configs/dab_detr">DAB-DETR (ICLR'2022)</a></li>
<li><a href="configs/dino">DINO (ICLR'2023)</a></li>
<li><a href="configs/glip">GLIP (CVPR'2022)</a></li>
<li><a href="configs/ddq">DDQ (CVPR'2023)</a></li>
<li><a href="projects/DiffusionDet">DiffusionDet (ArXiv'2023)</a></li>
<li><a href="projects/EfficientDet">EfficientDet (CVPR'2020)</a></li>
<li><a href="projects/ViTDet">ViTDet (ECCV'2022)</a></li>
<li><a href="projects/Detic">Detic (ECCV'2022)</a></li>
<li><a href="projects/CO-DETR">CO-DETR (ICCV'2023)</a></li>
</ul>
</td>
<td>
<ul>
<li><a href="configs/mask_rcnn">Mask R-CNN (ICCV'2017)</a></li>
<li><a href="configs/cascade_rcnn">Cascade Mask R-CNN (CVPR'2018)</a></li>
<li><a href="configs/ms_rcnn">Mask Scoring R-CNN (CVPR'2019)</a></li>
<li><a href="configs/htc">Hybrid Task Cascade (CVPR'2019)</a></li>
<li><a href="configs/yolact">YOLACT (ICCV'2019)</a></li>
<li><a href="configs/instaboost">InstaBoost (ICCV'2019)</a></li>
<li><a href="configs/solo">SOLO (ECCV'2020)</a></li>
<li><a href="configs/point_rend">PointRend (CVPR'2020)</a></li>
<li><a href="configs/detectors">DetectoRS (ArXiv'2020)</a></li>
<li><a href="configs/solov2">SOLOv2 (NeurIPS'2020)</a></li>
<li><a href="configs/scnet">SCNet (AAAI'2021)</a></li>
<li><a href="configs/queryinst">QueryInst (ICCV'2021)</a></li>
<li><a href="configs/mask2former">Mask2Former (ArXiv'2021)</a></li>
<li><a href="configs/condinst">CondInst (ECCV'2020)</a></li>
<li><a href="projects/SparseInst">SparseInst (CVPR'2022)</a></li>
<li><a href="configs/rtmdet">RTMDet (ArXiv'2022)</a></li>
<li><a href="configs/boxinst">BoxInst (CVPR'2021)</a></li>
<li><a href="projects/ConvNeXt-V2">ConvNeXt-V2 (Arxiv'2023)</a></li>
</ul>
</td>
<td>
<ul>
<li><a href="configs/panoptic_fpn">Panoptic FPN (CVPR'2019)</a></li>
<li><a href="configs/maskformer">MaskFormer (NeurIPS'2021)</a></li>
<li><a href="configs/mask2former">Mask2Former (ArXiv'2021)</a></li>
<li><a href="configs/XDecoder">XDecoder (CVPR'2023)</a></li>
</ul>
</td>
<td>
</ul>
<li><b>Contrastive Learning</b></li>
<ul>
<ul>
<li><a href="configs/selfsup_pretrain">SwAV (NeurIPS'2020)</a></li>
<li><a href="configs/selfsup_pretrain">MoCo (CVPR'2020)</a></li>
<li><a href="configs/selfsup_pretrain">MoCov2 (ArXiv'2020)</a></li>
</ul>
</ul>
</ul>
<li><b>Distillation</b></li>
<ul>
<ul>
<li><a href="configs/ld">Localization Distillation (CVPR'2022)</a></li>
<li><a href="configs/lad">Label Assignment Distillation (WACV'2022)</a></li>
</ul>
</ul>
<li><b>Semi-Supervised Object Detection</b></li>
<ul>
<ul>
<li><a href="configs/soft_teacher">Soft Teacher (ICCV'2021)</a></li>
</ul>
</ul>
</ul>
</td>
</tr>
</td>
</tr>
</tbody>
</table>
<div align="center">
<b>模块组件</b>
</div>
<table align="center">
<tbody>
<tr align="center" valign="bottom">
<td>
<b>Backbones</b>
</td>
<td>
<b>Necks</b>
</td>
<td>
<b>Loss</b>
</td>
<td>
<b>Common</b>
</td>
</tr>
<tr valign="top">
<td>
<ul>
<li>VGG (ICLR'2015)</li>
<li>ResNet (CVPR'2016)</li>
<li>ResNeXt (CVPR'2017)</li>
<li>MobileNetV2 (CVPR'2018)</li>
<li><a href="configs/hrnet">HRNet (CVPR'2019)</a></li>
<li><a href="configs/empirical_attention">Generalized Attention (ICCV'2019)</a></li>
<li><a href="configs/gcnet">GCNet (ICCVW'2019)</a></li>
<li><a href="configs/res2net">Res2Net (TPAMI'2020)</a></li>
<li><a href="configs/regnet">RegNet (CVPR'2020)</a></li>
<li><a href="configs/resnest">ResNeSt (ArXiv'2020)</a></li>
<li><a href="configs/pvt">PVT (ICCV'2021)</a></li>
<li><a href="configs/swin">Swin (CVPR'2021)</a></li>
<li><a href="configs/pvt">PVTv2 (ArXiv'2021)</a></li>
<li><a href="configs/resnet_strikes_back">ResNet strikes back (ArXiv'2021)</a></li>
<li><a href="configs/efficientnet">EfficientNet (ArXiv'2021)</a></li>
<li><a href="configs/convnext">ConvNeXt (CVPR'2022)</a></li>
<li><a href="projects/ConvNeXt-V2">ConvNeXtv2 (ArXiv'2023)</a></li>
</ul>
</td>
<td>
<ul>
<li><a href="configs/pafpn">PAFPN (CVPR'2018)</a></li>
<li><a href="configs/nas_fpn">NAS-FPN (CVPR'2019)</a></li>
<li><a href="configs/carafe">CARAFE (ICCV'2019)</a></li>
<li><a href="configs/fpg">FPG (ArXiv'2020)</a></li>
<li><a href="configs/groie">GRoIE (ICPR'2020)</a></li>
<li><a href="configs/dyhead">DyHead (CVPR'2021)</a></li>
</ul>
</td>
<td>
<ul>
<li><a href="configs/ghm">GHM (AAAI'2019)</a></li>
<li><a href="configs/gfl">Generalized Focal Loss (NeurIPS'2020)</a></li>
<li><a href="configs/seesaw_loss">Seasaw Loss (CVPR'2021)</a></li>
</ul>
</td>
<td>
<ul>
<li><a href="configs/faster_rcnn/faster_rcnn_r50_fpn_ohem_1x_coco.py">OHEM (CVPR'2016)</a></li>
<li><a href="configs/gn">Group Normalization (ECCV'2018)</a></li>
<li><a href="configs/dcn">DCN (ICCV'2017)</a></li>
<li><a href="configs/dcnv2">DCNv2 (CVPR'2019)</a></li>
<li><a href="configs/gn+ws">Weight Standardization (ArXiv'2019)</a></li>
<li><a href="configs/pisa">Prime Sample Attention (CVPR'2020)</a></li>
<li><a href="configs/strong_baselines">Strong Baselines (CVPR'2021)</a></li>
<li><a href="configs/resnet_strikes_back">Resnet strikes back (ArXiv'2021)</a></li>
</ul>
</td>
</tr>
</td>
</tr>
</tbody>
</table>
我们在[基于 MMDetection 的项目](./docs/zh_cn/notes/projects.md)中列举了一些其他的支持的算法。
## 常见问题
请参考 [FAQ](docs/zh_cn/notes/faq.md) 了解其他用户的常见问题。
## 贡献指南
我们感谢所有的贡献者为改进和提升 MMDetection 所作出的努力。我们将正在进行中的项目添加进了[GitHub Projects](https://github.com/open-mmlab/mmdetection/projects)页面,非常欢迎社区用户能参与进这些项目中来。请参考[贡献指南](.github/CONTRIBUTING.md)来了解参与项目贡献的相关指引。
## 致谢
MMDetection 是一款由来自不同高校和企业的研发人员共同参与贡献的开源项目。我们感谢所有为项目提供算法复现和新功能支持的贡献者,以及提供宝贵反馈的用户。 我们希望这个工具箱和基准测试可以为社区提供灵活的代码工具,供用户复现已有算法并开发自己的新模型,从而不断为开源社区提供贡献。
## 引用
如果你在研究中使用了本项目的代码或者性能基准,请参考如下 bibtex 引用 MMDetection。
```
@article{mmdetection,
title = {{MMDetection}: Open MMLab Detection Toolbox and Benchmark},
author = {Chen, Kai and Wang, Jiaqi and Pang, Jiangmiao and Cao, Yuhang and
Xiong, Yu and Li, Xiaoxiao and Sun, Shuyang and Feng, Wansen and
Liu, Ziwei and Xu, Jiarui and Zhang, Zheng and Cheng, Dazhi and
Zhu, Chenchen and Cheng, Tianheng and Zhao, Qijie and Li, Buyu and
Lu, Xin and Zhu, Rui and Wu, Yue and Dai, Jifeng and Wang, Jingdong
and Shi, Jianping and Ouyang, Wanli and Loy, Chen Change and Lin, Dahua},
journal= {arXiv preprint arXiv:1906.07155},
year={2019}
}
```
## 开源许可证
该项目采用 [Apache 2.0 开源许可证](LICENSE)
## OpenMMLab 的其他项目
- [MMEngine](https://github.com/open-mmlab/mmengine): OpenMMLab 深度学习模型训练基础库
- [MMCV](https://github.com/open-mmlab/mmcv): OpenMMLab 计算机视觉基础库
- [MMPreTrain](https://github.com/open-mmlab/mmpretrain): OpenMMLab 深度学习预训练工具箱
- [MMagic](https://github.com/open-mmlab/mmagic): OpenMMLab 新一代人工智能内容生成(AIGC)工具箱
- [MMDetection](https://github.com/open-mmlab/mmdetection): OpenMMLab 目标检测工具箱
- [MMDetection3D](https://github.com/open-mmlab/mmdetection3d): OpenMMLab 新一代通用 3D 目标检测平台
- [MMRotate](https://github.com/open-mmlab/mmrotate): OpenMMLab 旋转框检测工具箱与测试基准
- [MMYOLO](https://github.com/open-mmlab/mmyolo): OpenMMLab YOLO 系列工具箱与测试基准
- [MMSegmentation](https://github.com/open-mmlab/mmsegmentation): OpenMMLab 语义分割工具箱
- [MMOCR](https://github.com/open-mmlab/mmocr): OpenMMLab 全流程文字检测识别理解工具包
- [MMPose](https://github.com/open-mmlab/mmpose): OpenMMLab 姿态估计工具箱
- [MMHuman3D](https://github.com/open-mmlab/mmhuman3d): OpenMMLab 人体参数化模型工具箱与测试基准
- [MMSelfSup](https://github.com/open-mmlab/mmselfsup): OpenMMLab 自监督学习工具箱与测试基准
- [MMRazor](https://github.com/open-mmlab/mmrazor): OpenMMLab 模型压缩工具箱与测试基准
- [MMFewShot](https://github.com/open-mmlab/mmfewshot): OpenMMLab 少样本学习工具箱与测试基准
- [MMAction2](https://github.com/open-mmlab/mmaction2): OpenMMLab 新一代视频理解工具箱
- [MMTracking](https://github.com/open-mmlab/mmtracking): OpenMMLab 一体化视频目标感知平台
- [MMFlow](https://github.com/open-mmlab/mmflow): OpenMMLab 光流估计工具箱与测试基准
- [MMEditing](https://github.com/open-mmlab/mmediting): OpenMMLab 图像视频编辑工具箱
- [MMGeneration](https://github.com/open-mmlab/mmgeneration): OpenMMLab 图片视频生成模型工具箱
- [MMDeploy](https://github.com/open-mmlab/mmdeploy): OpenMMLab 模型部署框架
- [MIM](https://github.com/open-mmlab/mim): OpenMMlab 项目、算法、模型的统一入口
- [MMEval](https://github.com/open-mmlab/mmeval): 统一开放的跨框架算法评测库
- [Playground](https://github.com/open-mmlab/playground): 收集和展示 OpenMMLab 相关的前沿、有趣的社区项目
## 欢迎加入 OpenMMLab 社区
扫描下方的二维码可关注 OpenMMLab 团队的 [知乎官方账号](https://www.zhihu.com/people/openmmlab),扫描下方微信二维码添加喵喵好友,进入 MMDectection 微信交流社群。【加好友申请格式:研究方向+地区+学校/公司+姓名】
<div align="center">
<img src="resources/zhihu_qrcode.jpg" height="400" /> <img src="resources/miaomiao_qrcode.jpg" height="400" />
</div>
我们会在 OpenMMLab 社区为大家
- 📢 分享 AI 框架的前沿核心技术
- 💻 解读 PyTorch 常用模块源码
- 📰 发布 OpenMMLab 的相关新闻
- 🚀 介绍 OpenMMLab 开发的前沿算法
- 🏃 获取更高效的问题答疑和意见反馈
- 🔥 提供与各行各业开发者充分交流的平台
干货满满 📘,等你来撩 💗,OpenMMLab 社区期待您的加入 👬
# dataset settings
dataset_type = 'ADE20KInstanceDataset'
data_root = 'data/ADEChallengeData2016/'
# Example to use different file client
# Method 1: simply set the data root and let the file I/O module
# automatically infer from prefix (not support LMDB and Memcache yet)
# data_root = 's3://openmmlab/datasets/detection/ADEChallengeData2016/'
# Method 2: Use `backend_args`, `file_client_args` in versions before 3.0.0rc6
# backend_args = dict(
# backend='petrel',
# path_mapping=dict({
# './data/': 's3://openmmlab/datasets/detection/',
# 'data/': 's3://openmmlab/datasets/detection/'
# }))
backend_args = None
test_pipeline = [
dict(type='LoadImageFromFile', backend_args=backend_args),
dict(type='Resize', scale=(2560, 640), keep_ratio=True),
# If you don't have a gt annotation, delete the pipeline
dict(type='LoadAnnotations', with_bbox=True, with_mask=True),
dict(
type='PackDetInputs',
meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
'scale_factor'))
]
val_dataloader = dict(
batch_size=1,
num_workers=2,
persistent_workers=True,
drop_last=False,
sampler=dict(type='DefaultSampler', shuffle=False),
dataset=dict(
type=dataset_type,
data_root=data_root,
ann_file='ade20k_instance_val.json',
data_prefix=dict(img='images/validation'),
test_mode=True,
pipeline=test_pipeline,
backend_args=backend_args))
test_dataloader = val_dataloader
val_evaluator = dict(
type='CocoMetric',
ann_file=data_root + 'ade20k_instance_val.json',
metric=['bbox', 'segm'],
format_only=False,
backend_args=backend_args)
test_evaluator = val_evaluator
# dataset settings
dataset_type = 'ADE20KPanopticDataset'
data_root = 'data/ADEChallengeData2016/'
backend_args = None
test_pipeline = [
dict(type='LoadImageFromFile', backend_args=backend_args),
dict(type='Resize', scale=(2560, 640), keep_ratio=True),
dict(type='LoadPanopticAnnotations', backend_args=backend_args),
dict(
type='PackDetInputs',
meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
'scale_factor'))
]
val_dataloader = dict(
batch_size=1,
num_workers=0,
persistent_workers=False,
drop_last=False,
sampler=dict(type='DefaultSampler', shuffle=False),
dataset=dict(
type=dataset_type,
data_root=data_root,
ann_file='ade20k_panoptic_val.json',
data_prefix=dict(img='images/validation/', seg='ade20k_panoptic_val/'),
test_mode=True,
pipeline=test_pipeline,
backend_args=backend_args))
test_dataloader = val_dataloader
val_evaluator = dict(
type='CocoPanopticMetric',
ann_file=data_root + 'ade20k_panoptic_val.json',
seg_prefix=data_root + 'ade20k_panoptic_val/',
backend_args=backend_args)
test_evaluator = val_evaluator
dataset_type = 'ADE20KSegDataset'
data_root = 'data/ADEChallengeData2016/'
# Example to use different file client
# Method 1: simply set the data root and let the file I/O module
# automatically infer from prefix (not support LMDB and Memcache yet)
# data_root = 's3://openmmlab/datasets/detection/ADEChallengeData2016/'
# Method 2: Use `backend_args`, `file_client_args` in versions before 3.0.0rc6
# backend_args = dict(
# backend='petrel',
# path_mapping=dict({
# './data/': 's3://openmmlab/datasets/detection/',
# 'data/': 's3://openmmlab/datasets/detection/'
# }))
backend_args = None
test_pipeline = [
dict(type='LoadImageFromFile', backend_args=backend_args),
dict(type='Resize', scale=(2048, 512), keep_ratio=True),
dict(
type='LoadAnnotations',
with_bbox=False,
with_mask=False,
with_seg=True,
reduce_zero_label=True),
dict(
type='PackDetInputs', meta_keys=('img_path', 'ori_shape', 'img_shape'))
]
val_dataloader = dict(
batch_size=1,
num_workers=2,
persistent_workers=True,
drop_last=False,
sampler=dict(type='DefaultSampler', shuffle=False),
dataset=dict(
type=dataset_type,
data_root=data_root,
data_prefix=dict(
img_path='images/validation',
seg_map_path='annotations/validation'),
pipeline=test_pipeline))
test_dataloader = val_dataloader
val_evaluator = dict(type='SemSegMetric', iou_metrics=['mIoU'])
test_evaluator = val_evaluator
# dataset settings
dataset_type = 'CityscapesDataset'
data_root = 'data/cityscapes/'
# Example to use different file client
# Method 1: simply set the data root and let the file I/O module
# automatically infer from prefix (not support LMDB and Memcache yet)
# data_root = 's3://openmmlab/datasets/segmentation/cityscapes/'
# Method 2: Use `backend_args`, `file_client_args` in versions before 3.0.0rc6
# backend_args = dict(
# backend='petrel',
# path_mapping=dict({
# './data/': 's3://openmmlab/datasets/segmentation/',
# 'data/': 's3://openmmlab/datasets/segmentation/'
# }))
backend_args = None
train_pipeline = [
dict(type='LoadImageFromFile', backend_args=backend_args),
dict(type='LoadAnnotations', with_bbox=True),
dict(
type='RandomResize',
scale=[(2048, 800), (2048, 1024)],
keep_ratio=True),
dict(type='RandomFlip', prob=0.5),
dict(type='PackDetInputs')
]
test_pipeline = [
dict(type='LoadImageFromFile', backend_args=backend_args),
dict(type='Resize', scale=(2048, 1024), keep_ratio=True),
# If you don't have a gt annotation, delete the pipeline
dict(type='LoadAnnotations', with_bbox=True),
dict(
type='PackDetInputs',
meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
'scale_factor'))
]
train_dataloader = dict(
batch_size=1,
num_workers=2,
persistent_workers=True,
sampler=dict(type='DefaultSampler', shuffle=True),
batch_sampler=dict(type='AspectRatioBatchSampler'),
dataset=dict(
type='RepeatDataset',
times=8,
dataset=dict(
type=dataset_type,
data_root=data_root,
ann_file='annotations/instancesonly_filtered_gtFine_train.json',
data_prefix=dict(img='leftImg8bit/train/'),
filter_cfg=dict(filter_empty_gt=True, min_size=32),
pipeline=train_pipeline,
backend_args=backend_args)))
val_dataloader = dict(
batch_size=1,
num_workers=2,
persistent_workers=True,
drop_last=False,
sampler=dict(type='DefaultSampler', shuffle=False),
dataset=dict(
type=dataset_type,
data_root=data_root,
ann_file='annotations/instancesonly_filtered_gtFine_val.json',
data_prefix=dict(img='leftImg8bit/val/'),
test_mode=True,
filter_cfg=dict(filter_empty_gt=True, min_size=32),
pipeline=test_pipeline,
backend_args=backend_args))
test_dataloader = val_dataloader
val_evaluator = dict(
type='CocoMetric',
ann_file=data_root + 'annotations/instancesonly_filtered_gtFine_val.json',
metric='bbox',
backend_args=backend_args)
test_evaluator = val_evaluator
# dataset settings
dataset_type = 'CityscapesDataset'
data_root = 'data/cityscapes/'
# Example to use different file client
# Method 1: simply set the data root and let the file I/O module
# automatically infer from prefix (not support LMDB and Memcache yet)
# data_root = 's3://openmmlab/datasets/segmentation/cityscapes/'
# Method 2: Use backend_args, file_client_args in versions before 3.0.0rc6
# backend_args = dict(
# backend='petrel',
# path_mapping=dict({
# './data/': 's3://openmmlab/datasets/segmentation/',
# 'data/': 's3://openmmlab/datasets/segmentation/'
# }))
backend_args = None
train_pipeline = [
dict(type='LoadImageFromFile', backend_args=backend_args),
dict(type='LoadAnnotations', with_bbox=True, with_mask=True),
dict(
type='RandomResize',
scale=[(2048, 800), (2048, 1024)],
keep_ratio=True),
dict(type='RandomFlip', prob=0.5),
dict(type='PackDetInputs')
]
test_pipeline = [
dict(type='LoadImageFromFile', backend_args=backend_args),
dict(type='Resize', scale=(2048, 1024), keep_ratio=True),
# If you don't have a gt annotation, delete the pipeline
dict(type='LoadAnnotations', with_bbox=True, with_mask=True),
dict(
type='PackDetInputs',
meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
'scale_factor'))
]
train_dataloader = dict(
batch_size=1,
num_workers=2,
persistent_workers=True,
sampler=dict(type='DefaultSampler', shuffle=True),
batch_sampler=dict(type='AspectRatioBatchSampler'),
dataset=dict(
type='RepeatDataset',
times=8,
dataset=dict(
type=dataset_type,
data_root=data_root,
ann_file='annotations/instancesonly_filtered_gtFine_train.json',
data_prefix=dict(img='leftImg8bit/train/'),
filter_cfg=dict(filter_empty_gt=True, min_size=32),
pipeline=train_pipeline,
backend_args=backend_args)))
val_dataloader = dict(
batch_size=1,
num_workers=2,
persistent_workers=True,
drop_last=False,
sampler=dict(type='DefaultSampler', shuffle=False),
dataset=dict(
type=dataset_type,
data_root=data_root,
ann_file='annotations/instancesonly_filtered_gtFine_val.json',
data_prefix=dict(img='leftImg8bit/val/'),
test_mode=True,
filter_cfg=dict(filter_empty_gt=True, min_size=32),
pipeline=test_pipeline,
backend_args=backend_args))
test_dataloader = val_dataloader
val_evaluator = [
dict(
type='CocoMetric',
ann_file=data_root +
'annotations/instancesonly_filtered_gtFine_val.json',
metric=['bbox', 'segm'],
backend_args=backend_args),
dict(
type='CityScapesMetric',
seg_prefix=data_root + 'gtFine/val',
outfile_prefix='./work_dirs/cityscapes_metric/instance',
backend_args=backend_args)
]
test_evaluator = val_evaluator
# inference on test dataset and
# format the output results for submission.
# test_dataloader = dict(
# batch_size=1,
# num_workers=2,
# persistent_workers=True,
# drop_last=False,
# sampler=dict(type='DefaultSampler', shuffle=False),
# dataset=dict(
# type=dataset_type,
# data_root=data_root,
# ann_file='annotations/instancesonly_filtered_gtFine_test.json',
# data_prefix=dict(img='leftImg8bit/test/'),
# test_mode=True,
# filter_cfg=dict(filter_empty_gt=True, min_size=32),
# pipeline=test_pipeline))
# test_evaluator = dict(
# type='CityScapesMetric',
# format_only=True,
# outfile_prefix='./work_dirs/cityscapes_metric/test')
# data settings
dataset_type = 'CocoCaptionDataset'
data_root = 'data/coco/'
# Example to use different file client
# Method 1: simply set the data root and let the file I/O module
# automatically infer from prefix (not support LMDB and Memcache yet)
# data_root = 's3://openmmlab/datasets/detection/coco/'
# Method 2: Use `backend_args`, `file_client_args` in versions before 3.0.0rc6
# backend_args = dict(
# backend='petrel',
# path_mapping=dict({
# './data/': 's3://openmmlab/datasets/detection/',
# 'data/': 's3://openmmlab/datasets/detection/'
# }))
backend_args = None
test_pipeline = [
dict(
type='LoadImageFromFile',
imdecode_backend='pillow',
backend_args=backend_args),
dict(
type='Resize',
scale=(224, 224),
interpolation='bicubic',
backend='pillow'),
dict(type='PackInputs', meta_keys=['image_id']),
]
# ann_file download from
# train dataset: https://storage.googleapis.com/sfr-vision-language-research/datasets/coco_karpathy_train.json # noqa
# val dataset: https://storage.googleapis.com/sfr-vision-language-research/datasets/coco_karpathy_val.json # noqa
# test dataset: https://storage.googleapis.com/sfr-vision-language-research/datasets/coco_karpathy_test.json # noqa
# val evaluator: https://storage.googleapis.com/sfr-vision-language-research/datasets/coco_karpathy_val_gt.json # noqa
# test evaluator: https://storage.googleapis.com/sfr-vision-language-research/datasets/coco_karpathy_test_gt.json # noqa
val_dataloader = dict(
batch_size=1,
num_workers=2,
persistent_workers=True,
drop_last=False,
sampler=dict(type='DefaultSampler', shuffle=False),
dataset=dict(
type=dataset_type,
data_root=data_root,
ann_file='annotations/coco_karpathy_val.json',
pipeline=test_pipeline,
))
val_evaluator = dict(
type='COCOCaptionMetric',
ann_file=data_root + 'annotations/coco_karpathy_val_gt.json',
)
# # If you want standard test, please manually configure the test dataset
test_dataloader = val_dataloader
test_evaluator = val_evaluator
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment