Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sq975
openpose
提交
5c873aa9
O
openpose
项目概览
sq975
/
openpose
与 Fork 源项目一致
从无法访问的项目Fork
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
openpose
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
5c873aa9
编写于
11月 01, 2017
作者:
G
gineshidalgo99
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ResizeAndMerge multi-scale more robust
上级
d1d483f3
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
50 addition
and
23 deletion
+50
-23
doc/release_notes.md
doc/release_notes.md
+1
-1
examples/tests/pose_accuracy_coco_test_dev.sh
examples/tests/pose_accuracy_coco_test_dev.sh
+0
-3
examples/tests/pose_accuracy_coco_val.sh
examples/tests/pose_accuracy_coco_val.sh
+1
-1
src/openpose/core/resizeAndMergeBase.cu
src/openpose/core/resizeAndMergeBase.cu
+48
-18
未找到文件。
doc/release_notes.md
浏览文件 @
5c873aa9
...
...
@@ -113,7 +113,7 @@ OpenPose Library - Release Notes
## Current version (future OpenPose 1.2.0
alpha
)
## Current version (future OpenPose 1.2.0)
1.
Main improvements:
1.
Speed increase when processing images with different aspect ratios. E.g. ~20% increase over 3.7k COCO validation images on 1 scale.
2.
Huge speed increase and memory reduction when processing multi-scale. E.g. over 3.7k COCO validation images on 4 scales: ~40% (~770 to ~450 sec) speed increase, ~25% memory reduction (from ~8.9 to ~6.7 GB / GPU).
...
...
examples/tests/pose_accuracy_coco_test_dev.sh
浏览文件 @
5c873aa9
...
...
@@ -13,8 +13,5 @@ OP_BIN=./build/examples/openpose/openpose.bin
# 1 scale
$OP_BIN
--image_dir
$IMAGE_FOLDER
--write_coco_json
${
JSON_FOLDER
}
1_test.json
--no_display
--render_pose
0
# # 3 scales
# $OP_BIN --image_dir $IMAGE_FOLDER --write_coco_json ${JSON_FOLDER}1_3.json --no_display --render_pose 0 --scale_number 3 --scale_gap 0.25
# 4 scales
$OP_BIN
--image_dir
$IMAGE_FOLDER
--write_coco_json
${
JSON_FOLDER
}
1_4_test.json
--no_display
--render_pose
0
--scale_number
4
--scale_gap
0.25
--net_resolution
"1312x736"
examples/tests/pose_accuracy_coco_val.sh
浏览文件 @
5c873aa9
...
...
@@ -32,5 +32,5 @@ $OP_BIN --image_dir $IMAGE_FOLDER --write_coco_json ${JSON_FOLDER}1.json --no_di
# # 4 scales
# $OP_BIN --num_gpu 1 --image_dir $IMAGE_FOLDER --write_coco_json ${JSON_FOLDER}1_4.json --no_display --render_pose 0 --scale_number 4 --scale_gap 0.25 --net_resolution "1312x736" --frame_last 3558
# Debugging - Rendered frames saved
#
#
Debugging - Rendered frames saved
# $OP_BIN --image_dir $IMAGE_FOLDER --write_images ${JSON_FOLDER}frameOutput --no_display
src/openpose/core/resizeAndMergeBase.cu
浏览文件 @
5c873aa9
...
...
@@ -15,30 +15,46 @@ namespace op
if
(
x
<
targetWidth
&&
y
<
targetHeight
)
{
const
T
xSource
=
(
x
+
0.5
f
)
*
sourceWidth
/
T
(
targetWidth
)
-
0.5
f
;
const
T
ySource
=
(
y
+
0.5
f
)
*
sourceHeight
/
T
(
targetHeight
)
-
0.5
f
;
const
T
xSource
=
(
x
+
T
(
0.5
f
))
*
sourceWidth
/
T
(
targetWidth
)
-
T
(
0.5
f
)
;
const
T
ySource
=
(
y
+
T
(
0.5
f
))
*
sourceHeight
/
T
(
targetHeight
)
-
T
(
0.5
f
)
;
targetPtr
[
y
*
targetWidth
+
x
]
=
bicubicInterpolate
(
sourcePtr
,
xSource
,
ySource
,
sourceWidth
,
sourceHeight
,
sourceWidth
);
}
}
template
<
typename
T
>
__global__
void
resizeKernelAnd
Merge
(
T
*
targetPtr
,
const
T
*
const
sourcePtr
,
const
T
scaleWidth
,
const
T
scaleHeight
,
const
int
sourceWidth
,
const
int
sourceHeight
,
const
int
targetWidth
,
const
int
targetHeight
,
const
int
averageCounter
)
__global__
void
resizeKernelAnd
Add
(
T
*
targetPtr
,
const
T
*
const
sourcePtr
,
const
T
scaleWidth
,
const
T
scaleHeight
,
const
int
sourceWidth
,
const
int
sourceHeight
,
const
int
targetWidth
,
const
int
targetHeight
)
{
const
auto
x
=
(
blockIdx
.
x
*
blockDim
.
x
)
+
threadIdx
.
x
;
const
auto
y
=
(
blockIdx
.
y
*
blockDim
.
y
)
+
threadIdx
.
y
;
if
(
x
<
targetWidth
&&
y
<
targetHeight
)
{
const
T
xSource
=
(
x
+
0.5
f
)
/
scaleWidth
-
0.5
f
;
const
T
ySource
=
(
y
+
0.5
f
)
/
scaleHeight
-
0.5
f
;
const
T
xSource
=
(
x
+
T
(
0.5
f
))
/
scaleWidth
-
T
(
0.5
f
);
const
T
ySource
=
(
y
+
T
(
0.5
f
))
/
scaleHeight
-
T
(
0.5
f
);
targetPtr
[
y
*
targetWidth
+
x
]
+=
bicubicInterpolate
(
sourcePtr
,
xSource
,
ySource
,
sourceWidth
,
sourceHeight
,
sourceWidth
);
}
}
template
<
typename
T
>
__global__
void
resizeKernelAndAverage
(
T
*
targetPtr
,
const
T
*
const
sourcePtr
,
const
T
scaleWidth
,
const
T
scaleHeight
,
const
int
sourceWidth
,
const
int
sourceHeight
,
const
int
targetWidth
,
const
int
targetHeight
,
const
int
counter
)
{
const
auto
x
=
(
blockIdx
.
x
*
blockDim
.
x
)
+
threadIdx
.
x
;
const
auto
y
=
(
blockIdx
.
y
*
blockDim
.
y
)
+
threadIdx
.
y
;
if
(
x
<
targetWidth
&&
y
<
targetHeight
)
{
const
T
xSource
=
(
x
+
T
(
0.5
f
))
/
scaleWidth
-
T
(
0.5
f
);
const
T
ySource
=
(
y
+
T
(
0.5
f
))
/
scaleHeight
-
T
(
0.5
f
);
const
auto
interpolated
=
bicubicInterpolate
(
sourcePtr
,
xSource
,
ySource
,
sourceWidth
,
sourceHeight
,
sourceWidth
);
auto
&
targetPixel
=
targetPtr
[
y
*
targetWidth
+
x
];
targetPixel
=
((
averageCounter
*
targetPixel
)
+
interpolated
)
/
T
(
averageCounter
+
1
);
// targetPixel = fastMax(targetPixel, interpolated);
targetPixel
=
(
targetPixel
+
interpolated
)
/
T
(
counter
);
}
}
...
...
@@ -91,14 +107,13 @@ namespace op
}
// Old inefficient multi-scale merging
else
error
(
"It should never reache
s this point. Notify us
."
,
__LINE__
,
__FUNCTION__
,
__FILE__
);
error
(
"It should never reache
this point. Notify us otherwise
."
,
__LINE__
,
__FUNCTION__
,
__FILE__
);
}
// Multi-scaling merging
else
{
const
auto
targetChannelOffset
=
targetWidth
*
targetHeight
;
cudaMemset
(
targetPtr
,
0.
f
,
channels
*
targetChannelOffset
*
sizeof
(
T
));
auto
averageCounter
=
-
1
;
const
auto
scaleToMainScaleWidth
=
targetWidth
/
T
(
sourceWidth
);
const
auto
scaleToMainScaleHeight
=
targetHeight
/
T
(
sourceHeight
);
...
...
@@ -111,14 +126,29 @@ namespace op
const
auto
scaleInputToNet
=
scaleInputToNetInputs
[
i
]
/
scaleInputToNetInputs
[
0
];
const
auto
scaleWidth
=
scaleToMainScaleWidth
/
scaleInputToNet
;
const
auto
scaleHeight
=
scaleToMainScaleHeight
/
scaleInputToNet
;
averageCounter
++
;
for
(
auto
c
=
0
;
c
<
channels
;
c
++
)
// All but last image --> add
if
(
i
<
sourceSizes
.
size
()
-
1
)
{
resizeKernelAndMerge
<<<
numBlocks
,
threadsPerBlock
>>>
(
targetPtr
+
c
*
targetChannelOffset
,
sourcePtrs
[
i
]
+
c
*
sourceChannelOffset
,
scaleWidth
,
scaleHeight
,
currentWidth
,
currentHeight
,
targetWidth
,
targetHeight
,
averageCounter
);
for
(
auto
c
=
0
;
c
<
channels
;
c
++
)
{
resizeKernelAndAdd
<<<
numBlocks
,
threadsPerBlock
>>>
(
targetPtr
+
c
*
targetChannelOffset
,
sourcePtrs
[
i
]
+
c
*
sourceChannelOffset
,
scaleWidth
,
scaleHeight
,
currentWidth
,
currentHeight
,
targetWidth
,
targetHeight
);
}
}
// Last image --> average all
else
{
for
(
auto
c
=
0
;
c
<
channels
;
c
++
)
{
resizeKernelAndAverage
<<<
numBlocks
,
threadsPerBlock
>>>
(
targetPtr
+
c
*
targetChannelOffset
,
sourcePtrs
[
i
]
+
c
*
sourceChannelOffset
,
scaleWidth
,
scaleHeight
,
currentWidth
,
currentHeight
,
targetWidth
,
targetHeight
,
sourceSizes
.
size
()
);
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录