Skip to content

Conversation

@qingqing01
Copy link
Contributor

Related to #9472

const T step_height, const T* min_sizes,
const T* max_sizes, const int min_num,
bool is_clip) {
int num_priors = max_sizes ? as_num * min_num + min_num : as_num * min_num;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你在host上不是算过num_priors了么?

而且两个地方的计算方式貌似不一样,确认下?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

想少传递一些参数,就在kernel里也计算了下。
max_sizes 和 min_sizes的个数是相等的。 https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/fluid/operators/prior_box_op.cc#L52 这里有check。 所以这里就直接 + min_num。

int w = (i / num_priors) % width;
int p = i % num_priors;
int m = max_sizes ? p / (as_num + 1) : p / as_num;
T cx = (w + offset) * step_width;
Copy link
Contributor

@wanghaoshuang wanghaoshuang Apr 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

第一个box就需要乘上step_width么?
请忽略,我看caffe也是这样写的。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@chengduoZH chengduoZH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent!
My biggest concern is its performance, and I feel that there are some points to be improved.

@@ -0,0 +1,167 @@
/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2016 -> 2018

namespace operators {

template <typename T>
__device__ inline T clip(T in) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clip -> Clip

@qingqing01 qingqing01 merged commit a84a580 into PaddlePaddle:develop Apr 4, 2018
@qingqing01 qingqing01 deleted the cuda_prior_box branch November 14, 2019 05:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants