Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
2c3c204b
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看板
提交
2c3c204b
编写于
7月 10, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
7月 10, 2020
浏览文件
操作
浏览文件
下载
差异文件
!2982 supporting cpp unit tests for randomresizewithbbox and resizewithbbox
Merge pull request !2982 from ava/CPP_test3
上级
02e797d1
b2bfb034
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
115 addition
and
0 deletion
+115
-0
tests/ut/cpp/dataset/CMakeLists.txt
tests/ut/cpp/dataset/CMakeLists.txt
+2
-0
tests/ut/cpp/dataset/random_resize_with_bbox_op_test.cc
tests/ut/cpp/dataset/random_resize_with_bbox_op_test.cc
+59
-0
tests/ut/cpp/dataset/resize_with_bbox_op_test.cc
tests/ut/cpp/dataset/resize_with_bbox_op_test.cc
+54
-0
tests/ut/data/dataset/imagefolder/ExpectedRandomResizeWithBBox_C0.jpg
...a/dataset/imagefolder/ExpectedRandomResizeWithBBox_C0.jpg
+0
-0
tests/ut/data/dataset/imagefolder/ExpectedResizeWithBBox_C0.jpg
...ut/data/dataset/imagefolder/ExpectedResizeWithBBox_C0.jpg
+0
-0
未找到文件。
tests/ut/cpp/dataset/CMakeLists.txt
浏览文件 @
2c3c204b
...
...
@@ -44,6 +44,7 @@ SET(DE_UT_SRCS
random_horizontal_flip_op_test.cc
random_horizontal_flip_with_bbox_test.cc
random_resize_op_test.cc
random_resize_with_bbox_op_test.cc
random_rotation_op_test.cc
random_vertical_flip_op_test.cc
random_vertical_flip_with_bbox_op_test.cc
...
...
@@ -53,6 +54,7 @@ SET(DE_UT_SRCS
rescale_op_test.cc
resize_bilinear_op_test.cc
resize_op_test.cc
resize_with_bbox_op_test.cc
schema_test.cc
shuffle_op_test.cc
stand_alone_samplers_test.cc
...
...
tests/ut/cpp/dataset/random_resize_with_bbox_op_test.cc
0 → 100644
浏览文件 @
2c3c204b
/**
* Copyright 2020 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "common/bboxop_common.h"
#include "dataset/kernels/image/random_resize_with_bbox_op.h"
#include "utils/log_adapter.h"
#include "dataset/core/config_manager.h"
#include "dataset/core/global_context.h"
using
namespace
mindspore
::
dataset
;
using
mindspore
::
LogStream
;
using
mindspore
::
ExceptionType
::
NoExceptionType
;
using
mindspore
::
MsLogLevel
::
INFO
;
const
bool
kSaveExpected
=
false
;
const
char
kOpName
[]
=
"RandomResizeWithBBox_C"
;
class
MindDataTestRandomResizeWithBBoxOp
:
public
UT
::
CVOP
::
BBOXOP
::
BBoxOpCommon
{
protected:
MindDataTestRandomResizeWithBBoxOp
()
:
BBoxOpCommon
()
{}
};
TEST_F
(
MindDataTestRandomResizeWithBBoxOp
,
TestOp
)
{
MS_LOG
(
INFO
)
<<
"Doing testRandomResizeWithBBox."
;
//setting seed here
u_int32_t
curr_seed
=
GlobalContext
::
config_manager
()
->
seed
();
GlobalContext
::
config_manager
()
->
set_seed
(
120
);
TensorTable
results
;
std
::
unique_ptr
<
RandomResizeWithBBoxOp
>
op
(
new
RandomResizeWithBBoxOp
(
500
));
for
(
const
auto
&
tensor_row_
:
images_and_annotations_
)
{
// selected a tensorRow
TensorRow
output_row
;
Status
s
=
op
->
Compute
(
tensor_row_
,
&
output_row
);
EXPECT_TRUE
(
s
.
IsOk
());
results
.
push_back
(
output_row
);
}
if
(
kSaveExpected
)
{
SaveImagesWithAnnotations
(
FileType
::
kExpected
,
std
::
string
(
kOpName
),
results
);
}
SaveImagesWithAnnotations
(
FileType
::
kActual
,
std
::
string
(
kOpName
),
results
);
if
(
!
kSaveExpected
)
{
CompareActualAndExpected
(
std
::
string
(
kOpName
));
}
GlobalContext
::
config_manager
()
->
set_seed
(
curr_seed
);
MS_LOG
(
INFO
)
<<
"testRandomResizeWithBBox end."
;
}
tests/ut/cpp/dataset/resize_with_bbox_op_test.cc
0 → 100644
浏览文件 @
2c3c204b
/**
* Copyright 2020 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "common/bboxop_common.h"
#include "dataset/kernels/image/resize_with_bbox_op.h"
#include "utils/log_adapter.h"
using
namespace
mindspore
::
dataset
;
using
mindspore
::
LogStream
;
using
mindspore
::
ExceptionType
::
NoExceptionType
;
using
mindspore
::
MsLogLevel
::
INFO
;
const
bool
kSaveExpected
=
false
;
const
char
kOpName
[]
=
"ResizeWithBBox_C"
;
class
MindDataTestResizeWithBBoxOp
:
public
UT
::
CVOP
::
BBOXOP
::
BBoxOpCommon
{
protected:
MindDataTestResizeWithBBoxOp
()
:
BBoxOpCommon
()
{}
};
TEST_F
(
MindDataTestResizeWithBBoxOp
,
TestOp
)
{
MS_LOG
(
INFO
)
<<
"Doing testResizeWithBBox."
;
// resize
TensorTable
results
;
std
::
unique_ptr
<
ResizeWithBBoxOp
>
op
(
new
ResizeWithBBoxOp
(
500
));
for
(
const
auto
&
tensor_row_
:
images_and_annotations_
)
{
// selected a tensorRow
TensorRow
output_row
;
Status
s
=
op
->
Compute
(
tensor_row_
,
&
output_row
);
EXPECT_TRUE
(
s
.
IsOk
());
results
.
push_back
(
output_row
);
}
if
(
kSaveExpected
)
{
SaveImagesWithAnnotations
(
FileType
::
kExpected
,
std
::
string
(
kOpName
),
results
);
}
SaveImagesWithAnnotations
(
FileType
::
kActual
,
std
::
string
(
kOpName
),
results
);
if
(
!
kSaveExpected
)
{
CompareActualAndExpected
(
std
::
string
(
kOpName
));
}
MS_LOG
(
INFO
)
<<
"testResizeWithBBox end."
;
}
tests/ut/data/dataset/imagefolder/ExpectedRandomResizeWithBBox_C0.jpg
0 → 100644
浏览文件 @
2c3c204b
61.7 KB
tests/ut/data/dataset/imagefolder/ExpectedResizeWithBBox_C0.jpg
0 → 100644
浏览文件 @
2c3c204b
59.8 KB
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录