| 419 | } |
| 420 | |
| 421 | void CPPDetectionPostProcessLayer::run() |
| 422 | { |
| 423 | const unsigned int num_classes = _info.num_classes(); |
| 424 | const unsigned int max_detections = _info.max_detections(); |
| 425 | |
| 426 | DecodeCenterSizeBoxes(_input_box_encoding, _input_anchors, _info, &_decoded_boxes); |
| 427 | |
| 428 | // Decode scores if necessary |
| 429 | if (_dequantize_scores) |
| 430 | { |
| 431 | if (_input_box_encoding->info()->data_type() == DataType::QASYMM8) |
| 432 | { |
| 433 | for (unsigned int idx_c = 0; idx_c < _num_classes_with_background; ++idx_c) |
| 434 | { |
| 435 | for (unsigned int idx_b = 0; idx_b < _num_boxes; ++idx_b) |
| 436 | { |
| 437 | *(reinterpret_cast<float *>(_decoded_scores.ptr_to_element(Coordinates(idx_c, idx_b)))) = |
| 438 | dequantize_qasymm8( |
| 439 | *(reinterpret_cast<qasymm8_t *>(_input_scores->ptr_to_element(Coordinates(idx_c, idx_b)))), |
| 440 | _input_scores->info()->quantization_info()); |
| 441 | } |
| 442 | } |
| 443 | } |
| 444 | else if (_input_box_encoding->info()->data_type() == DataType::QASYMM8_SIGNED) |
| 445 | { |
| 446 | for (unsigned int idx_c = 0; idx_c < _num_classes_with_background; ++idx_c) |
| 447 | { |
| 448 | for (unsigned int idx_b = 0; idx_b < _num_boxes; ++idx_b) |
| 449 | { |
| 450 | *(reinterpret_cast<float *>(_decoded_scores.ptr_to_element(Coordinates(idx_c, idx_b)))) = |
| 451 | dequantize_qasymm8_signed(*(reinterpret_cast<qasymm8_signed_t *>( |
| 452 | _input_scores->ptr_to_element(Coordinates(idx_c, idx_b)))), |
| 453 | _input_scores->info()->quantization_info()); |
| 454 | } |
| 455 | } |
| 456 | } |
| 457 | } |
| 458 | |
| 459 | // Regular NMS |
| 460 | if (_info.use_regular_nms()) |
| 461 | { |
| 462 | std::vector<int> result_idx_boxes_after_nms; |
| 463 | std::vector<int> result_classes_after_nms; |
| 464 | std::vector<float> result_scores_after_nms; |
| 465 | std::vector<unsigned int> sorted_indices; |
| 466 | |
| 467 | for (unsigned int c = 0; c < num_classes; ++c) |
| 468 | { |
| 469 | // For each boxes get scores of the boxes for the class c |
| 470 | for (unsigned int i = 0; i < _num_boxes; ++i) |
| 471 | { |
| 472 | *(reinterpret_cast<float *>(_class_scores.ptr_to_element(Coordinates(i)))) = |
| 473 | *(reinterpret_cast<float *>(_input_scores_to_use->ptr_to_element( |
| 474 | Coordinates(c + 1, i)))); // i * _num_classes_with_background + c + 1 |
| 475 | } |
| 476 | |
| 477 | // Run Non-maxima Suppression |
| 478 | _nms.run(); |
nothing calls this directly
no test coverage detected