Commit 428512f8 authored by Ma Zerun's avatar Ma Zerun Committed by zhouzaida
Browse files

Rename `LoadAnnotation` to `LoadAnnotations` (#1850)

parent b7525fae
...@@ -74,7 +74,7 @@ dataset = dict( ...@@ -74,7 +74,7 @@ dataset = dict(
| class | 功能 | | class | 功能 |
| :---------------------------: | :---------------------------------------: | | :---------------------------: | :---------------------------------------: |
| [`LoadImageFromFile`](TODO) | 根据路径加载图像 | | [`LoadImageFromFile`](TODO) | 根据路径加载图像 |
| [`LoadAnnotation`](TODO) | 加载和组织标注信息,如 bbox、语义分割图等 | | [`LoadAnnotations`](TODO) | 加载和组织标注信息,如 bbox、语义分割图等 |
### 数据预处理及增强 ### 数据预处理及增强
......
# Copyright (c) OpenMMLab. All rights reserved. # Copyright (c) OpenMMLab. All rights reserved.
from .builder import TRANSFORMS from .builder import TRANSFORMS
from .loading import LoadAnnotation, LoadImageFromFile from .loading import LoadAnnotations, LoadImageFromFile
from .processing import (CenterCrop, MultiScaleFlipAug, Normalize, Pad, from .processing import (CenterCrop, MultiScaleFlipAug, Normalize, Pad,
RandomChoiceResize, RandomFlip, RandomGrayscale, RandomChoiceResize, RandomFlip, RandomGrayscale,
RandomResize, Resize) RandomResize, Resize)
...@@ -11,7 +11,7 @@ try: ...@@ -11,7 +11,7 @@ try:
except ImportError: except ImportError:
__all__ = [ __all__ = [
'TRANSFORMS', 'TransformBroadcaster', 'Compose', 'RandomChoice', 'TRANSFORMS', 'TransformBroadcaster', 'Compose', 'RandomChoice',
'KeyMapper', 'LoadImageFromFile', 'LoadAnnotation', 'Normalize', 'KeyMapper', 'LoadImageFromFile', 'LoadAnnotations', 'Normalize',
'Resize', 'Pad', 'RandomFlip', 'RandomChoiceResize', 'CenterCrop', 'Resize', 'Pad', 'RandomFlip', 'RandomChoiceResize', 'CenterCrop',
'RandomGrayscale', 'MultiScaleFlipAug', 'RandomResize' 'RandomGrayscale', 'MultiScaleFlipAug', 'RandomResize'
] ]
...@@ -20,7 +20,7 @@ else: ...@@ -20,7 +20,7 @@ else:
__all__ = [ __all__ = [
'TRANSFORMS', 'TransformBroadcaster', 'Compose', 'RandomChoice', 'TRANSFORMS', 'TransformBroadcaster', 'Compose', 'RandomChoice',
'KeyMapper', 'LoadImageFromFile', 'LoadAnnotation', 'Normalize', 'KeyMapper', 'LoadImageFromFile', 'LoadAnnotations', 'Normalize',
'Resize', 'Pad', 'ToTensor', 'to_tensor', 'ImageToTensor', 'Resize', 'Pad', 'ToTensor', 'to_tensor', 'ImageToTensor',
'RandomFlip', 'RandomChoiceResize', 'CenterCrop', 'RandomGrayscale', 'RandomFlip', 'RandomChoiceResize', 'CenterCrop', 'RandomGrayscale',
'MultiScaleFlipAug', 'RandomResize' 'MultiScaleFlipAug', 'RandomResize'
......
...@@ -84,7 +84,7 @@ class LoadImageFromFile(BaseTransform): ...@@ -84,7 +84,7 @@ class LoadImageFromFile(BaseTransform):
return repr_str return repr_str
class LoadAnnotation(BaseTransform): class LoadAnnotations(BaseTransform):
"""Load and process the ``instances`` and ``seg_map`` annotation provided """Load and process the ``instances`` and ``seg_map`` annotation provided
by dataset. by dataset.
......
...@@ -4,7 +4,7 @@ import os.path as osp ...@@ -4,7 +4,7 @@ import os.path as osp
import numpy as np import numpy as np
from mmcv.transforms import LoadAnnotation, LoadImageFromFile from mmcv.transforms import LoadAnnotations, LoadImageFromFile
class TestLoadImageFromFile: class TestLoadImageFromFile:
...@@ -44,7 +44,7 @@ class TestLoadImageFromFile: ...@@ -44,7 +44,7 @@ class TestLoadImageFromFile:
assert results['img'].dtype == np.uint8 assert results['img'].dtype == np.uint8
class TestLoadAnnotation: class TestLoadAnnotations:
def setup_class(cls): def setup_class(cls):
data_prefix = osp.join(osp.dirname(__file__), '../data') data_prefix = osp.join(osp.dirname(__file__), '../data')
...@@ -64,7 +64,7 @@ class TestLoadAnnotation: ...@@ -64,7 +64,7 @@ class TestLoadAnnotation:
} }
def test_load_bboxes(self): def test_load_bboxes(self):
transform = LoadAnnotation( transform = LoadAnnotations(
with_bbox=True, with_bbox=True,
with_label=False, with_label=False,
with_seg=False, with_seg=False,
...@@ -76,7 +76,7 @@ class TestLoadAnnotation: ...@@ -76,7 +76,7 @@ class TestLoadAnnotation:
[10, 10, 110, 120]])).all() [10, 10, 110, 120]])).all()
def test_load_labels(self): def test_load_labels(self):
transform = LoadAnnotation( transform = LoadAnnotations(
with_bbox=False, with_bbox=False,
with_label=True, with_label=True,
with_seg=False, with_seg=False,
...@@ -87,7 +87,7 @@ class TestLoadAnnotation: ...@@ -87,7 +87,7 @@ class TestLoadAnnotation:
assert (results['gt_bboxes_labels'] == np.array([1, 2])).all() assert (results['gt_bboxes_labels'] == np.array([1, 2])).all()
def test_load_kps(self): def test_load_kps(self):
transform = LoadAnnotation( transform = LoadAnnotations(
with_bbox=False, with_bbox=False,
with_label=False, with_label=False,
with_seg=False, with_seg=False,
...@@ -99,7 +99,7 @@ class TestLoadAnnotation: ...@@ -99,7 +99,7 @@ class TestLoadAnnotation:
[[4, 5, 6]]])).all() [[4, 5, 6]]])).all()
def test_load_seg_map(self): def test_load_seg_map(self):
transform = LoadAnnotation( transform = LoadAnnotations(
with_bbox=False, with_bbox=False,
with_label=False, with_label=False,
with_seg=True, with_seg=True,
...@@ -110,14 +110,14 @@ class TestLoadAnnotation: ...@@ -110,14 +110,14 @@ class TestLoadAnnotation:
assert results['gt_seg_map'].shape[:2] == (300, 400) assert results['gt_seg_map'].shape[:2] == (300, 400)
def test_repr(self): def test_repr(self):
transform = LoadAnnotation( transform = LoadAnnotations(
with_bbox=True, with_bbox=True,
with_label=False, with_label=False,
with_seg=False, with_seg=False,
with_keypoints=False, with_keypoints=False,
) )
assert repr(transform) == ( assert repr(transform) == (
'LoadAnnotation(with_bbox=True, ' 'LoadAnnotations(with_bbox=True, '
'with_label=False, with_seg=False, ' 'with_label=False, with_seg=False, '
"with_keypoints=False, imdecode_backend='cv2', " "with_keypoints=False, imdecode_backend='cv2', "
"file_client_args={'backend': 'disk'})") "file_client_args={'backend': 'disk'})")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment