An open source object detection toolbox based on PyTorch

Overview

Introduction

English | 简体中文

MMDetection is an open source object detection toolbox based on PyTorch. It is a part of the OpenMMLab project.

The master branch works with PyTorch 1.3+.

Major features
  • 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 frameworks out of box

    The toolbox directly supports popular and contemporary detection frameworks, e.g. Faster RCNN, Mask RCNN, RetinaNet, etc.

  • High efficiency

    All basic bbox and mask operations run on GPUs. The training speed is faster than or comparable to other codebases, including Detectron2, maskrcnn-benchmark and SimpleDet.

  • State of the art

    The toolbox stems from the codebase developed by the MMDet team, who won COCO Detection Challenge in 2018, and we keep pushing it forward.

Apart from MMDetection, we also released a library mmcv for computer vision research, which is heavily depended on by this toolbox.

License

This project is released under the Apache 2.0 license.

Changelog

2.18.0 was released in 27/10/2021:

  • Support QueryInst.
  • Refactor dense_head to decouple onnx export from get_bboxes and speed up inference time.
  • Support infinite sampler to accelerate training when using iter based runner.

Please refer to changelog.md for details and release history.

For compatibility changes between different versions of MMDetection, please refer to compatibility.md.

Benchmark and model zoo

Results and models are available in the model zoo.

