@@ -27,6 +27,8 @@ void DetectionOutputLayer<Dtype>::LayerSetUp(
2727 ratio3_ = detection_output_param.ratio3 ();
2828 ratio4_ = detection_output_param.ratio4 ();
2929 ratio5_ = detection_output_param.ratio5 ();
30+ arm_conf_no_concat_ = detection_output_param.arm_conf_no_concat ();
31+ arm_loc_no_concat_ = detection_output_param.arm_loc_no_concat ();
3032 // TFLite_Detection_PostProcess related params
3133 tflite_detection_ = detection_output_param.tflite_detection ();
3234 tflite_use_regular_nms_ = detection_output_param.tflite_use_regular_nms ();
@@ -139,32 +141,41 @@ void DetectionOutputLayer<Dtype>::LayerSetUp(
139141 data_transformer_->InitRand ();
140142 save_file_ = detection_output_param.save_file ();
141143 }
142- if (bottom.size () < nbottom_) {
143- conf_concat_ = true ;
144- loc_concat_ = true ;
145- priorbox_concat_ = true ;
146- } else if (bottom.size () >= nbottom_ && bottom.size () < 2 * nbottom_ + 1 ) {
147- conf_concat_ = false ;
148- loc_concat_ = true ;
149- priorbox_concat_ = true ;
150- } else if ((bottom.size () >= 2 * nbottom_ + 1 &&
151- bottom.size () < 3 * nbottom_) || nbottom_ == 1 ) {
152- conf_concat_ = false ;
153- loc_concat_ = false ;
154- priorbox_concat_ = true ;
155- } else // ==3*nbottom_
144+ if (!arm_conf_no_concat_ && !arm_loc_no_concat_)
156145 {
157- conf_concat_ = false ;
158- loc_concat_ = false ;
159- priorbox_concat_ = false ;
160- }
146+ if (bottom.size () < nbottom_) {
147+ conf_concat_ = true ;
148+ loc_concat_ = true ;
149+ priorbox_concat_ = true ;
150+ } else if (bottom.size () >= nbottom_ && bottom.size () < 2 * nbottom_ + 1 ) {
151+ conf_concat_ = false ;
152+ loc_concat_ = true ;
153+ priorbox_concat_ = true ;
154+ } else if ((bottom.size () >= 2 * nbottom_ + 1 &&
155+ bottom.size () < 3 * nbottom_) || nbottom_ == 1 ) {
156+ conf_concat_ = false ;
157+ loc_concat_ = false ;
158+ priorbox_concat_ = true ;
159+ } else // ==3*nbottom_
160+ {
161+ conf_concat_ = false ;
162+ loc_concat_ = false ;
163+ priorbox_concat_ = false ;
164+ }
161165
162- if (conf_concat_ && loc_concat_) {
163- bbox_preds_.ReshapeLike (*(bottom[0 ]));
164- if (!share_location_) {
165- bbox_permute_.ReshapeLike (*(bottom[0 ]));
166+ if (conf_concat_ && loc_concat_) {
167+ bbox_preds_.ReshapeLike (*(bottom[0 ]));
168+ if (!share_location_) {
169+ bbox_permute_.ReshapeLike (*(bottom[0 ]));
170+ }
171+ conf_permute_.ReshapeLike (*(bottom[1 ]));
166172 }
167- conf_permute_.ReshapeLike (*(bottom[1 ]));
173+ }
174+ else if (bottom.size () == 4 * nbottom_ + 1 ) // only consider this situation for mapping with arm_conf/arm_loc
175+ {
176+ conf_concat_ = false ;
177+ loc_concat_ = false ;
178+ priorbox_concat_ = true ;
168179 }
169180}
170181
0 commit comments