-
Notifications
You must be signed in to change notification settings - Fork 9.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Perception: prepare code for multi-scale camera object detection #8649
Perception: prepare code for multi-scale camera object detection #8649
Conversation
Please fix lint error |
07b743d
to
c73a98a
Compare
@@ -126,21 +129,25 @@ __global__ void get_object_kernel(int n, | |||
float scale = obj_data[loc_index]; | |||
float cx = (w + sigmoid_gpu(loc_data[offset_loc + 0])) / width; | |||
float cy = (h + sigmoid_gpu(loc_data[offset_loc + 1])) / height; | |||
float hw = exp(loc_data[offset_loc + 2]) * anchor_data[2 * c] / width * 0.5; | |||
float hw = exp(max(-10.0f, min(loc_data[offset_loc + 2], 5.0f))) * |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-10.0f and 5.0f to constexpr values in header file
|
||
int num_anchor_per_scale = num_anchor; | ||
if (multi_scale){ | ||
num_anchor_per_scale /= 3; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 in header file
const float *ori_data = ori_data_vec[i]; | ||
const float *dim_data = dim_data_vec[i]; | ||
const float *anchor_data = yolo_blobs.anchor_blob->gpu_data() | ||
+ num_anchor_per_scale * 2 * i; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static_cast(num_anchor_per_scale * 2 * i)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an index, so integer should be used here.
std::vector<float> conf_score(cpu_cls_data + k * num_candidates, | ||
cpu_cls_data + (k + 1) * num_candidates); | ||
std::vector<float> conf_score(cpu_cls_data + k * all_scales_num_candidates, | ||
cpu_cls_data + (k + 1) * all_scales_num_candidates); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
align indentation of all arguments in the next lanes to the first argument.
e.g.
std::vector conf_score(
. cpu_cls_data + k * all_scales_num_candidates,
cpu_cls_data + (k + 1) * all_scales_num_candidates);
int obj_size = | ||
output_height * output_width * static_cast<int>(anchors_.size()) / 2; | ||
output_height_scale1 * output_width_scale1 * | ||
static_cast<int>(anchors_.size()) / 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about
int obj_size = (output_height_scale1 * output_width_scale1 *
static_cast(anchors_.size())) / 2;
to reduce truncation error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here output_height_scale1
and output_width_scale1
are also integers, so maybe it does not matter?
(output_height_scale1 * output_width_scale1 + | ||
output_height_scale2 * output_width_scale2 + | ||
output_height_scale3 * output_width_scale3) * | ||
static_cast<int>(anchors_.size()) / 2 / 3; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/2/3 to one constrexpr float
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, they are all integers in the expression. So I created 2 constexpr
for both 2
and 3
and used them here as you suggested above instead of a constexpr float
for 2/3.
Change code to accept multi-scale camera object detection outputs of neural networks. Preparation work for Yolo-v3 object detection network.