• Stars
    star
    346
  • Rank 122,430 (Top 3 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created over 3 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

MIM Installs OpenMMLab Packages

MIM: MIM Installs OpenMMLab Packages

MIM provides a unified interface for launching and installing OpenMMLab projects and their extensions, and managing the OpenMMLab model zoo.

Major Features

  • Package Management

    You can use MIM to manage OpenMMLab codebases, install or uninstall them conveniently.

  • Model Management

    You can use MIM to manage OpenMMLab model zoo, e.g., download checkpoints by name, search checkpoints that meet specific criteria.

  • Unified Entrypoint for Scripts

    You can execute any script provided by all OpenMMLab codebases with unified commands. Train, test and inference become easier than ever. Besides, you can use gridsearch command for vanilla hyper-parameter search.

License

This project is released under the Apache 2.0 license.

Changelog

v0.1.1 was released in 13/6/2021.

Customization

You can use .mimrc for customization. Now we support customize default values of each sub-command. Please refer to customization.md for details.

Build custom projects with MIM

We provide some examples of how to build custom projects based on OpenMMLAB codebases and MIM in MIM-Example. Without worrying about copying codes and scripts from existing codebases, users can focus on developing new components and MIM helps integrate and run the new project.

Installation

Please refer to installation.md for installation.

Command

1. install
  • command

    # install latest version of mmcv-full
    > mim install mmcv-full  # wheel
    # install 1.5.0
    > mim install mmcv-full==1.5.0
    
    # install latest version of mmcls
    > mim install mmcls
    # install master branch
    > mim install git+https://github.com/open-mmlab/mmclassification.git
    # install local repo
    > git clone https://github.com/open-mmlab/mmclassification.git
    > cd mmclassification
    > mim install .
    
    # install extension based on OpenMMLab
    mim install git+https://github.com/xxx/mmcls-project.git
  • api

    from mim import install
    
    # install mmcv
    install('mmcv-full')
    
    # install mmcls will automatically install mmcv if it is not installed
    install('mmcls')
    
    # install extension based on OpenMMLab
    install('git+https://github.com/xxx/mmcls-project.git')
2. uninstall
  • command

    # uninstall mmcv
    > mim uninstall mmcv-full
    
    # uninstall mmcls
    > mim uninstall mmcls
  • api

    from mim import uninstall
    
    # uninstall mmcv
    uninstall('mmcv-full')
    
    # uninstall mmcls
    uninstall('mmcls')
3. list
  • command

    > mim list
    > mim list --all
  • api

    from mim import list_package
    
    list_package()
    list_package(True)
4. search
  • command

    > mim search mmcls
    > mim search mmcls==0.23.0 --remote
    > mim search mmcls --config resnet18_8xb16_cifar10
    > mim search mmcls --model resnet
    > mim search mmcls --dataset cifar-10
    > mim search mmcls --valid-field
    > mim search mmcls --condition 'batch_size>45,epochs>100'
    > mim search mmcls --condition 'batch_size>45 epochs>100'
    > mim search mmcls --condition '128<batch_size<=256'
    > mim search mmcls --sort batch_size epochs
    > mim search mmcls --field epochs batch_size weight
    > mim search mmcls --exclude-field weight paper
  • api

    from mim import get_model_info
    
    get_model_info('mmcls')
    get_model_info('mmcls==0.23.0', local=False)
    get_model_info('mmcls', models=['resnet'])
    get_model_info('mmcls', training_datasets=['cifar-10'])
    get_model_info('mmcls', filter_conditions='batch_size>45,epochs>100')
    get_model_info('mmcls', filter_conditions='batch_size>45 epochs>100')
    get_model_info('mmcls', filter_conditions='128<batch_size<=256')
    get_model_info('mmcls', sorted_fields=['batch_size', 'epochs'])
    get_model_info('mmcls', shown_fields=['epochs', 'batch_size', 'weight'])
5. download
  • command

    > mim download mmcls --config resnet18_8xb16_cifar10
    > mim download mmcls --config resnet18_8xb16_cifar10 --dest .
  • api

    from mim import download
    
    download('mmcls', ['resnet18_8xb16_cifar10'])
    download('mmcls', ['resnet18_8xb16_cifar10'], dest_root='.')
6. train
  • command

    # Train models on a single server with CPU by setting `gpus` to 0 and
    # 'launcher' to 'none' (if applicable). The training script of the
    # corresponding codebase will fail if it doesn't support CPU training.
    > mim train mmcls resnet101_b16x8_cifar10.py --work-dir tmp --gpus 0
    # Train models on a single server with one GPU
    > mim train mmcls resnet101_b16x8_cifar10.py --work-dir tmp --gpus 1
    # Train models on a single server with 4 GPUs and pytorch distributed
    > mim train mmcls resnet101_b16x8_cifar10.py --work-dir tmp --gpus 4 \
        --launcher pytorch
    # Train models on a slurm HPC with one 8-GPU node
    > mim train mmcls resnet101_b16x8_cifar10.py --launcher slurm --gpus 8 \
        --gpus-per-node 8 --partition partition_name --work-dir tmp
    # Print help messages of sub-command train
    > mim train -h
    # Print help messages of sub-command train and the training script of mmcls
    > mim train mmcls -h
  • api

    from mim import train
    
    train(repo='mmcls', config='resnet18_8xb16_cifar10.py', gpus=0,
          other_args='--work-dir tmp')
    train(repo='mmcls', config='resnet18_8xb16_cifar10.py', gpus=1,
          other_args='--work-dir tmp')
    train(repo='mmcls', config='resnet18_8xb16_cifar10.py', gpus=4,
          launcher='pytorch', other_args='--work-dir tmp')
    train(repo='mmcls', config='resnet18_8xb16_cifar10.py', gpus=8,
          launcher='slurm', gpus_per_node=8, partition='partition_name',
          other_args='--work-dir tmp')
7. test
  • command

    # Test models on a single server with 1 GPU, report accuracy
    > mim test mmcls resnet101_b16x8_cifar10.py --checkpoint \
        tmp/epoch_3.pth --gpus 1 --metrics accuracy
    # Test models on a single server with 1 GPU, save predictions
    > mim test mmcls resnet101_b16x8_cifar10.py --checkpoint \
        tmp/epoch_3.pth --gpus 1 --out tmp.pkl
    # Test models on a single server with 4 GPUs, pytorch distributed,
    # report accuracy
    > mim test mmcls resnet101_b16x8_cifar10.py --checkpoint \
        tmp/epoch_3.pth --gpus 4 --launcher pytorch --metrics accuracy
    # Test models on a slurm HPC with one 8-GPU node, report accuracy
    > mim test mmcls resnet101_b16x8_cifar10.py --checkpoint \
        tmp/epoch_3.pth --gpus 8 --metrics accuracy --partition \
        partition_name --gpus-per-node 8 --launcher slurm
    # Print help messages of sub-command test
    > mim test -h
    # Print help messages of sub-command test and the testing script of mmcls
    > mim test mmcls -h
  • api

    from mim import test
    test(repo='mmcls', config='resnet101_b16x8_cifar10.py',
         checkpoint='tmp/epoch_3.pth', gpus=1, other_args='--metrics accuracy')
    test(repo='mmcls', config='resnet101_b16x8_cifar10.py',
         checkpoint='tmp/epoch_3.pth', gpus=1, other_args='--out tmp.pkl')
    test(repo='mmcls', config='resnet101_b16x8_cifar10.py',
         checkpoint='tmp/epoch_3.pth', gpus=4, launcher='pytorch',
         other_args='--metrics accuracy')
    test(repo='mmcls', config='resnet101_b16x8_cifar10.py',
         checkpoint='tmp/epoch_3.pth', gpus=8, partition='partition_name',
         launcher='slurm', gpus_per_node=8, other_args='--metrics accuracy')
8. run
  • command

    # Get the Flops of a model
    > mim run mmcls get_flops resnet101_b16x8_cifar10.py
    # Publish a model
    > mim run mmcls publish_model input.pth output.pth
    # Train models on a slurm HPC with one GPU
    > srun -p partition --gres=gpu:1 mim run mmcls train \
        resnet101_b16x8_cifar10.py --work-dir tmp
    # Test models on a slurm HPC with one GPU, report accuracy
    > srun -p partition --gres=gpu:1 mim run mmcls test \
        resnet101_b16x8_cifar10.py tmp/epoch_3.pth --metrics accuracy
    # Print help messages of sub-command run
    > mim run -h
    # Print help messages of sub-command run, list all available scripts in
    # codebase mmcls
    > mim run mmcls -h
    # Print help messages of sub-command run, print the help message of
    # training script in mmcls
    > mim run mmcls train -h
  • api

    from mim import run
    
    run(repo='mmcls', command='get_flops',
        other_args='resnet101_b16x8_cifar10.py')
    run(repo='mmcls', command='publish_model',
        other_args='input.pth output.pth')
    run(repo='mmcls', command='train',
        other_args='resnet101_b16x8_cifar10.py --work-dir tmp')
    run(repo='mmcls', command='test',
        other_args='resnet101_b16x8_cifar10.py tmp/epoch_3.pth --metrics accuracy')
9. gridsearch
  • command

    # Parameter search on a single server with CPU by setting `gpus` to 0 and
    # 'launcher' to 'none' (if applicable). The training script of the
    # corresponding codebase will fail if it doesn't support CPU training.
    > mim gridsearch mmcls resnet101_b16x8_cifar10.py --work-dir tmp --gpus 0 \
        --search-args '--optimizer.lr 1e-2 1e-3'
    # Parameter search with on a single server with one GPU, search learning
    # rate
    > mim gridsearch mmcls resnet101_b16x8_cifar10.py --work-dir tmp --gpus 1 \
        --search-args '--optimizer.lr 1e-2 1e-3'
    # Parameter search with on a single server with one GPU, search
    # weight_decay
    > mim gridsearch mmcls resnet101_b16x8_cifar10.py --work-dir tmp --gpus 1 \
        --search-args '--optimizer.weight_decay 1e-3 1e-4'
    # Parameter search with on a single server with one GPU, search learning
    # rate and weight_decay
    > mim gridsearch mmcls resnet101_b16x8_cifar10.py --work-dir tmp --gpus 1 \
        --search-args '--optimizer.lr 1e-2 1e-3 --optimizer.weight_decay 1e-3 \
        1e-4'
    # Parameter search on a slurm HPC with one 8-GPU node, search learning
    # rate and weight_decay
    > mim gridsearch mmcls resnet101_b16x8_cifar10.py --work-dir tmp --gpus 8 \
        --partition partition_name --gpus-per-node 8 --launcher slurm \
        --search-args '--optimizer.lr 1e-2 1e-3 --optimizer.weight_decay 1e-3 \
        1e-4'
    # Parameter search on a slurm HPC with one 8-GPU node, search learning
    # rate and weight_decay, max parallel jobs is 2
    > mim gridsearch mmcls resnet101_b16x8_cifar10.py --work-dir tmp --gpus 8 \
        --partition partition_name --gpus-per-node 8 --launcher slurm \
        --max-jobs 2 --search-args '--optimizer.lr 1e-2 1e-3 \
        --optimizer.weight_decay 1e-3 1e-4'
    # Print the help message of sub-command search
    > mim gridsearch -h
    # Print the help message of sub-command search and the help message of the
    # training script of codebase mmcls
    > mim gridsearch mmcls -h
  • api

    from mim import gridsearch
    
    gridsearch(repo='mmcls', config='resnet101_b16x8_cifar10.py', gpus=0,
               search_args='--optimizer.lr 1e-2 1e-3',
               other_args='--work-dir tmp')
    gridsearch(repo='mmcls', config='resnet101_b16x8_cifar10.py', gpus=1,
               search_args='--optimizer.lr 1e-2 1e-3',
               other_args='--work-dir tmp')
    gridsearch(repo='mmcls', config='resnet101_b16x8_cifar10.py', gpus=1,
               search_args='--optimizer.weight_decay 1e-3 1e-4',
               other_args='--work-dir tmp')
    gridsearch(repo='mmcls', config='resnet101_b16x8_cifar10.py', gpus=1,
               search_args='--optimizer.lr 1e-2 1e-3 --optimizer.weight_decay'
                           '1e-3 1e-4',
               other_args='--work-dir tmp')
    gridsearch(repo='mmcls', config='resnet101_b16x8_cifar10.py', gpus=8,
               partition='partition_name', gpus_per_node=8, launcher='slurm',
               search_args='--optimizer.lr 1e-2 1e-3 --optimizer.weight_decay'
                           ' 1e-3 1e-4',
               other_args='--work-dir tmp')
    gridsearch(repo='mmcls', config='resnet101_b16x8_cifar10.py', gpus=8,
               partition='partition_name', gpus_per_node=8, launcher='slurm',
               max_workers=2,
               search_args='--optimizer.lr 1e-2 1e-3 --optimizer.weight_decay'
                           ' 1e-3 1e-4',
               other_args='--work-dir tmp')

Contributing

We appreciate all contributions to improve mim. Please refer to CONTRIBUTING.md for the contributing guideline.

License

This project is released under the Apache 2.0 license.

Projects in OpenMMLab

  • MMEngine: OpenMMLab foundational library for training deep learning models.
  • MMCV: OpenMMLab foundational library for computer vision.
  • MMEval: A unified evaluation library for multiple machine learning libraries.
  • MMPreTrain: OpenMMLab pre-training toolbox and benchmark.
  • MMagic: OpenMMLab Advanced, Generative and Intelligent Creation toolbox.
  • MMDetection: OpenMMLab detection toolbox and benchmark.
  • MMYOLO: OpenMMLab YOLO series toolbox and benchmark.
  • MMDetection3D: OpenMMLab's next-generation platform for general 3D object detection.
  • MMRotate: OpenMMLab rotated object detection toolbox and benchmark.
  • MMTracking: OpenMMLab video perception toolbox and benchmark.
  • MMPose: OpenMMLab pose estimation toolbox and benchmark.
  • MMSegmentation: OpenMMLab semantic segmentation toolbox and benchmark.
  • MMOCR: OpenMMLab text detection, recognition, and understanding toolbox.
  • MMHuman3D: OpenMMLab 3D human parametric model toolbox and benchmark.
  • MMSelfSup: OpenMMLab self-supervised learning toolbox and benchmark.
  • MMFewShot: OpenMMLab fewshot learning toolbox and benchmark.
  • MMAction2: OpenMMLab's next-generation action understanding toolbox and benchmark.
  • MMFlow: OpenMMLab optical flow toolbox and benchmark.
  • MMDeploy: OpenMMLab model deployment framework.
  • MMRazor: OpenMMLab model compression toolbox and benchmark.
  • Playground: A central hub for gathering and showcasing amazing projects built upon OpenMMLab.

More Repositories

1

mmdetection

OpenMMLab Detection Toolbox and Benchmark
Python
29,487
star
2

mmsegmentation

OpenMMLab Semantic Segmentation Toolbox and Benchmark.
Python
7,992
star
3

mmagic

OpenMMLab Multimodal Advanced, Generative, and Intelligent Creation Toolbox. Unlock the magic 🪄: Generative-AI (AIGC), easy-to-use APIs, awsome model zoo, diffusion models, for text-to-image generation, image/video restoration/enhancement, etc.
Jupyter Notebook
6,909
star
4

mmcv

OpenMMLab Computer Vision Foundation
Python
5,879
star
5

mmpose

OpenMMLab Pose Estimation Toolbox and Benchmark.
Python
5,625
star
6

Amphion

Amphion (/æmˈfaɪən/) is a toolkit for Audio, Music, and Speech Generation. Its purpose is to support reproducible research and help junior researchers and engineers get started in the field of audio, music, and speech generation research and development.
Python
5,482
star
7

mmdetection3d

OpenMMLab's next-generation platform for general 3D object detection.
Python
5,216
star
8

OpenPCDet

OpenPCDet Toolbox for LiDAR-based 3D Object Detection.
Python
4,658
star
9

mmocr

OpenMMLab Text Detection, Recognition and Understanding Toolbox
Python
4,270
star
10

mmaction2

OpenMMLab's Next Generation Video Understanding Toolbox and Benchmark
Python
4,236
star
11

mmtracking

OpenMMLab Video Perception Toolbox. It supports Video Object Detection (VID), Multiple Object Tracking (MOT), Single Object Tracking (SOT), Video Instance Segmentation (VIS) with a unified framework.
Python
3,538
star
12

mmpretrain

OpenMMLab Pre-training Toolbox and Benchmark
Python
3,383
star
13

mmselfsup

OpenMMLab Self-Supervised Learning Toolbox and Benchmark
Python
3,182
star
14

mmyolo

OpenMMLab YOLO series toolbox and benchmark. Implemented RTMDet, RTMDet-Rotated,YOLOv5, YOLOv6, YOLOv7, YOLOv8,YOLOX, PPYOLOE, etc.
Python
2,967
star
15

mmskeleton

A OpenMMLAB toolbox for human pose estimation, skeleton-based action recognition, and action synthesis.
Python
2,928
star
16

mmdeploy

OpenMMLab Model Deployment Framework
Python
2,744
star
17

mmgeneration

MMGeneration is a powerful toolkit for generative models, based on PyTorch and MMCV.
Python
1,881
star
18

mmaction

An open-source toolbox for action understanding based on PyTorch
Python
1,853
star
19

mmrotate

OpenMMLab Rotated Object Detection Toolbox and Benchmark
Python
1,843
star
20

mmrazor

OpenMMLab Model Compression Toolbox and Benchmark.
Python
1,470
star
21

Multimodal-GPT

Multimodal-GPT
Python
1,461
star
22

mmfashion

Open-source toolbox for visual fashion analysis based on PyTorch
Python
1,245
star
23

mmhuman3d

OpenMMLab 3D Human Parametric Model Toolbox and Benchmark
Python
1,232
star
24

mmengine

OpenMMLab Foundational Library for Training Deep Learning Models
Python
1,161
star
25

playground

A central hub for gathering and showcasing amazing projects that extend OpenMMLab with SAM and other exciting features.
Python
1,117
star
26

OpenMMLabCourse

OpenMMLab course index and stuff
Jupyter Notebook
1,000
star
27

mmflow

OpenMMLab optical flow toolbox and benchmark
Python
942
star
28

PIA

[CVPR 2024] PIA, your Personalized Image Animator. Animate your images by text prompt, combing with Dreambooth, achieving stunning videos. PIA,你的个性化图像动画生成器,利用文本提示将图像变为奇妙的动画
Python
867
star
29

mmfewshot

OpenMMLab FewShot Learning Toolbox and Benchmark
Python
697
star
30

PowerPaint

[ECCV 2024] PowerPaint, a versatile image inpainting model that supports text-guided object inpainting, object removal, image outpainting and shape-guided object inpainting with only a single model. 一个高质量多功能的图像修补模型,可以同时支持插入物体、移除物体、图像扩展、形状可控的物体生成,只需要一个模型
Python
526
star
31

awesome-vit

400
star
32

OpenUnReID

PyTorch open-source toolbox for unsupervised or domain adaptive object re-ID.
Python
393
star
33

labelbee-client

Out-of-the-box Annotation Toolbox
JavaScript
380
star
34

FoleyCrafter

FoleyCrafter: Bring Silent Videos to Life with Lifelike and Synchronized Sounds. AI拟音大师,给你的无声视频添加生动而且同步的音效 😝
Python
379
star
35

denseflow

Extracting optical flow and frames
C++
294
star
36

mmeval

A unified evaluation library for multiple machine learning libraries
Python
254
star
37

MMGEN-FaceStylor

Python
249
star
38

labelbee

LabelBee is an annotation Library
TypeScript
244
star
39

Live2Diff

Live2Diff: A Pipeline that processes Live video streams by a uni-directional video Diffusion model.
Python
150
star
40

OpenMMLabCamp

Jupyter Notebook
93
star
41

polynet

The Github Repo for PolyNet
77
star
42

CLUE

C++ Lightweight Utility Extensions
C++
70
star
43

AnyControl

[ECCV 2024] AnyControl, a multi-control image synthesis model that supports any combination of user provided control signals. 一个支持用户自由输入控制信号的图像生成模型,能够根据多种控制生成自然和谐的结果!
Python
66
star
44

StyleShot

StyleShot: A SnapShot on Any Style. 一款可以迁移任意风格到任意内容的模型,无需针对图片微调,即能生成高质量的个性风格化图片!
Python
59
star
45

mim-example

Python
58
star
46

mmengine-template

Python
49
star
47

ecosystem

37
star
48

mmstyles

Latex style file to facilitate writing of technical papers
TeX
37
star
49

mmpose-webcam-demo

Python
25
star
50

pre-commit-hooks

Python
17
star
51

mdformat-openmmlab

Python
6
star
52

.github

4
star