{"id":9122,"library":"mmcv","title":"MMCV: OpenMMLab Computer Vision Foundation","description":"MMCV (OpenMMLab Computer Vision Foundation) is a foundational library for computer vision research and development, providing a comprehensive set of building blocks including rich data augmentation and transformation operations, various deep learning utilities, and support for hardware-specific optimizations. It is a core component of the OpenMMLab ecosystem. The current version is 2.2.0, with frequent releases to add features, bug fixes, and support for new PyTorch versions and hardware platforms.","status":"active","version":"2.2.0","language":"python","source_language":"en","source_url":"https://github.com/open-mmlab/mmcv","tags":["computer-vision","deep-learning","pytorch","openmmlab","data-augmentation","utilities"],"install":[{"cmd":"pip install -U openmim\nmim install mmcv-full","lang":"bash","label":"Recommended (with CUDA/hardware extensions)"},{"cmd":"pip install mmcv","lang":"bash","label":"Basic version (without CUDA/hardware extensions)"}],"dependencies":[{"reason":"Core deep learning framework dependency for models and operations.","package":"torch","optional":false},{"reason":"Since v2.0.0, core training components like Runner, Hook, and optimizers are provided by MMEngine.","package":"mmengine","optional":false}],"imports":[{"note":"While mmengine.Config is also commonly used in MMEngine-based projects, mmcv.Config remains for general configuration parsing.","symbol":"Config","correct":"from mmcv import Config"},{"note":"As of v2.0.0, training-related modules like Runner, Hook, and Parallel moved from MMCV to MMEngine.","wrong":"from mmcv.runner import Runner","symbol":"Runner","correct":"from mmengine.runner import Runner"},{"note":"The import path for build_from_cfg changed in v2.x to mmcv.registry.","wrong":"from mmcv.cnn import build_from_cfg","symbol":"build_from_cfg","correct":"from mmcv.registry import build_from_cfg"},{"note":"Data augmentation and transformation pipelines moved to mmcv.transforms in v2.x.","wrong":"from mmcv.datasets.pipelines import Compose","symbol":"Compose","correct":"from mmcv.transforms import Compose"}],"quickstart":{"code":"from mmcv import Config\nfrom mmcv.transforms import Compose, Resize, RandomFlip\nimport numpy as np\n\n# 1. Load a config (can be a dummy dict or a path to a .py config file)\ncfg_dict = dict(\n    model=dict(\n        type='ResNet',\n        depth=50,\n        num_classes=1000\n    ),\n    data=dict(\n        train_pipeline=[\n            dict(type='Resize', scale=(224, 224)),\n            dict(type='RandomFlip', prob=0.5)\n        ]\n    )\n)\ncfg = Config(cfg_dict)\nprint(f\"Loaded config model type: {cfg.model.type}\")\n\n# 2. Use data transforms\npipeline = Compose([\n    Resize(scale=(256, 256)),\n    RandomFlip(prob=0.5)\n])\n\n# Dummy image data\ndummy_img = np.random.rand(512, 512, 3).astype(np.uint8)\ndata_sample = dict(img=dummy_img, img_shape=dummy_img.shape[:2], ori_shape=dummy_img.shape[:2])\n\ntransformed_data = pipeline(data_sample)\nprint(f\"Original image shape: {data_sample['img'].shape}\")\nprint(f\"Transformed image shape: {transformed_data['img'].shape}\")","lang":"python","description":"This quickstart demonstrates loading a configuration using `mmcv.Config` and applying basic image transformations with `mmcv.transforms.Compose` and `Resize`/`RandomFlip`. It showcases the core utilities of MMCV for managing configurations and data pipelines, essential for computer vision tasks."},"warnings":[{"fix":"Update imports to use `mmengine` for these modules (e.g., `from mmengine.runner import Runner`). Ensure `mmengine` is installed alongside `mmcv`.","message":"MMCV v2.0.0 introduced significant breaking changes by moving training-related modules (like `Runner`, `Hook`, `Optimizer`) to a new library, `MMEngine`. Direct imports from `mmcv.runner` or similar paths will fail.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"First, install `openmim` (`pip install -U openmim`), then use `mim install mmcv-full`. Refer to the official installation guide for specific PyTorch and CUDA version compatibility.","message":"Installing `mmcv-full` (the version with CUDA/hardware extensions) via `pip install mmcv-full` can be problematic and may result in a CPU-only build or version mismatches. The `mim` tool is highly recommended for managing `mmcv-full` installations.","severity":"gotcha","affected_versions":"All versions with CUDA extensions"},{"fix":"Always check the official MMCV installation guide for the exact PyTorch and CUDA versions supported by your chosen `mmcv-full` version. Use `mim install mmcv-full` to leverage OpenMMLab's pre-built packages which handle compatibility.","message":"MMCV-full has strict compatibility requirements with PyTorch and CUDA versions. Mismatched versions can lead to runtime errors (e.g., CUDA kernel errors) or unexpected behavior.","severity":"gotcha","affected_versions":"All versions requiring CUDA/hardware extensions"},{"fix":"Update import paths to `from mmcv.transforms import Compose` and similarly for other transformation components.","message":"The paths for data transformation pipelines and utilities (e.g., `Compose`) changed in v2.x. Old imports like `from mmcv.datasets.pipelines import Compose` are no longer correct.","severity":"breaking","affected_versions":">=2.0.0"}],"env_vars":null,"search_vec":"'2.2.0':59 'add':64 'augment':31,87 'block':27 'bug':66 'build':26 'compon':50 'comprehens':23 'comput':3,8,16,78 'computer-vis':77 'core':49 'current':56 'data':30,86 'data-augment':85 'deep':36,81 'deep-learn':80 'develop':20 'ecosystem':54 'featur':65 'fix':67 'foundat':5,10,13 'frequent':61 'hardwar':43,75 'hardware-specif':42 'includ':28 'learn':37,82 'librari':14 'mmcv':1,6 'new':71 'openmmlab':2,7,53,84 'oper':34 'optim':45 'platform':76 'provid':21 'pytorch':72,83 'releas':62 'research':18 'rich':29 'set':24 'specif':44 'support':40,69 'transform':33 'util':38,88 'various':35 'version':57,73 'vision':4,9,17,79","created_at":"2026-04-16T18:48:35.021145+00:00","updated_at":"2026-04-16T18:48:35.021145+00:00","problems":{"verify_error":"error: unexpected argument '- ' found\n\n  tip: to pass '- ' as a value, use '-- - '\n\nUsage: uv pip install [OPTIONS] <PACKAGE|--requirements <REQUIREMENTS>|--editable <EDITABLE>|--group <GROUP>>\n\nFor more information, try '--help'."},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"2.2.0","cli_name":"","cli_version":null,"type":"library","homepage":"https://mmcv.readthedocs.io","github":"https://github.com/open-mmlab/mmcv","docs":null,"changelog":null,"pypi":"https://pypi.org/project/mmcv/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["ai-ml"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"install_fail","verified_at":"2026-06-28","last_verified":"2026-06-28","next_check":"2026-07-05","install_tag":null}}