1. Config的pipeline配置

image.png

Compose
to_tensor
ToTensor
ImageToTensor
ToDataContainer
Transpose
Collect
DefaultFormatBundle
LoadAnnotations
LoadImageFromFile
LoadImageFromWebcam
LoadMultiChannelImageFromFiles
LoadProposals
MultiScaleFlipAug
Resize
RandomFlip
Pad
RandomCrop
Normalize
SegRescale
MinIoURandomCrop
Expand
PhotoMetricDistortion
Albu
InstaBoost
RandomCenterCropPad
AutoAugment
CutOut
Shear
Rotate
ColorTransform
EqualizeTransform
BrightnessTransform
ContrastTransform
Translate
RandomShift
Mosaic
MixUp
RandomAffine

2. 自定义Pipeline

  1. # Copyright (c) OpenMMLab. All rights reserved.
  2. import os.path as osp
  3. import mmcv
  4. import numpy as np
  5. import pycocotools.mask as maskUtils
  6. from mmdet.core import BitmapMasks, PolygonMasks
  7. from ..builder import PIPELINES
  8. try:
  9. from panopticapi.utils import rgb2id
  10. except ImportError:
  11. rgb2id = None
  12. @PIPELINES.register_module()
  13. class MiddleDebug:
  14. """Load an image from file.
  15. Required keys are "img_prefix" and "img_info" (a dict that must contain the
  16. key "filename"). Added or updated keys are "filename", "img", "img_shape",
  17. "ori_shape" (same as `img_shape`), "pad_shape" (same as `img_shape`),
  18. "scale_factor" (1.0) and "img_norm_cfg" (means=0 and stds=1).
  19. Args:
  20. to_float32 (bool): Whether to convert the loaded image to a float32
  21. numpy array. If set to False, the loaded image is an uint8 array.
  22. Defaults to False.
  23. color_type (str): The flag argument for :func:`mmcv.imfrombytes`.
  24. Defaults to 'color'.
  25. file_client_args (dict): Arguments to instantiate a FileClient.
  26. See :class:`mmcv.fileio.FileClient` for details.
  27. Defaults to ``dict(backend='disk')``.
  28. """
  29. def __init__(self, mode=1):
  30. self.mode = 1
  31. def __call__(self, results):
  32. """Call functions to load image and get image meta information.
  33. Args:
  34. results (dict): Result dict from :obj:`mmdet.CustomDataset`.
  35. Returns:
  36. dict: The dict contains loaded image and meta information.
  37. """
  38. print(results)
  39. return results

3. Pipline中一些图像增强操作

3.1 LoadImageFromFile

LoadAnnotations

AutoAugment