Supported backbones:
  • ResNet (CVPR'2016)
  • ResNeXt (CVPR'2017)
  • VGG (ICLR'2015)
  • MobileNetV2 (CVPR'2018)
  • HRNet (CVPR'2019)
  • RegNet (CVPR'2020)
  • Res2Net (TPAMI'2020)
  • ResNeSt (ArXiv'2020)
  • Swin (CVPR'2021)
  • PVT (ICCV'2021)
  • PVTv2 (ArXiv'2021)
Supported methods:

Some other methods are also supported in projects using MMDetection.

Installation

Please refer to get_started.md for installation.

Getting Started

Please see get_started.md for the basic usage of MMDetection. We provide colab tutorial, and full guidance for quick run with existing dataset and with new dataset for beginners. There are also tutorials for finetuning models, adding new dataset, designing data pipeline, customizing models, customizing runtime settings and useful tools.

Please refer to FAQ for frequently asked questions.

Contributing

We appreciate all contributions to improve MMDetection. Ongoing projects can be found in out GitHub Projects. Welcome community users to participate in these projects. Please refer to 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}
}

Projects in OpenMMLab

  • MMCV: OpenMMLab foundational library for computer vision.
  • MIM: MIM Installs OpenMMLab Packages.
  • MMClassification: OpenMMLab image classification toolbox and benchmark.
  • MMDetection: OpenMMLab detection toolbox and benchmark.
  • MMDetection3D: OpenMMLab's next-generation platform for general 3D object detection.
  • MMSegmentation: OpenMMLab semantic segmentation toolbox and benchmark.
  • MMAction2: OpenMMLab's next-generation action understanding toolbox and benchmark.
  • MMTracking: OpenMMLab video perception toolbox and benchmark.
  • MMPose: OpenMMLab pose estimation toolbox and benchmark.
  • MMEditing: OpenMMLab image and video editing toolbox.
  • MMOCR: A Comprehensive Toolbox for Text Detection, Recognition and Understanding.
  • MMGeneration: OpenMMLab image and video generative models toolbox.
Comments
  • 导出 onnx 模型报错

    导出 onnx 模型报错

    你好, 我下载的示例模型,采用默认配置参数,导出onnx模型

    python tools/deployment/pytorch2onnx.py configs/picodet/picodet_s_416_coco.py configs/picodet/picodet_s_416_coco.pth   --output-file /data/workspace/mmdet_picodet_s_416_coco.onnx
    

    导出 onnx模型时报错:

    File "/home/zxx/code/picodet_repro/mmdet/models/dense_heads/base_dense_head.py", line 427, in onnx_export
        assert cls_score.size()[-2:] == bbox_pred.size()[-2:]
    

    然后发现好像是picodet_head.py 里195 行的维度没有对齐。将代码修改如下

    if torch.onnx.is_in_onnx_export():
                # cls_score = (
                #     torch.sigmoid(cls_score)
                #     .reshape(1, self.num_classes, -1)
                #     .permute(0, 2, 1)
                # )
                # bbox_pred = bbox_pred.reshape(1, (self.reg_max + 1) * 4, -1).permute(
                #     0, 2, 1
                # )
    
                bbox_pred = bbox_pred.permute(0, 2, 3, 1).reshape(1, -1, 4 * (self.reg_max + 1))
                pred_corners = self.integral(bbox_pred)
                bbox_pred = pred_corners.reshape(1,cls_feat.shape[-2],cls_feat.shape[-1], 4).permute(0,3,1,2)
    
    return cls_score, bbox_pred
    

    但依然会报错:

    load checkpoint from local path: configs/picodet/picodet_s_416_coco.pth
    The model and loaded state dict do not match exactly
    
    unexpected key in source state_dict: bbox_head.p3_feat.scale_reg, bbox_head.p4_feat.scale_reg, bbox_head.p5_feat.scale_reg, bbox_head.p6_feat.scale_reg, bbox_head.p7_feat.scale_reg
    
    missing keys in source state_dict: bbox_head.gfl_reg.0.weight, bbox_head.gfl_reg.0.bias, bbox_head.gfl_reg.1.weight, bbox_head.gfl_reg.1.bias, bbox_head.gfl_reg.2.weight, bbox_head.gfl_reg.2.bias, bbox_head.gfl_reg.3.weight, bbox_head.gfl_reg.3.bias
    /home/zxx/code/picodet_repro/mmdet/models/dense_heads/base_dense_head.py:407: TracerWarning: torch.tensor results are registered as constants in the trace. You can safely ignore this warning if you use this function to create tensors out of constant variables that would be the same every time you call this function. In any other case, this might cause the trace to be incorrect.
      cfg.get('nms_pre', -1), device=device, dtype=torch.long)
    
    ...
    
    Traceback (most recent call last):
      File "tools/deployment/pytorch2onnx.py", line 345, in <module>
        skip_postprocess=args.skip_postprocess)
      File "tools/deployment/pytorch2onnx.py", line 100, in pytorch2onnx
        dynamic_axes=dynamic_axes)
      File "/home/zxx/miniconda3/envs/mmdet/lib/python3.7/site-packages/torch/onnx/__init__.py", line 276, in export
        custom_opsets, enable_onnx_checker, use_external_data_format)
      File "/home/zxx/miniconda3/envs/mmdet/lib/python3.7/site-packages/torch/onnx/utils.py", line 94, in export
        use_external_data_format=use_external_data_format)
      File "/home/zxx/miniconda3/envs/mmdet/lib/python3.7/site-packages/torch/onnx/utils.py", line 701, in _export
        dynamic_axes=dynamic_axes)
      File "/home/zxx/miniconda3/envs/mmdet/lib/python3.7/site-packages/torch/onnx/utils.py", line 503, in _model_to_graph
        _export_onnx_opset_version)
    RuntimeError: number of dims don't match in permute
    
    

    请问大佬有没有遇到这个问题,如何解决。

    opened by zxx0102 5
  • registry 没有 PicoDet

    registry 没有 PicoDet

    Traceback (most recent call last): File "tools/train.py", line 185, in main() File "tools/train.py", line 158, in main test_cfg=cfg.get('test_cfg')) File "/home/zijing.wang/.local/lib/python3.6/site-packages/mmdet/models/builder.py", line 59, in build_detector cfg, default_args=dict(train_cfg=train_cfg, test_cfg=test_cfg)) File "/home/zijing.wang/.local/lib/python3.6/site-packages/mmcv/utils/registry.py", line 213, in build return self.build_func(*args, **kwargs, registry=self) File "/home/zijing.wang/.local/lib/python3.6/site-packages/mmcv/cnn/builder.py", line 27, in build_model_from_cfg return build_from_cfg(cfg, registry, default_args) File "/home/zijing.wang/.local/lib/python3.6/site-packages/mmcv/utils/registry.py", line 46, in build_from_cfg f'{obj_type} is not in the {registry.name} registry') KeyError: 'PicoDet is not in the models registry'

    opened by umie0128 4
  • The model and loaded state dict do not match exactly

    The model and loaded state dict do not match exactly

    Hello,

    I am trying the code demo/image_demo.py . while loading the pretrained weights I encountered the following error

    load checkpoint from local path: demo/picodet_s_320.26.9.pth
    The model and loaded state dict do not match exactly
    
    unexpected key in source state_dict: ema_backbone_conv1_conv_weight, ema_backbone_conv1_bn_weight, ema_backbone_conv1_bn_bias, ema_backbone_conv1_bn_running_mean, ema_backbone_conv1_bn_running_var, ema_backbone_conv1_bn_num_batches_tracked, ema_backbone_2_1_conv_dw_1_conv_weight, ema_backbone_2_1_conv_dw_1_bn_weight, ema_backbone_2_1_conv_dw_1_bn_bias, ema_backbone_2_1_conv_dw_1_bn_running_mean, ema_backbone_2_1_conv_dw_1_bn_running_var, ema_backbone_2_1_conv_dw_1_bn_num_batches_tracked, ema_backbone_2_1_conv_linear_1_conv_weight, ema_backbone_2_1_conv_linear_1_bn_weight, ema_backbone_2_1_conv_linear_1_bn_bias, ema_backbone_2_1_conv_linear_1_bn_running_mean, ema_backbone_2_1_conv_linear_1_bn_running_var, ema_backbone_2_1_conv_linear_1_bn_num_batches_tracked, ema_backbone_2_1_conv_pw_2_conv_weight, ema_backbone_2_1_conv_pw_2_bn_weight, ema_backbone_2_1_conv_pw_2_bn_bias, ema_backbone_2_1_conv_pw_2_bn_running_mean, ema_backbone_2_1_conv_pw_2_bn_running_var, ema_backbone_2_1_conv_pw_2_bn_num_batches_tracked, ema_backbone_2_1_conv_dw_2_conv_weight, ema_backbone_2_1_conv_dw_2_bn_weight, ema_backbone_2_1_conv_dw_2_bn_bias,
    .....................................................
    

    I tried the following config and checkpoint file

    config_file = 'configs/picodet/picodet_s_320_coco.py'
    checkpoint_file = 'picodet_s_320.26.9.pth'
    

    Any suggestions how to fix this ? Thanks.

    opened by JoyMaz222 3
  • 可以增加一些操作说明。。。

    可以增加一些操作说明。。。

    Thanks for your error report and we appreciate it a lot.

    Checklist

    1. I have searched related issues but cannot get the expected help.
    2. I have read the FAQ documentation but cannot get the expected help.
    3. The bug has not been fixed in the latest version.

    Describe the bug A clear and concise description of what the bug is.

    Reproduction

    1. What command or script did you run?
    A placeholder for the command.
    
    1. Did you make any modifications on the code or config? Did you understand what you have modified?
    2. What dataset did you use?

    Environment

    1. Please run python mmdet/utils/collect_env.py to collect necessary environment information and paste it here.
    2. You may add addition that may be helpful for locating the problem, such as
      • How you installed PyTorch [e.g., pip, conda, source]
      • Other environment variables that may be related (such as $PATH, $LD_LIBRARY_PATH, $PYTHONPATH, etc.)

    Error traceback If applicable, paste the error trackback here.

    A placeholder for trackback.
    

    Bug fix If you have already identified the reason, you can provide the information here. If you are willing to create a PR to fix it, please also leave a comment here and that would be much appreciated!

    opened by Aruen24 2
  • picode网络的训练细节

    picode网络的训练细节

    Describe the feature 我也在复现picodet的网络,但是loss在训练集快速降到很小,但是验证集上的loss却比较大,map很低,由于是从paddlepaddle中抽取的部分代码,可能在训练上存在问题,也可能代码还有细节没注意到,希望博主能分享下训练的具体过程。 顺便提一下,预训练模型能在百度云上也放一个不?感谢 Motivation A clear and concise description of the motivation of the feature. Ex1. It is inconvenient when [....]. Ex2. There is a recent paper [....], which is very helpful for [....].

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

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

    opened by hz1272803128 1
