Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
MMCV
Commits
428512f8
Commit
428512f8
authored
Apr 01, 2022
by
Ma Zerun
Committed by
zhouzaida
Jul 19, 2022
Browse files
Rename `LoadAnnotation` to `LoadAnnotations` (#1850)
parent
b7525fae
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
13 deletions
+13
-13
docs/zh_cn/understand_mmcv/data_transform.md
docs/zh_cn/understand_mmcv/data_transform.md
+1
-1
mmcv/transforms/__init__.py
mmcv/transforms/__init__.py
+3
-3
mmcv/transforms/loading.py
mmcv/transforms/loading.py
+1
-1
tests/test_transforms/test_transforms_loading.py
tests/test_transforms/test_transforms_loading.py
+8
-8
No files found.
docs/zh_cn/understand_mmcv/data_transform.md
View file @
428512f8
...
@@ -74,7 +74,7 @@ dataset = dict(
...
@@ -74,7 +74,7 @@ dataset = dict(
| class | 功能 |
| class | 功能 |
| :---------------------------: | :---------------------------------------: |
| :---------------------------: | :---------------------------------------: |
|
[
`LoadImageFromFile`
](
TODO
)
| 根据路径加载图像 |
|
[
`LoadImageFromFile`
](
TODO
)
| 根据路径加载图像 |
|
[
`LoadAnnotation`
](
TODO
)
| 加载和组织标注信息,如 bbox、语义分割图等 |
|
[
`LoadAnnotation
s
`
](
TODO
)
| 加载和组织标注信息,如 bbox、语义分割图等 |
### 数据预处理及增强
### 数据预处理及增强
...
...
mmcv/transforms/__init__.py
View file @
428512f8
# 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
LoadAnnotation
s
,
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'
,
'LoadAnnotation
s
'
,
'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'
,
'LoadAnnotation
s
'
,
'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'
...
...
mmcv/transforms/loading.py
View file @
428512f8
...
@@ -84,7 +84,7 @@ class LoadImageFromFile(BaseTransform):
...
@@ -84,7 +84,7 @@ class LoadImageFromFile(BaseTransform):
return
repr_str
return
repr_str
class
LoadAnnotation
(
BaseTransform
):
class
LoadAnnotation
s
(
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.
...
...
tests/test_transforms/test_transforms_loading.py
View file @
428512f8
...
@@ -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
LoadAnnotation
s
,
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
TestLoadAnnotation
s
:
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
=
LoadAnnotation
s
(
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
=
LoadAnnotation
s
(
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
=
LoadAnnotation
s
(
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
=
LoadAnnotation
s
(
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
=
LoadAnnotation
s
(
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, '
'LoadAnnotation
s
(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'})"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment