Shortcuts

LoadImageFromFile

class mmcv.transforms.LoadImageFromFile(to_float32: bool = False, color_type: str = 'color', imdecode_backend: str = 'cv2', file_client_args: Optional[dict] = None, ignore_empty: bool = False, *, backend_args: Optional[dict] = None)[源代码]

Load an image from file.

Required Keys:

  • img_path

Modified Keys:

  • img

  • img_shape

  • ori_shape

参数
  • to_float32 (bool) – Whether to convert the loaded image to a float32 numpy array. If set to False, the loaded image is an uint8 array. Defaults to False.

  • color_type (str) – The flag argument for mmcv.imfrombytes(). Defaults to ‘color’.

  • imdecode_backend (str) – The image decoding backend type. The backend argument for mmcv.imfrombytes(). See mmcv.imfrombytes() for details. Defaults to ‘cv2’.

  • file_client_args (dict, optional) – Arguments to instantiate a FileClient. See mmengine.fileio.FileClient for details. Defaults to None. It will be deprecated in future. Please use backend_args instead. Deprecated in version 2.0.0rc4.

  • ignore_empty (bool) – Whether to allow loading empty image or file path not existent. Defaults to False.

  • backend_args (dict, optional) – Instantiates the corresponding file backend. It may contain backend key to specify the file backend. If it contains, the file backend corresponding to this value will be used and initialized with the remaining values, otherwise the corresponding file backend will be selected based on the prefix of the file path. Defaults to None. New in version 2.0.0rc4.

transform(results: dict)Optional[dict][源代码]

Functions to load image.

参数

results (dict) – Result dict from mmengine.dataset.BaseDataset.

返回

The dict contains loaded image and meta information.

返回类型

dict

Read the Docs v: stable
Versions
latest
stable
2.x
v2.0.1
v2.0.0
1.x
v1.7.1
v1.7.0
v1.6.2
v1.6.1
v1.6.0
v1.5.3
v1.5.2_a
v1.5.1
v1.5.0
v1.4.8
v1.4.7
v1.4.6
v1.4.5
v1.4.4
v1.4.3
v1.4.2
v1.4.1
v1.4.0
v1.3.18
v1.3.17
v1.3.16
v1.3.15
v1.3.14
v1.3.13
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.