Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
a5287972
M
mindspore
项目概览
magicwindyyd
/
mindspore
与 Fork 源项目一致
Fork自
MindSpore / mindspore
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindspore
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
a5287972
编写于
5月 22, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
5月 22, 2020
浏览文件
操作
浏览文件
下载
差异文件
!1377 Code Fix for Uniform Augmentation
Merge pull request !1377 from Tinazhang/cc
上级
45843618
b390883c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
31 addition
and
3 deletion
+31
-3
mindspore/dataset/transforms/vision/validators.py
mindspore/dataset/transforms/vision/validators.py
+3
-0
tests/ut/python/dataset/test_uniform_augment.py
tests/ut/python/dataset/test_uniform_augment.py
+28
-3
未找到文件。
mindspore/dataset/transforms/vision/validators.py
浏览文件 @
a5287972
...
...
@@ -830,6 +830,9 @@ def check_uniform_augmentation(method):
else
:
num_ops
=
2
if
not
isinstance
(
num_ops
,
int
):
raise
ValueError
(
"Number of operations should be an integer."
)
if
num_ops
<=
0
:
raise
ValueError
(
"num_ops should be greater than zero"
)
if
num_ops
>
len
(
operations
):
...
...
tests/ut/python/dataset/test_uniform_augment.py
浏览文件 @
a5287972
...
...
@@ -226,16 +226,40 @@ def test_cpp_uniform_augment_exception_nonpositive_numops(num_ops=0):
logger
.
info
(
"Got an exception in DE: {}"
.
format
(
str
(
e
)))
assert
"num_ops"
in
str
(
e
)
def
test_cpp_uniform_augment_random_crop_ut
():
def
test_cpp_uniform_augment_exception_float_numops
(
num_ops
=
2.5
):
"""
Test UniformAugment invalid float number of ops
"""
logger
.
info
(
"Test CPP UniformAugment invalid float num_ops exception"
)
transforms_ua
=
[
C
.
RandomCrop
(
size
=
[
224
,
224
],
padding
=
[
32
,
32
,
32
,
32
]),
C
.
RandomHorizontalFlip
(),
C
.
RandomVerticalFlip
(),
C
.
RandomColorAdjust
(),
C
.
RandomRotation
(
degrees
=
45
)]
try
:
uni_aug
=
C
.
UniformAugment
(
operations
=
transforms_ua
,
num_ops
=
num_ops
)
except
BaseException
as
e
:
logger
.
info
(
"Got an exception in DE: {}"
.
format
(
str
(
e
)))
assert
"integer"
in
str
(
e
)
def
test_cpp_uniform_augment_random_crop_badinput
(
num_ops
=
1
):
"""
Test UniformAugment with greater crop size
"""
logger
.
info
(
"Test CPP UniformAugment with random_crop bad input"
)
batch_size
=
2
cifar10_dir
=
"../data/dataset/testCifar10Data"
ds1
=
de
.
Cifar10Dataset
(
cifar10_dir
,
shuffle
=
False
)
# shape = [32,32,3]
transforms_ua
=
[
# Note: crop size [224, 224] > image size [32, 32]
C
.
RandomCrop
(
size
=
[
224
,
224
]),
C
.
RandomHorizontalFlip
()
]
uni_aug
=
C
.
UniformAugment
(
operations
=
transforms_ua
,
num_ops
=
1
)
uni_aug
=
C
.
UniformAugment
(
operations
=
transforms_ua
,
num_ops
=
num_ops
)
ds1
=
ds1
.
map
(
input_columns
=
"image"
,
operations
=
uni_aug
)
# apply DatasetOps
...
...
@@ -254,4 +278,5 @@ if __name__ == "__main__":
test_cpp_uniform_augment_exception_pyops
(
num_ops
=
1
)
test_cpp_uniform_augment_exception_large_numops
(
num_ops
=
6
)
test_cpp_uniform_augment_exception_nonpositive_numops
(
num_ops
=
0
)
test_cpp_uniform_augment_random_crop_ut
()
test_cpp_uniform_augment_exception_float_numops
(
num_ops
=
2.5
)
test_cpp_uniform_augment_random_crop_badinput
(
num_ops
=
1
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录