
如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
mmdetection is an open source object detection toolbox based on PyTorch. It is a part of the open-mmlab project developed by Multimedia Laboratory, CUHK.
Modular Design
One can easily construct a customized object detection framework by combining different components.
Support of multiple frameworks out of box
The toolbox directly supports popular detection frameworks, e.g. Faster RCNN, Mask RCNN, RetinaNet, etc.
Efficient
All basic bbox and mask operations run on GPUs now. The training speed is about 5% ~ 20% faster than Detectron for different models.
State of the art
This was the codebase of the MMDet team, who won the COCO Detection 2018 challenge.
Apart from mmdetection, we also released a library https://github.com/open-mmlab/mmcv for computer vision research, which is heavily depended on by this toolbox.
This project is released under the Apache 2.0 license.
v0.5.4 (27/11/2018)
v0.5.3 (26/11/2018)
v0.5.2 (21/10/2018)
v0.5.1 (20/10/2018)
train_cfg field in config files are restructured.ConvFCRoIHead / SharedFCRoIHead are renamed to ConvFCBBoxHead / SharedFCBBoxHead for consistency.Supported methods and backbones are shown in the below table. Results and models are available in the Model zoo.
| ResNet | ResNeXt | SENet | VGG | |
|---|---|---|---|---|
| RPN | ✓ | ☐ | ☐ | ✗ |
| Fast R-CNN | ✓ | ☐ | ☐ | ✗ |
| Faster R-CNN | ✓ | ☐ | ☐ | ✗ |
| Mask R-CNN | ✓ | ☐ | ☐ | ✗ |
| Cascade R-CNN | ✓ | ☐ | ☐ | ✗ |
| Cascade Mask R-CNN | ✓ | ☐ | ☐ | ✗ |
| SSD | ✗ | ✗ | ✗ | ☐ |
| RetinaNet | ✓ | ☐ | ☐ | ✗ |
Please refer to INSTALL.md for installation and dataset preparation.
We allow to run one or multiple processes on each GPU, e.g. 8 processes on 8 GPU
or 16 processes on 8 GPU. When the GPU workload is not very heavy for a single
process, running multiple processes will accelerate the testing, which is specified
with the argument --proc_per_gpu <PROCESS_NUM>.
To test a dataset and save the results.
shellpython tools/test.py <CONFIG_FILE> <CHECKPOINT_FILE> --gpus <GPU_NUM> --out <OUT_FILE>
To perform evaluation after testing, add --eval <EVAL_TYPES>. Supported types are:
[proposal_fast, proposal, bbox, segm, keypoints].
proposal_fast denotes evaluating proposal recalls with our own implementation,
others denote evaluating the corresponding metric with the official coco api.
For example, to evaluate Mask R-CNN with 8 GPUs and save the result as results.pkl.
shellpython tools/test.py configs/mask_rcnn_r50_fpn_1x.py <CHECKPOINT_FILE> --gpus 8 --out results.pkl --eval bbox segm
It is also convenient to visualize the results during testing by adding an argument --show.
shellpython tools/test.py <CONFIG_FILE> <CHECKPOINT_FILE> --show
We provide some high-level apis (experimental) to test an image.
pythonimport mmcv from mmcv.runner import load_checkpoint from mmdet.models import build_detector from mmdet.apis import inference_detector, show_result cfg = mmcv.Config.fromfile('configs/faster_rcnn_r50_fpn_1x.py') cfg.model.pretrained = None # construct the model and load checkpoint model = build_detector(cfg.model, test_cfg=cfg.test_cfg) _ = load_checkpoint(model, 'https://s3.ap-northeast-2.amazonaws.com/open-mmlab/mmdetection/models/faster_rcnn_r50_fpn_1x_20181010-3d1b3351.pth') # test a single image img = mmcv.imread('test.jpg') result = inference_detector(model, img, cfg) show_result(img, result) # test a list of images imgs = ['test1.jpg', 'test2.jpg'] for i, result in enumerate(inference_detector(model, imgs, cfg, device='cuda:0')): print(i, imgs[i]) show_result(imgs[i], result)
mmdetection implements distributed training and non-distributed training,
which uses MMDistributedDataParallel and MMDataParallel respectively.
mmdetection potentially supports multiple launch methods, e.g., PyTorch’s built-in launch utility, slurm and MPI.
We provide a training script using the launch utility provided by PyTorch.
shell./tools/dist_train.sh <CONFIG_FILE> <GPU_NUM> [optional arguments]
Supported arguments are:
Expected results in WORK_DIR:
Important: The default learning rate is for 8 GPUs. If you use less or more than 8 GPUs, you need to set the learning rate proportional to the GPU num. E.g., modify lr to 0.01 for 4 GPUs or 0.04 for 16 GPUs.
Please refer to tools/train.py for non-distributed training, which is not recommended
and left for debugging. Even on a single machine, distributed training is preferred.
We define a simple annotation format.
The annotation of a dataset is a list of dict, each dict corresponds to an image.
There are 3 field filename (relative path), width, height for testing,
and an additional field ann for training. ann is also a dict containing at least 2 fields:
bboxes and labels, both of which are numpy arrays. Some datasets may provide
annotations like crowd/difficult/ignored bboxes, we use bboxes_ignore and labels_ignore
to cover them.
Here is an example.
[ { 'filename': 'a.jpg', 'width': 1280, 'height': 720, 'ann': { 'bboxes': <np.ndarray> (n, 4), 'labels': <np.ndarray> (n, ), 'bboxes_ignore': <np.ndarray> (k, 4), 'labels_ignore': <np.ndarray> (k, ) (optional field) } }, ... ]
There are two ways to work with custom datasets.
online conversion
You can write a new Dataset class inherited from CustomDataset, and overwrite two methods
load_annotations(self, ann_file) and get_ann_info(self, idx), like CocoDataset and VOCDataset.
offline conversion
You can convert the annotation format to the expected format above and save it to
a pickle or json file, like pascal_voc.py.
Then you can simply use CustomDataset.
Some implementation details and project structures are described in the technical details.
If you use our codebase or models in your research, please cite this project. We will release a paper or technical report later.
@misc{mmdetection2018, author = {Kai Chen and Jiangmiao Pang and Jiaqi Wang and Yu Xiong and Xiaoxiao Li and Shuyang Sun and Wansen Feng and Ziwei Liu and Jianping Shi and Wanli Ouyang and Chen Change Loy and Dahua Lin}, title = {mmdetection}, howpublished = {\url{https://github.com/open-mmlab/mmdetection}}, year = {2018} }
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务