{"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.","language":"python","status":"active","last_verified":"Thu Apr 16","install":{"commands":["pip install -U openmim\nmim install mmcv-full","pip install mmcv"],"cli":null},"imports":["from mmcv import Config","from mmengine.runner import Runner","from mmcv.registry import build_from_cfg","from mmcv.transforms import Compose"],"auth":{"required":false,"env_vars":[]},"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.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}