{"id":24053,"library":"mmsegmentation","title":"MMSegmentation","description":"MMSegmentation is an open-source semantic segmentation toolbox based on PyTorch, part of the OpenMMLab project. It provides a unified framework for training, testing, and deploying segmentation models, supporting a wide range of architectures (e.g., DeepLabV3+, PSPNet, U-Net) and datasets. Current version is 1.2.2 (Dec 2023), with a major v1.0.0 release marking a structural overhaul from v0.x. Release cadence is irregular, with minor patches every few months.","status":"active","version":"1.2.2","language":"python","source_language":"en","source_url":"https://github.com/open-mmlab/mmsegmentation","tags":["segmentation","deep-learning","pytorch","openmmlab"],"install":[{"cmd":"pip install mmsegmentation==1.2.2","lang":"bash","label":"Latest stable"}],"dependencies":[{"reason":"Core dependency; must match mmsegmentation version (mmcv>=2.0.0 for v1.x)","package":"mmcv","optional":false},{"reason":"Required for config and runner infrastructure in mmseg v1.x","package":"mmengine","optional":false}],"imports":[{"note":"Recommended high-level inference API in v1.x","symbol":"MMSegInferencer","correct":"from mmseg.apis import MMSegInferencer"},{"note":"init_model is not in mmseg.models; it was moved to mmseg.apis in v1.x","wrong":"from mmseg.models import init_model","symbol":"init_model","correct":"from mmseg.apis import init_model"},{"note":"inference_model was moved from mmseg.core to mmseg.apis in v1.x","wrong":"from mmseg.core import inference","symbol":"inference_model","correct":"from mmseg.apis import inference_model"}],"quickstart":{"code":"from mmseg.apis import MMSegInferencer\nimport os\n\n# Initialize the inferencer with a pretrained model\ninferencer = MMSegInferencer(\n    model='deeplabv3plus_r18-d8_4xb2-80k_cityscapes-512x1024',\n    device='cuda' if os.environ.get('CUDA_VISIBLE_DEVICES') else 'cpu'\n)\n\n# Run inference on an image\nresult = inferencer('demo/demo.png')\nprint(result['predictions'].shape)\n","lang":"python","description":"Perform semantic segmentation inference using the high-level inferencer API."},"warnings":[{"fix":"Migrate configs to the new format using mmseg's migration tools or rewrite for v1.x. Use mmcv>=2.0.0.","message":"MMSegmentation v1.0.0 is a major rewrite from v0.x. Configs, APIs, and model definitions are not backward-compatible. Do not mix mmseg v1.x with mmcv<2.0.0.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Use 'from mmseg.apis import init_model, inference_model'.","message":"The 'inference_model' and 'init_model' functions are imported from 'mmseg.apis', not 'mmseg.models' or 'mmseg.core'. Common mistake leads to ImportError.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Update imports to use mmseg.apis instead of mmseg.core.","message":"The 'mmseg.core' module is deprecated in v1.x. Functions like 'inference' and 'segmentation' were moved to mmseg.apis.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Always define 'palette' in the dataset config and ensure it matches the order of classes in 'classes'.","message":"When using custom datasets, the class palette must be defined correctly in the config. Missing or misordered palette can cause silent mislabeling.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install a compatible version: pip install mmcv>=2.0.0,<2.2.0","cause":"MMSegmentation requires mmcv (OpenMMLab Computer Vision) as a dependency. It is not installed automatically with pip install mmsegmentation.","error":"ModuleNotFoundError: No module named 'mmcv'"},{"fix":"Use: from mmseg.apis import init_model","cause":"Incorrect import path; init_model is in mmseg.apis, not mmseg directly.","error":"AttributeError: module 'mmseg' has no attribute 'init_model'"},{"fix":"Use mmengine's Config API: from mmengine.config import Config; cfg = Config.fromfile('path/to/config.py')","cause":"MMSegmentation expects config files in a specific format and path. Using a relative path without proper resolution causes failure.","error":"FileNotFoundError: config file not found"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}