Owner
Bo Chen
a novice computer science learner,major in computer vision.
Bo Chen
Mmdetection3d Noted - MMDetection3D is an open source object detection toolbox based on PyTorch

MMDetection3D is an open source object detection toolbox based on PyTorch

Jiangjingwen 13 Jan 6, 2023
LaneDet is an open source lane detection toolbox based on PyTorch that aims to pull together a wide variety of state-of-the-art lane detection models

LaneDet is an open source lane detection toolbox based on PyTorch that aims to pull together a wide variety of state-of-the-art lane detection models. Developers can reproduce these SOTA methods and build their own methods.

TuZheng 405 Jan 4, 2023
MMFlow is an open source optical flow toolbox based on PyTorch

Documentation: https://mmflow.readthedocs.io/ Introduction English | 简体中文 MMFlow is an open source optical flow toolbox based on PyTorch. It is a part

OpenMMLab 688 Jan 6, 2023
mmfewshot is an open source few shot learning toolbox based on PyTorch

OpenMMLab FewShot Learning Toolbox and Benchmark

OpenMMLab 514 Dec 28, 2022
OpenPCDet Toolbox for LiDAR-based 3D Object Detection.

OpenPCDet OpenPCDet is a clear, simple, self-contained open source project for LiDAR-based 3D object detection. It is also the official code release o

