Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleX
提交
7b6af1da
P
PaddleX
项目概览
PaddlePaddle
/
PaddleX
通知
138
Star
4
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
43
列表
看板
标记
里程碑
合并请求
5
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleX
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
43
Issue
43
列表
看板
标记
里程碑
合并请求
5
合并请求
5
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
7b6af1da
编写于
6月 18, 2020
作者:
J
jack
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add comment on transforms.h
上级
0f30000f
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
54 addition
and
3 deletion
+54
-3
deploy/cpp/include/paddlex/transforms.h
deploy/cpp/include/paddlex/transforms.h
+54
-3
未找到文件。
deploy/cpp/include/paddlex/transforms.h
浏览文件 @
7b6af1da
...
@@ -28,7 +28,10 @@
...
@@ -28,7 +28,10 @@
namespace
PaddleX
{
namespace
PaddleX
{
// Object for storing all preprocessed data
/*
* @brief
* This class represents object for storing all preprocessed data
* */
class
ImageBlob
{
class
ImageBlob
{
public:
public:
// Original image height and width
// Original image height and width
...
@@ -51,13 +54,28 @@ class ImageBlob {
...
@@ -51,13 +54,28 @@ class ImageBlob {
}
}
};
};
// Abstraction of preprocessing opration class
/*
* @brief
* Abstraction of preprocessing operation class
* */
class
Transform
{
class
Transform
{
public:
public:
virtual
void
Init
(
const
YAML
::
Node
&
item
)
=
0
;
virtual
void
Init
(
const
YAML
::
Node
&
item
)
=
0
;
/*
* @brief
* This method executes preprocessing operation on image matrix,
* result will be returned at second parameter.
* @param im: single image matrix to be preprocessed
* @param data: the raw data of single image matrix after preprocessed
* @return true if transform successfully
* */
virtual
bool
Run
(
cv
::
Mat
*
im
,
ImageBlob
*
data
)
=
0
;
virtual
bool
Run
(
cv
::
Mat
*
im
,
ImageBlob
*
data
)
=
0
;
};
};
/*
* @brief
* This class execute normalization operation on image matrix
* */
class
Normalize
:
public
Transform
{
class
Normalize
:
public
Transform
{
public:
public:
virtual
void
Init
(
const
YAML
::
Node
&
item
)
{
virtual
void
Init
(
const
YAML
::
Node
&
item
)
{
...
@@ -72,6 +90,14 @@ class Normalize : public Transform {
...
@@ -72,6 +90,14 @@ class Normalize : public Transform {
std
::
vector
<
float
>
std_
;
std
::
vector
<
float
>
std_
;
};
};
/*
* @brief
* This class execute resize by short operation on image matrix. At first, it resizes
* the short side of image matrix to specified length. Accordingly, the long side
* will be resized in the same proportion. If new length of long side exceeds max
* size, the long size will be resized to max size, and the short size will be
* resized in the same proportion
* */
class
ResizeByShort
:
public
Transform
{
class
ResizeByShort
:
public
Transform
{
public:
public:
virtual
void
Init
(
const
YAML
::
Node
&
item
)
{
virtual
void
Init
(
const
YAML
::
Node
&
item
)
{
...
@@ -90,6 +116,12 @@ class ResizeByShort : public Transform {
...
@@ -90,6 +116,12 @@ class ResizeByShort : public Transform {
int
max_size_
;
int
max_size_
;
};
};
/*
* @brief
* This class execute resize by long operation on image matrix. At first, it resizes
* the long side of image matrix to specified length. Accordingly, the short side
* will be resized in the same proportion.
* */
class
ResizeByLong
:
public
Transform
{
class
ResizeByLong
:
public
Transform
{
public:
public:
virtual
void
Init
(
const
YAML
::
Node
&
item
)
{
virtual
void
Init
(
const
YAML
::
Node
&
item
)
{
...
@@ -101,6 +133,11 @@ class ResizeByLong : public Transform {
...
@@ -101,6 +133,11 @@ class ResizeByLong : public Transform {
int
long_size_
;
int
long_size_
;
};
};
/*
* @brief
* This class execute resize operation on image matrix. It resizes width and height
* to specified length.
* */
class
Resize
:
public
Transform
{
class
Resize
:
public
Transform
{
public:
public:
virtual
void
Init
(
const
YAML
::
Node
&
item
)
{
virtual
void
Init
(
const
YAML
::
Node
&
item
)
{
...
@@ -126,6 +163,11 @@ class Resize : public Transform {
...
@@ -126,6 +163,11 @@ class Resize : public Transform {
std
::
string
interp_
;
std
::
string
interp_
;
};
};
/*
* @brief
* This class execute center crop operation on image matrix. It crops the center
* of image matrix accroding to specified size.
* */
class
CenterCrop
:
public
Transform
{
class
CenterCrop
:
public
Transform
{
public:
public:
virtual
void
Init
(
const
YAML
::
Node
&
item
)
{
virtual
void
Init
(
const
YAML
::
Node
&
item
)
{
...
@@ -145,6 +187,11 @@ class CenterCrop : public Transform {
...
@@ -145,6 +187,11 @@ class CenterCrop : public Transform {
int
width_
;
int
width_
;
};
};
/*
* @brief
* This class execute padding operation on image matrix. It makes border on edge
* of image matrix.
* */
class
Padding
:
public
Transform
{
class
Padding
:
public
Transform
{
public:
public:
virtual
void
Init
(
const
YAML
::
Node
&
item
)
{
virtual
void
Init
(
const
YAML
::
Node
&
item
)
{
...
@@ -172,7 +219,11 @@ class Padding : public Transform {
...
@@ -172,7 +219,11 @@ class Padding : public Transform {
int
width_
=
0
;
int
width_
=
0
;
int
height_
=
0
;
int
height_
=
0
;
};
};
/*
* @brief
* This class is transform operations manager. It stores all neccessary
* transform operations and run them in correct order.
* */
class
Transforms
{
class
Transforms
{
public:
public:
void
Init
(
const
YAML
::
Node
&
node
,
bool
to_rgb
=
true
);
void
Init
(
const
YAML
::
Node
&
node
,
bool
to_rgb
=
true
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录