mirror of https://github.com/open-mmlab/mmyolo.git
[Feature] Support auto registry based on mmdet 3.0.0rc6 (#597)
* support auto registry * update version * updatepull/600/head
parent
d156228c65
commit
e9e007973e
|
@ -67,7 +67,7 @@ jobs:
|
|||
command: |
|
||||
pip install -U openmim
|
||||
mim install git+https://github.com/open-mmlab/mmengine.git@main
|
||||
mim install 'mmcv >= 2.0.0rc1'
|
||||
mim install 'mmcv >= 2.0.0rc4'
|
||||
mim install git+https://github.com/open-mmlab/mmdetection.git@dev-3.x
|
||||
pip install -r requirements/albu.txt
|
||||
pip install -r requirements/tests.txt
|
||||
|
@ -125,7 +125,7 @@ jobs:
|
|||
command: |
|
||||
docker exec mmyolo pip install -U openmim
|
||||
docker exec mmyolo mim install -e /mmengine
|
||||
docker exec mmyolo mim install 'mmcv >= 2.0.0rc1'
|
||||
docker exec mmyolo mim install 'mmcv >= 2.0.0rc4'
|
||||
docker exec mmyolo pip install -e /mmdetection
|
||||
docker exec mmyolo pip install -r requirements/albu.txt
|
||||
docker exec mmyolo pip install -r requirements/tests.txt
|
||||
|
|
|
@ -141,9 +141,9 @@ MMYOLO relies on PyTorch, MMCV, MMEngine, and MMDetection. Below are quick steps
|
|||
conda create -n open-mmlab python=3.8 pytorch==1.10.1 torchvision==0.11.2 cudatoolkit=11.3 -c pytorch -y
|
||||
conda activate open-mmlab
|
||||
pip install openmim
|
||||
mim install "mmengine>=0.3.1"
|
||||
mim install "mmcv>=2.0.0rc1,<2.1.0"
|
||||
mim install "mmdet>=3.0.0rc5,<3.1.0"
|
||||
mim install "mmengine>=0.6.0"
|
||||
mim install "mmcv>=2.0.0rc4,<2.1.0"
|
||||
mim install "mmdet>=3.0.0rc6,<3.1.0"
|
||||
git clone https://github.com/open-mmlab/mmyolo.git
|
||||
cd mmyolo
|
||||
# Install albumentations
|
||||
|
|
|
@ -162,9 +162,9 @@ MMYOLO 依赖 PyTorch, MMCV, MMEngine 和 MMDetection,以下是安装的简要
|
|||
conda create -n open-mmlab python=3.8 pytorch==1.10.1 torchvision==0.11.2 cudatoolkit=11.3 -c pytorch -y
|
||||
conda activate open-mmlab
|
||||
pip install openmim
|
||||
mim install "mmengine>=0.3.1"
|
||||
mim install "mmcv>=2.0.0rc1,<2.1.0"
|
||||
mim install "mmdet>=3.0.0rc5,<3.1.0"
|
||||
mim install "mmengine>=0.6.0"
|
||||
mim install "mmcv>=2.0.0rc4,<2.1.0"
|
||||
mim install "mmdet>=3.0.0rc6,<3.1.0"
|
||||
git clone https://github.com/open-mmlab/mmyolo.git
|
||||
cd mmyolo
|
||||
# Install albumentations
|
||||
|
|
|
@ -18,7 +18,6 @@ import mmcv
|
|||
from mmengine import Config, DictAction, MessageHub
|
||||
from mmengine.utils import ProgressBar
|
||||
|
||||
from mmyolo.utils import register_all_modules
|
||||
from mmyolo.utils.boxam_utils import (BoxAMDetectorVisualizer,
|
||||
BoxAMDetectorWrapper, DetAblationLayer,
|
||||
DetBoxScoreTarget, GradCAM,
|
||||
|
@ -177,8 +176,6 @@ def init_detector_and_visualizer(args, cfg):
|
|||
|
||||
|
||||
def main():
|
||||
register_all_modules()
|
||||
|
||||
args = parse_args()
|
||||
|
||||
# hard code
|
||||
|
|
|
@ -6,10 +6,10 @@ from typing import Sequence
|
|||
import mmcv
|
||||
from mmdet.apis import inference_detector, init_detector
|
||||
from mmengine import Config, DictAction
|
||||
from mmengine.registry import init_default_scope
|
||||
from mmengine.utils import ProgressBar
|
||||
|
||||
from mmyolo.registry import VISUALIZERS
|
||||
from mmyolo.utils import register_all_modules
|
||||
from mmyolo.utils.misc import auto_arrange_images, get_file_list
|
||||
|
||||
|
||||
|
@ -96,13 +96,12 @@ class ActivationsWrapper:
|
|||
def main():
|
||||
args = parse_args()
|
||||
|
||||
# register all modules in mmdet into the registries
|
||||
register_all_modules()
|
||||
|
||||
cfg = Config.fromfile(args.config)
|
||||
if args.cfg_options is not None:
|
||||
cfg.merge_from_dict(args.cfg_options)
|
||||
|
||||
init_default_scope(cfg.get('default_scope', 'mmyolo'))
|
||||
|
||||
channel_reduction = args.channel_reduction
|
||||
if channel_reduction == 'None':
|
||||
channel_reduction = None
|
||||
|
|
|
@ -8,7 +8,7 @@ from mmengine.logging import print_log
|
|||
from mmengine.utils import ProgressBar, path
|
||||
|
||||
from mmyolo.registry import VISUALIZERS
|
||||
from mmyolo.utils import register_all_modules, switch_to_deploy
|
||||
from mmyolo.utils import switch_to_deploy
|
||||
from mmyolo.utils.labelme_utils import LabelmeFormat
|
||||
from mmyolo.utils.misc import get_file_list, show_data_classes
|
||||
|
||||
|
@ -51,9 +51,6 @@ def main():
|
|||
raise RuntimeError('`--to-labelme` or `--show` only '
|
||||
'can choose one at the same time.')
|
||||
|
||||
# register all modules in mmdet into the registries
|
||||
register_all_modules()
|
||||
|
||||
# build the model from a config file and a checkpoint file
|
||||
model = init_detector(args.config, args.checkpoint, device=args.device)
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ except ImportError:
|
|||
'to install sahi first for large image inference.')
|
||||
|
||||
from mmyolo.registry import VISUALIZERS
|
||||
from mmyolo.utils import register_all_modules, switch_to_deploy
|
||||
from mmyolo.utils import switch_to_deploy
|
||||
from mmyolo.utils.large_image import merge_results_by_nms, shift_predictions
|
||||
from mmyolo.utils.misc import get_file_list
|
||||
|
||||
|
@ -90,9 +90,6 @@ def parse_args():
|
|||
def main():
|
||||
args = parse_args()
|
||||
|
||||
# register all modules in mmdet into the registries
|
||||
register_all_modules()
|
||||
|
||||
# build the model from a config file and a checkpoint file
|
||||
model = init_detector(args.config, args.checkpoint, device=args.device)
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ from mmdet.apis import inference_detector, init_detector
|
|||
from mmengine.utils import track_iter_progress
|
||||
|
||||
from mmyolo.registry import VISUALIZERS
|
||||
from mmyolo.utils import register_all_modules
|
||||
|
||||
|
||||
def parse_args():
|
||||
|
@ -49,9 +48,6 @@ def main():
|
|||
('Please specify at least one operation (save/show the '
|
||||
'video) with the argument "--out" or "--show"')
|
||||
|
||||
# register all modules in mmdet into the registries
|
||||
register_all_modules()
|
||||
|
||||
# build the model from a config file and a checkpoint file
|
||||
model = init_detector(args.config, args.checkpoint, device=args.device)
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ RUN apt-get update \
|
|||
|
||||
# Install MMEngine , MMCV and MMDet
|
||||
RUN pip install --no-cache-dir openmim && \
|
||||
mim install --no-cache-dir "mmengine>=0.3.1" "mmcv>=2.0.0rc1,<2.1.0" "mmdet>=3.0.0rc5,<3.1.0"
|
||||
mim install --no-cache-dir "mmengine>=0.6.0" "mmcv>=2.0.0rc4,<2.1.0" "mmdet>=3.0.0rc6,<3.1.0"
|
||||
|
||||
# Install MMYOLO
|
||||
RUN git clone https://github.com/open-mmlab/mmyolo.git /mmyolo && \
|
||||
|
|
|
@ -30,7 +30,7 @@ RUN wget -q https://github.com/microsoft/onnxruntime/releases/download/v${ONNXRU
|
|||
|
||||
# Install OPENMIM MMENGINE MMDET
|
||||
RUN pip install --no-cache-dir openmim \
|
||||
&& mim install --no-cache-dir "mmengine>=0.3.1" "mmdet>=3.0.0rc5,<3.1.0" \
|
||||
&& mim install --no-cache-dir "mmengine>=0.6.0" "mmdet>=3.0.0rc6,<3.1.0" \
|
||||
&& mim install --no-cache-dir opencv-python==4.5.5.64 opencv-python-headless==4.5.5.64
|
||||
|
||||
RUN git clone https://github.com/open-mmlab/mmcv.git -b 2.x mmcv \
|
||||
|
|
|
@ -4,7 +4,9 @@ Compatible MMEngine, MMCV and MMDetection versions are shown as below. Please in
|
|||
|
||||
| MMYOLO version | MMDetection version | MMEngine version | MMCV version |
|
||||
| :------------: | :----------------------: | :----------------------: | :---------------------: |
|
||||
| main | mmdet>=3.0.0rc5, \<3.1.0 | mmengine>=0.3.1, \<1.0.0 | mmcv>=2.0.0rc0, \<2.1.0 |
|
||||
| main | mmdet>=3.0.0rc6, \<3.1.0 | mmengine>=0.6.0, \<1.0.0 | mmcv>=2.0.0rc4, \<2.1.0 |
|
||||
| 0.5.0 | mmdet>=3.0.0rc6, \<3.1.0 | mmengine>=0.6.0, \<1.0.0 | mmcv>=2.0.0rc4, \<2.1.0 |
|
||||
| 0.4.0 | mmdet>=3.0.0rc5, \<3.1.0 | mmengine>=0.3.1, \<1.0.0 | mmcv>=2.0.0rc0, \<2.1.0 |
|
||||
| 0.3.0 | mmdet>=3.0.0rc5, \<3.1.0 | mmengine>=0.3.1, \<1.0.0 | mmcv>=2.0.0rc0, \<2.1.0 |
|
||||
| 0.2.0 | mmdet>=3.0.0rc3, \<3.1.0 | mmengine>=0.3.1, \<1.0.0 | mmcv>=2.0.0rc0, \<2.1.0 |
|
||||
| 0.1.3 | mmdet>=3.0.0rc3, \<3.1.0 | mmengine>=0.3.1, \<1.0.0 | mmcv>=2.0.0rc0, \<2.1.0 |
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
|
||||
```shell
|
||||
pip install -U openmim
|
||||
mim install "mmengine>=0.3.1"
|
||||
mim install "mmcv>=2.0.0rc1,<2.1.0"
|
||||
mim install "mmdet>=3.0.0rc5,<3.1.0"
|
||||
mim install "mmengine>=0.6.0"
|
||||
mim install "mmcv>=2.0.0rc4,<2.1.0"
|
||||
mim install "mmdet>=3.0.0rc6,<3.1.0"
|
||||
```
|
||||
|
||||
**Note:**
|
||||
|
@ -79,9 +79,7 @@ Option (b). If you install MMYOLO with MIM, open your python interpreter and cop
|
|||
|
||||
```python
|
||||
from mmdet.apis import init_detector, inference_detector
|
||||
from mmyolo.utils import register_all_modules
|
||||
|
||||
register_all_modules()
|
||||
config_file = 'yolov5_s-v61_syncbn_fast_8xb16-300e_coco.py'
|
||||
checkpoint_file = 'yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700-86e02187.pth'
|
||||
model = init_detector(config_file, checkpoint_file, device='cpu') # or device='cuda:0'
|
||||
|
|
|
@ -20,7 +20,7 @@ To install MMEngine with pip instead of MIM, please follow \[MMEngine installati
|
|||
For example, you can install MMEngine by the following command.
|
||||
|
||||
```shell
|
||||
pip install "mmengine>=0.3.1"
|
||||
pip install "mmengine>=0.6.0"
|
||||
```
|
||||
|
||||
## Install MMCV without MIM
|
||||
|
@ -32,7 +32,7 @@ To install MMCV with pip instead of MIM, please follow [MMCV installation guides
|
|||
For example, the following command installs MMCV built for PyTorch 1.12.x and CUDA 11.6.
|
||||
|
||||
```shell
|
||||
pip install "mmcv>=2.0.0rc1" -f https://download.openmmlab.com/mmcv/dist/cu116/torch1.12.0/index.html
|
||||
pip install "mmcv>=2.0.0rc4" -f https://download.openmmlab.com/mmcv/dist/cu116/torch1.12.0/index.html
|
||||
```
|
||||
|
||||
## Install on CPU-only platforms
|
||||
|
@ -73,9 +73,9 @@ thus we only need to install MMEngine, MMCV, MMDetection, and MMYOLO with the fo
|
|||
|
||||
```shell
|
||||
!pip3 install openmim
|
||||
!mim install "mmengine>=0.3.1"
|
||||
!mim install "mmcv>=2.0.0rc1,<2.1.0"
|
||||
!mim install "mmdet>=3.0.0rc5,<3.1.0"
|
||||
!mim install "mmengine>=0.6.0"
|
||||
!mim install "mmcv>=2.0.0rc4,<2.1.0"
|
||||
!mim install "mmdet>=3.0.0rc6,<3.1.0"
|
||||
```
|
||||
|
||||
**Step 2.** Install MMYOLO from the source.
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
|
||||
| MMYOLO version | MMDetection version | MMEngine version | MMCV version |
|
||||
| :------------: | :----------------------: | :----------------------: | :---------------------: |
|
||||
| main | mmdet>=3.0.0rc5, \<3.1.0 | mmengine>=0.3.1, \<1.0.0 | mmcv>=2.0.0rc0, \<2.1.0 |
|
||||
| main | mmdet>=3.0.0rc5, \<3.1.0 | mmengine>=0.3.1, \<1.0.0 | mmcv>=2.0.0rc4, \<2.1.0 |
|
||||
| 0.5.0 | mmdet>=3.0.0rc6, \<3.1.0 | mmengine>=0.6.0, \<1.0.0 | mmcv>=2.0.0rc4, \<2.1.0 |
|
||||
| 0.4.0 | mmdet>=3.0.0rc5, \<3.1.0 | mmengine>=0.3.1, \<1.0.0 | mmcv>=2.0.0rc0, \<2.1.0 |
|
||||
| 0.3.0 | mmdet>=3.0.0rc5, \<3.1.0 | mmengine>=0.3.1, \<1.0.0 | mmcv>=2.0.0rc0, \<2.1.0 |
|
||||
| 0.2.0 | mmdet>=3.0.0rc3, \<3.1.0 | mmengine>=0.3.1, \<1.0.0 | mmcv>=2.0.0rc0, \<2.1.0 |
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
|
||||
```shell
|
||||
pip install -U openmim
|
||||
mim install "mmengine>=0.3.1"
|
||||
mim install "mmcv>=2.0.0rc1,<2.1.0"
|
||||
mim install "mmdet>=3.0.0rc5,<3.1.0"
|
||||
mim install "mmengine>=0.6.0"
|
||||
mim install "mmcv>=2.0.0rc4,<2.1.0"
|
||||
mim install "mmdet>=3.0.0rc6,<3.1.0"
|
||||
```
|
||||
|
||||
如果你当前已经处于 mmyolo 工程目录下,则可以采用如下简化写法
|
||||
|
@ -86,9 +86,7 @@ python demo/image_demo.py demo/demo.jpg \
|
|||
|
||||
```python
|
||||
from mmdet.apis import init_detector, inference_detector
|
||||
from mmyolo.utils import register_all_modules
|
||||
|
||||
register_all_modules()
|
||||
config_file = 'yolov5_s-v61_syncbn_fast_8xb16-300e_coco.py'
|
||||
checkpoint_file = 'yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700-86e02187.pth'
|
||||
model = init_detector(config_file, checkpoint_file, device='cpu') # or device='cuda:0'
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
例如,你可以通过以下命令安装 MMEngine:
|
||||
|
||||
```shell
|
||||
pip install "mmengine>=0.3.1"
|
||||
pip install "mmengine>=0.6.0"
|
||||
```
|
||||
|
||||
## 不使用 MIM 安装 MMCV
|
||||
|
@ -36,7 +36,7 @@ MMCV 包含 C++ 和 CUDA 扩展,因此其对 PyTorch 的依赖比较复杂。M
|
|||
例如,下述命令将会安装基于 PyTorch 1.12.x 和 CUDA 11.6 编译的 mmcv:
|
||||
|
||||
```shell
|
||||
pip install "mmcv>=2.0.0rc1" -f https://download.openmmlab.com/mmcv/dist/cu116/torch1.12.0/index.html
|
||||
pip install "mmcv>=2.0.0rc4" -f https://download.openmmlab.com/mmcv/dist/cu116/torch1.12.0/index.html
|
||||
```
|
||||
|
||||
## 在 CPU 环境中安装
|
||||
|
@ -75,9 +75,9 @@ pip install "mmcv>=2.0.0rc1" -f https://download.openmmlab.com/mmcv/dist/cu116/t
|
|||
|
||||
```shell
|
||||
!pip3 install openmim
|
||||
!mim install "mmengine>=0.3.1"
|
||||
!mim install "mmcv>=2.0.0rc1,<2.1.0"
|
||||
!mim install "mmdet>=3.0.0rc5,<3.1.0"
|
||||
!mim install "mmengine>=0.6.0"
|
||||
!mim install "mmcv>=2.0.0rc4,<2.1.0"
|
||||
!mim install "mmdet>=3.0.0rc6,<3.1.0"
|
||||
```
|
||||
|
||||
**步骤 2.** 使用源码安装 MMYOLO:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
```shell
|
||||
python tools/analysis_tools/browse_dataset.py \
|
||||
${CONFIG_FILE} \
|
||||
[-o, --output-dir ${OUTPUT_DIR}] \
|
||||
[-o, --out-dir ${OUTPUT_DIR}] \
|
||||
[-p, --phase ${DATASET_PHASE}] \
|
||||
[-n, --show-number ${NUMBER_IMAGES_DISPLAY}] \
|
||||
[-i, --show-interval ${SHOW_INTERRVAL}] \
|
||||
|
@ -14,7 +14,7 @@ python tools/analysis_tools/browse_dataset.py \
|
|||
**所有参数的说明**:
|
||||
|
||||
- `config` : 模型配置文件的路径。
|
||||
- `-o, --output-dir`: 保存图片文件夹,如果没有指定,默认为 `'./output'`。
|
||||
- `-o, --out-dir`: 保存图片文件夹,如果没有指定,默认为 `'./output'`。
|
||||
- **`-p, --phase`**: 可视化数据集的阶段,只能为 `['train', 'val', 'test']` 之一,默认为 `'train'`。
|
||||
- **`-n, --show-number`**: 可视化样本数量。如果没有指定,默认展示数据集的所有图片。
|
||||
- **`-m, --mode`**: 可视化的模式,只能为 `['original', 'transformed', 'pipeline']` 之一。 默认为 `'transformed'`。
|
||||
|
@ -32,24 +32,24 @@ python tools/analysis_tools/browse_dataset.py \
|
|||
1. **'original'** 模式 :
|
||||
|
||||
```shell
|
||||
python ./tools/analysis_tools/browse_dataset.py configs/yolov5/yolov5_balloon.py --phase val --output-dir tmp --mode original
|
||||
python ./tools/analysis_tools/browse_dataset.py configs/yolov5/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon.py --phase val --out-dir tmp --mode original
|
||||
```
|
||||
|
||||
- `--phase val`: 可视化验证集, 可简化为 `-p val`;
|
||||
- `--output-dir tmp`: 可视化结果保存在 "tmp" 文件夹, 可简化为 `-o tmp`;
|
||||
- `--out-dir tmp`: 可视化结果保存在 "tmp" 文件夹, 可简化为 `-o tmp`;
|
||||
- `--mode original`: 可视化原图, 可简化为 `-m original`;
|
||||
- `--show-number 100`: 可视化100张图,可简化为 `-n 100`;
|
||||
|
||||
2. **'transformed'** 模式 :
|
||||
|
||||
```shell
|
||||
python ./tools/analysis_tools/browse_dataset.py configs/yolov5/yolov5_balloon.py
|
||||
python ./tools/analysis_tools/browse_dataset.py configs/yolov5/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon.py
|
||||
```
|
||||
|
||||
3. **'pipeline'** 模式 :
|
||||
|
||||
```shell
|
||||
python ./tools/analysis_tools/browse_dataset.py configs/yolov5/yolov5_balloon.py -m pipeline
|
||||
python ./tools/analysis_tools/browse_dataset.py configs/yolov5/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon.py -m pipeline
|
||||
```
|
||||
|
||||
<div align=center>
|
||||
|
|
|
@ -6,15 +6,15 @@ from mmengine.utils import digit_version
|
|||
|
||||
from .version import __version__, version_info
|
||||
|
||||
mmcv_minimum_version = '2.0.0rc0'
|
||||
mmcv_minimum_version = '2.0.0rc4'
|
||||
mmcv_maximum_version = '2.1.0'
|
||||
mmcv_version = digit_version(mmcv.__version__)
|
||||
|
||||
mmengine_minimum_version = '0.3.1'
|
||||
mmengine_minimum_version = '0.6.0'
|
||||
mmengine_maximum_version = '1.0.0'
|
||||
mmengine_version = digit_version(mmengine.__version__)
|
||||
|
||||
mmdet_minimum_version = '3.0.0rc5'
|
||||
mmdet_minimum_version = '3.0.0rc6'
|
||||
mmdet_maximum_version = '3.1.0'
|
||||
mmdet_version = digit_version(mmdet.__version__)
|
||||
|
||||
|
|
|
@ -30,44 +30,74 @@ from mmengine.registry import \
|
|||
from mmengine.registry import Registry
|
||||
|
||||
# manage all kinds of runners like `EpochBasedRunner` and `IterBasedRunner`
|
||||
RUNNERS = Registry('runner', parent=MMENGINE_RUNNERS)
|
||||
RUNNERS = Registry(
|
||||
'runner', parent=MMENGINE_RUNNERS, locations=['mmyolo.engine'])
|
||||
# manage runner constructors that define how to initialize runners
|
||||
RUNNER_CONSTRUCTORS = Registry(
|
||||
'runner constructor', parent=MMENGINE_RUNNER_CONSTRUCTORS)
|
||||
'runner constructor',
|
||||
parent=MMENGINE_RUNNER_CONSTRUCTORS,
|
||||
locations=['mmyolo.engine'])
|
||||
# manage all kinds of loops like `EpochBasedTrainLoop`
|
||||
LOOPS = Registry('loop', parent=MMENGINE_LOOPS)
|
||||
LOOPS = Registry('loop', parent=MMENGINE_LOOPS, locations=['mmyolo.engine'])
|
||||
# manage all kinds of hooks like `CheckpointHook`
|
||||
HOOKS = Registry('hook', parent=MMENGINE_HOOKS)
|
||||
HOOKS = Registry(
|
||||
'hook', parent=MMENGINE_HOOKS, locations=['mmyolo.engine.hooks'])
|
||||
|
||||
# manage data-related modules
|
||||
DATASETS = Registry('dataset', parent=MMENGINE_DATASETS)
|
||||
DATA_SAMPLERS = Registry('data sampler', parent=MMENGINE_DATA_SAMPLERS)
|
||||
TRANSFORMS = Registry('transform', parent=MMENGINE_TRANSFORMS)
|
||||
DATASETS = Registry(
|
||||
'dataset', parent=MMENGINE_DATASETS, locations=['mmyolo.datasets'])
|
||||
DATA_SAMPLERS = Registry(
|
||||
'data sampler',
|
||||
parent=MMENGINE_DATA_SAMPLERS,
|
||||
locations=['mmyolo.datasets'])
|
||||
TRANSFORMS = Registry(
|
||||
'transform',
|
||||
parent=MMENGINE_TRANSFORMS,
|
||||
locations=['mmyolo.datasets.transforms'])
|
||||
|
||||
# manage all kinds of modules inheriting `nn.Module`
|
||||
MODELS = Registry('model', parent=MMENGINE_MODELS)
|
||||
MODELS = Registry('model', parent=MMENGINE_MODELS, locations=['mmyolo.models'])
|
||||
# manage all kinds of model wrappers like 'MMDistributedDataParallel'
|
||||
MODEL_WRAPPERS = Registry('model_wrapper', parent=MMENGINE_MODEL_WRAPPERS)
|
||||
MODEL_WRAPPERS = Registry(
|
||||
'model_wrapper',
|
||||
parent=MMENGINE_MODEL_WRAPPERS,
|
||||
locations=['mmyolo.models'])
|
||||
# manage all kinds of weight initialization modules like `Uniform`
|
||||
WEIGHT_INITIALIZERS = Registry(
|
||||
'weight initializer', parent=MMENGINE_WEIGHT_INITIALIZERS)
|
||||
'weight initializer',
|
||||
parent=MMENGINE_WEIGHT_INITIALIZERS,
|
||||
locations=['mmyolo.models'])
|
||||
|
||||
# manage all kinds of optimizers like `SGD` and `Adam`
|
||||
OPTIMIZERS = Registry('optimizer', parent=MMENGINE_OPTIMIZERS)
|
||||
OPTIM_WRAPPERS = Registry('optim_wrapper', parent=MMENGINE_OPTIM_WRAPPERS)
|
||||
OPTIMIZERS = Registry(
|
||||
'optimizer',
|
||||
parent=MMENGINE_OPTIMIZERS,
|
||||
locations=['mmyolo.engine.optimizers'])
|
||||
OPTIM_WRAPPERS = Registry(
|
||||
'optim_wrapper',
|
||||
parent=MMENGINE_OPTIM_WRAPPERS,
|
||||
locations=['mmyolo.engine.optimizers'])
|
||||
# manage constructors that customize the optimization hyperparameters.
|
||||
OPTIM_WRAPPER_CONSTRUCTORS = Registry(
|
||||
'optimizer constructor', parent=MMENGINE_OPTIM_WRAPPER_CONSTRUCTORS)
|
||||
'optimizer constructor',
|
||||
parent=MMENGINE_OPTIM_WRAPPER_CONSTRUCTORS,
|
||||
locations=['mmyolo.engine.optimizers'])
|
||||
# manage all kinds of parameter schedulers like `MultiStepLR`
|
||||
PARAM_SCHEDULERS = Registry(
|
||||
'parameter scheduler', parent=MMENGINE_PARAM_SCHEDULERS)
|
||||
'parameter scheduler',
|
||||
parent=MMENGINE_PARAM_SCHEDULERS,
|
||||
locations=['mmyolo.engine.optimizers'])
|
||||
# manage all kinds of metrics
|
||||
METRICS = Registry('metric', parent=MMENGINE_METRICS)
|
||||
METRICS = Registry(
|
||||
'metric', parent=MMENGINE_METRICS, locations=['mmyolo.engine'])
|
||||
|
||||
# manage task-specific modules like anchor generators and box coders
|
||||
TASK_UTILS = Registry('task util', parent=MMENGINE_TASK_UTILS)
|
||||
TASK_UTILS = Registry(
|
||||
'task util', parent=MMENGINE_TASK_UTILS, locations=['mmyolo.models'])
|
||||
|
||||
# manage visualizer
|
||||
VISUALIZERS = Registry('visualizer', parent=MMENGINE_VISUALIZERS)
|
||||
VISUALIZERS = Registry(
|
||||
'visualizer', parent=MMENGINE_VISUALIZERS, locations=['mmyolo.utils'])
|
||||
# manage visualizer backend
|
||||
VISBACKENDS = Registry('vis_backend', parent=MMENGINE_VISBACKENDS)
|
||||
VISBACKENDS = Registry(
|
||||
'vis_backend', parent=MMENGINE_VISBACKENDS, locations=['mmyolo.utils'])
|
||||
|
|
|
@ -14,6 +14,7 @@ from mmcv.transforms import Compose
|
|||
from mmdet.evaluation import get_classes
|
||||
from mmdet.utils import ConfigType
|
||||
from mmengine.config import Config
|
||||
from mmengine.registry import init_default_scope
|
||||
from mmengine.runner import load_checkpoint
|
||||
from mmengine.structures import InstanceData
|
||||
from torch import Tensor
|
||||
|
@ -71,6 +72,7 @@ def init_detector(
|
|||
# only change this
|
||||
# grad based method requires train_cfg
|
||||
# config.model.train_cfg = None
|
||||
init_default_scope(config.get('default_scope', 'mmyolo'))
|
||||
|
||||
model = MODELS.build(config.model)
|
||||
if checkpoint is not None:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Copyright (c) OpenMMLab. All rights reserved.
|
||||
|
||||
__version__ = '0.4.0'
|
||||
__version__ = '0.5.0'
|
||||
|
||||
from typing import Tuple
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
docutils==0.16.0
|
||||
mmcv>=2.0.0rc1,<2.1.0
|
||||
mmdet>=3.0.0rc5
|
||||
mmengine>=0.3.1
|
||||
mmcv>=2.0.0rc4,<2.1.0
|
||||
mmdet>=3.0.0rc6
|
||||
mmengine>=0.6.0
|
||||
myst-parser
|
||||
-e git+https://github.com/open-mmlab/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme
|
||||
sphinx==4.0.2
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
mmcv>=2.0.0rc1,<2.1.0
|
||||
mmdet>=3.0.0rc5
|
||||
mmengine>=0.3.1
|
||||
mmcv>=2.0.0rc4,<2.1.0
|
||||
mmdet>=3.0.0rc6
|
||||
mmengine>=0.6.0
|
||||
|
|
|
@ -8,14 +8,12 @@ import torch
|
|||
from mmengine import Config, DictAction
|
||||
from mmengine.dist import get_world_size, init_dist
|
||||
from mmengine.logging import MMLogger, print_log
|
||||
from mmengine.registry import init_default_scope
|
||||
from mmengine.runner import Runner, load_checkpoint
|
||||
from mmengine.utils import mkdir_or_exist
|
||||
from mmengine.utils.dl_utils import set_multi_processing
|
||||
|
||||
from mmyolo.registry import MODELS
|
||||
from mmyolo.utils import register_all_modules
|
||||
|
||||
register_all_modules()
|
||||
|
||||
|
||||
# TODO: Refactoring and improving
|
||||
|
@ -163,6 +161,8 @@ def main():
|
|||
if args.cfg_options is not None:
|
||||
cfg.merge_from_dict(args.cfg_options)
|
||||
|
||||
init_default_scope(cfg.get('default_scope', 'mmyolo'))
|
||||
|
||||
distributed = False
|
||||
if args.launcher != 'none':
|
||||
init_dist(args.launcher, **cfg.get('env_cfg', {}).get('dist_cfg', {}))
|
||||
|
|
|
@ -11,11 +11,11 @@ from mmdet.models.utils import mask2ndarray
|
|||
from mmdet.structures.bbox import BaseBoxes
|
||||
from mmengine.config import Config, DictAction
|
||||
from mmengine.dataset import Compose
|
||||
from mmengine.registry import init_default_scope
|
||||
from mmengine.utils import ProgressBar
|
||||
from mmengine.visualization import Visualizer
|
||||
|
||||
from mmyolo.registry import DATASETS, VISUALIZERS
|
||||
from mmyolo.utils import register_all_modules
|
||||
|
||||
|
||||
# TODO: Support for printing the change in key of results
|
||||
|
@ -43,7 +43,7 @@ def parse_args():
|
|||
'the intermediate images. Defaults to "transformed".')
|
||||
parser.add_argument(
|
||||
'--out-dir',
|
||||
default=None,
|
||||
default='output',
|
||||
type=str,
|
||||
help='If there is no display interface, you can save it.')
|
||||
parser.add_argument('--not-show', default=False, action='store_true')
|
||||
|
@ -182,8 +182,7 @@ def main():
|
|||
if args.cfg_options is not None:
|
||||
cfg.merge_from_dict(args.cfg_options)
|
||||
|
||||
# register all modules in mmyolo into the registries
|
||||
register_all_modules()
|
||||
init_default_scope(cfg.get('default_scope', 'mmyolo'))
|
||||
|
||||
dataset_cfg = cfg.get(args.phase + '_dataloader').get('dataset')
|
||||
dataset = DATASETS.build(dataset_cfg)
|
||||
|
|
|
@ -9,10 +9,10 @@ from mmdet.evaluation import bbox_overlaps
|
|||
from mmdet.utils import replace_cfg_vals, update_data_root
|
||||
from mmengine import Config, DictAction
|
||||
from mmengine.fileio import load
|
||||
from mmengine.registry import init_default_scope
|
||||
from mmengine.utils import ProgressBar
|
||||
|
||||
from mmyolo.registry import DATASETS
|
||||
from mmyolo.utils import register_all_modules
|
||||
|
||||
|
||||
def parse_args():
|
||||
|
@ -235,7 +235,6 @@ def plot_confusion_matrix(confusion_matrix,
|
|||
|
||||
|
||||
def main():
|
||||
register_all_modules()
|
||||
args = parse_args()
|
||||
|
||||
cfg = Config.fromfile(args.config)
|
||||
|
@ -249,6 +248,8 @@ def main():
|
|||
if args.cfg_options is not None:
|
||||
cfg.merge_from_dict(args.cfg_options)
|
||||
|
||||
init_default_scope(cfg.get('default_scope', 'mmyolo'))
|
||||
|
||||
results = load(args.prediction_path)
|
||||
|
||||
if not os.path.exists(args.save_dir):
|
||||
|
|
|
@ -7,11 +7,11 @@ import matplotlib.patches as mpatches
|
|||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
from mmengine.config import Config
|
||||
from mmengine.registry import init_default_scope
|
||||
from mmengine.utils import ProgressBar
|
||||
from prettytable import PrettyTable
|
||||
|
||||
from mmyolo.registry import DATASETS
|
||||
from mmyolo.utils import register_all_modules
|
||||
from mmyolo.utils.misc import show_data_classes
|
||||
|
||||
|
||||
|
@ -348,8 +348,7 @@ def main():
|
|||
args = parse_args()
|
||||
cfg = Config.fromfile(args.config)
|
||||
|
||||
# register all modules in mmdet into the registries
|
||||
register_all_modules()
|
||||
init_default_scope(cfg.get('default_scope', 'mmyolo'))
|
||||
|
||||
def replace_pipeline_to_none(cfg):
|
||||
"""Recursively iterate over all dataset(or datasets) and set their
|
||||
|
|
|
@ -41,12 +41,12 @@ from mmdet.utils import replace_cfg_vals, update_data_root
|
|||
from mmengine.config import Config
|
||||
from mmengine.fileio import dump
|
||||
from mmengine.logging import MMLogger
|
||||
from mmengine.registry import init_default_scope
|
||||
from mmengine.utils import ProgressBar
|
||||
from scipy.optimize import differential_evolution
|
||||
from torch import Tensor
|
||||
|
||||
from mmyolo.registry import DATASETS
|
||||
from mmyolo.utils import register_all_modules
|
||||
|
||||
try:
|
||||
from scipy.cluster.vq import kmeans
|
||||
|
@ -581,7 +581,6 @@ def main():
|
|||
args = parse_args()
|
||||
cfg = args.config
|
||||
cfg = Config.fromfile(cfg)
|
||||
register_all_modules()
|
||||
|
||||
# replace the ${key} with the value of cfg.key
|
||||
cfg = replace_cfg_vals(cfg)
|
||||
|
@ -589,6 +588,8 @@ def main():
|
|||
# update data root according to MMDET_DATASETS
|
||||
update_data_root(cfg)
|
||||
|
||||
init_default_scope(cfg.get('default_scope', 'mmyolo'))
|
||||
|
||||
input_shape = args.input_shape
|
||||
assert len(input_shape) == 2
|
||||
|
||||
|
|
|
@ -28,13 +28,12 @@ import torch.nn as nn
|
|||
from mmengine.config import Config, DictAction
|
||||
from mmengine.hooks import Hook
|
||||
from mmengine.model import BaseModel
|
||||
from mmengine.registry import init_default_scope
|
||||
from mmengine.runner import Runner
|
||||
from mmengine.utils.path import mkdir_or_exist
|
||||
from mmengine.visualization import Visualizer
|
||||
from rich.progress import BarColumn, MofNCompleteColumn, Progress, TextColumn
|
||||
|
||||
from mmyolo.utils import register_all_modules
|
||||
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(
|
||||
|
@ -229,8 +228,8 @@ def main():
|
|||
osp.splitext(osp.basename(args.config))[0])
|
||||
|
||||
cfg.log_level = args.log_level
|
||||
# register all modules in mmyolo into the registries
|
||||
register_all_modules()
|
||||
|
||||
init_default_scope(cfg.get('default_scope', 'mmyolo'))
|
||||
|
||||
# init logger
|
||||
print('Param_scheduler :')
|
||||
|
|
|
@ -9,7 +9,7 @@ from mmengine.evaluator import DumpResults
|
|||
from mmengine.runner import Runner
|
||||
|
||||
from mmyolo.registry import RUNNERS
|
||||
from mmyolo.utils import is_metainfo_lower, register_all_modules
|
||||
from mmyolo.utils import is_metainfo_lower
|
||||
|
||||
|
||||
# TODO: support fuse_conv_bn
|
||||
|
@ -73,10 +73,6 @@ def parse_args():
|
|||
def main():
|
||||
args = parse_args()
|
||||
|
||||
# register all modules in mmdet into the registries
|
||||
# do not init the default scope here because it will be init in the runner
|
||||
register_all_modules(init_default_scope=False)
|
||||
|
||||
# load config
|
||||
cfg = Config.fromfile(args.config)
|
||||
# replace the ${key} with the value of cfg.key
|
||||
|
|
|
@ -9,7 +9,7 @@ from mmengine.logging import print_log
|
|||
from mmengine.runner import Runner
|
||||
|
||||
from mmyolo.registry import RUNNERS
|
||||
from mmyolo.utils import is_metainfo_lower, register_all_modules
|
||||
from mmyolo.utils import is_metainfo_lower
|
||||
|
||||
|
||||
def parse_args():
|
||||
|
@ -55,10 +55,6 @@ def parse_args():
|
|||
def main():
|
||||
args = parse_args()
|
||||
|
||||
# register all modules in mmdet into the registries
|
||||
# do not init the default scope here because it will be init in the runner
|
||||
register_all_modules(init_default_scope=False)
|
||||
|
||||
# load config
|
||||
cfg = Config.fromfile(args.config)
|
||||
# replace the ${key} with the value of cfg.key
|
||||
|
|
Loading…
Reference in New Issue