OpenMMLab 3.2k Dec 31, 2022
TorchDistiller - a collection of the open source pytorch code for knowledge distillation, especially for the perception tasks, including semantic segmentation, depth estimation, object detection and instance segmentation.

This project is a collection of the open source pytorch code for knowledge distillation, especially for the perception tasks, including semantic segmentation, depth estimation, object detection and instance segmentation.

yifan liu 147 Dec 3, 2022
PaddleRobotics is an open-source algorithm library for robots based on Paddle, including open-source parts such as human-robot interaction, complex motion control, environment perception, SLAM positioning, and navigation.

简体中文 | English PaddleRobotics paddleRobotics是基于paddle的机器人开源算法库集,包括人机交互、复杂运动控制、环境感知、slam定位导航等开源算法部分。 人机交互 主动多模交互技术TFVT-HRI 主动多模交互技术是通过视觉、语音、触摸传感器等输入机器人

null 185 Dec 26, 2022
OBBDetection: an oriented object detection toolbox modified from MMdetection

OBBDetection note: If you have questions or good suggestions, feel free to propose issues and contact me. introduction OBBDetection is an oriented obj

MIXIAOXIN_HO 3 Nov 11, 2022
EasyMocap is an open-source toolbox for markerless human motion capture from RGB videos.

EasyMocap is an open-source toolbox for markerless human motion capture from RGB videos. In this project, we provide the basic code for fitt

ZJU3DV 2.2k Jan 5, 2023
AdelaiDepth is an open source toolbox for monocular depth prediction.

AdelaiDepth is an open source toolbox for monocular depth prediction.

Adelaide Intelligent Machines (AIM) Group 743 Jan 1, 2023
✨✨✨An awesome open source toolbox for stereo matching.

OpenStereo This is an awesome open source toolbox for stereo matching. Supported Methods: BM SGM(T-PAMI'07) GCNet(ICCV'17) PSMNet(CVPR'18) StereoNet(E

Wang Qingyu 6 Nov 4, 2022
(JMLR'19) A Python Toolbox for Scalable Outlier Detection (Anomaly Detection)

Python Outlier Detection (PyOD) Deployment & Documentation & Stats Build Status & Coverage & Maintainability & License PyOD is a comprehensive and sca

Yue Zhao 6.6k Jan 3, 2023
Hybrid CenterNet - Hybrid-supervised object detection / Weakly semi-supervised object detection

Hybrid-Supervised Object Detection System Object detection system trained by hybrid-supervision/weakly semi-supervision (HSOD/WSSOD): This project is

null 5 Dec 10, 2022
Yolo object detection - Yolo object detection with python

How to run download required files make build_image make download Docker versio

null 3 Jan 26, 2022
ObjectDetNet is an easy, flexible, open-source object detection framework

Getting started with the ObjectDetNet ObjectDetNet is an easy, flexible, open-source object detection framework which allows you to easily train, resu

null 5 Aug 25, 2020
An Unsupervised Graph-based Toolbox for Fraud Detection

An Unsupervised Graph-based Toolbox for Fraud Detection Introduction: UGFraud is an unsupervised graph-based fraud detection toolbox that integrates s

SafeGraph 99 Dec 11, 2022
Official PyTorch implementation of Joint Object Detection and Multi-Object Tracking with Graph Neural Networks

This is the official PyTorch implementation of our paper: "Joint Object Detection and Multi-Object Tracking with Graph Neural Networks". Our project website and video demos are here.

Richard Wang 443 Dec 6, 2022
ObjectDrawer-ToolBox: a graphical image annotation tool to generate ground plane masks for a 3D object reconstruction system

ObjectDrawer-ToolBox is a graphical image annotation tool to generate ground plane masks for a 3D object reconstruction system, Object Drawer.

null 77 Jan 5, 2023