Skip to content

Commit 48deb77

Browse files
committed
add support for arm_conf handling
1 parent 3df07c2 commit 48deb77

File tree

1 file changed

+27
-5
lines changed

1 file changed

+27
-5
lines changed

src/caffe/layers/detection_output_layer.cpp

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,8 @@ void DetectionOutputLayer<Dtype>::Forward_cpu(
454454
for (int n = 0; n < nbottom_; n++) {
455455
const Dtype *conf_data = bottom[n]->cpu_data();
456456
map<int, vector<float>> &label_scores = all_conf_scores[i];
457+
if (arm_conf_no_concat_)
458+
arm_conf_data = bottom[n + 1 + 2*nbottom_]->cpu_data();
457459
if (!ratio_permute_ && !no_permute_) // original caffe ssd
458460
{
459461
for (int p = 0; p < bottom[n]->channels() / num_classes_; ++p) {
@@ -481,11 +483,31 @@ void DetectionOutputLayer<Dtype>::Forward_cpu(
481483
int start_idx = c * bottom[n]->height() * bottom[n]->width();
482484
for (int r = 0; r < bottom[n]->height(); ++r) {
483485
for (int p = 0; p < bottom[n]->width(); ++p) {
484-
label_scores[c].push_back(
485-
conf_data[start_idx + r * bottom[n]->width() + p]);
486-
// LOG(INFO)<<"p="<<p<<" ,c="<<c<<"
487-
// ,score="<<conf_data[start_idx + r * bottom[n]->width() +
488-
// p]<<"\n";
486+
if (!arm_conf_no_concat_)
487+
{
488+
label_scores[c].push_back(
489+
conf_data[start_idx + r * bottom[n]->width() + p]);
490+
// LOG(INFO)<<"p="<<p<<" ,c="<<c<<"
491+
// ,score="<<conf_data[start_idx + r * bottom[n]->width() +
492+
// p]<<"\n";
493+
}
494+
else{
495+
int index_c = num_classes_%2 + 1;
496+
int arm_index = index_c * bottom[n + 1 + 2*nbottom_]->height() * bottom[n + 1 + 2*nbottom_]->width() +
497+
r * bottom[n + 1 + 2*nbottom_]->width() + p;
498+
if (arm_conf_data[arm_index] < objectness_score_)
499+
{
500+
if (c==0)
501+
{
502+
label_scores[c].push_back(1.0);
503+
} else {
504+
label_scores[c].push_back(0.0);
505+
}
506+
}
507+
else{
508+
label_scores[c].push_back(conf_data[start_idx + r * bottom[n]->width() + p]);
509+
}
510+
}
489511
}
490512
}
491513
}

0 commit comments

Comments
 (0)