mirror of
https://github.com/open-mmlab/mmsegmentation.git
synced 2025-06-03 22:03:48 +08:00
* [WIP] Refine documentation * get started done * config refine * train_test * refine user guides * add contribution * add contribution * refine visualization * advanced tutorial * advanced guides * tricks * refine zh doc * refactor changelog
979 B
979 B
Adding New Data Transforms
-
Write a new pipeline in any file, e.g.,
my_pipeline.py
. It takes a dict as input and return a dict.from mmseg.datasets import TRANSFORMS @TRANSFORMS.register_module() class MyTransform: def transform(self, results): results['dummy'] = True return results
-
Import the new class.
from .my_pipeline import MyTransform
-
Use it in config files.
crop_size = (512, 1024) train_pipeline = [ dict(type='LoadImageFromFile'), dict(type='LoadAnnotations'), dict(type='RandomResize', scale=(2048, 1024), ratio_range=(0.5, 2.0), keep_ratio=True), dict(type='RandomCrop', crop_size=crop_size, cat_max_ratio=0.75), dict(type='RandomFlip', flip_ratio=0.5), dict(type='PhotoMetricDistortion'), dict(type='MyTransform'), dict(type='PackSegInputs'), ]