| 676 | } |
| 677 | |
| 678 | IPluginV2Ext* ProposalPluginCreator::createPlugin(char const* name, PluginFieldCollection const* fc) noexcept |
| 679 | { |
| 680 | try |
| 681 | { |
| 682 | PluginField const* fields = fc->fields; |
| 683 | int32_t nbFields = fc->nbFields; |
| 684 | int32_t inputHeight = 0; |
| 685 | int32_t inputWidth = 0; |
| 686 | int32_t rpnStride = 0; |
| 687 | int32_t preNmsTopN = 0; |
| 688 | int32_t postNmsTopN = 0; |
| 689 | float roiMinSize = 0.0F; |
| 690 | float nmsIouThreshold = 0.0F; |
| 691 | std::vector<float> anchorSizes; |
| 692 | std::vector<float> anchorRatios; |
| 693 | |
| 694 | for (int32_t i = 0; i < nbFields; ++i) |
| 695 | { |
| 696 | char const* attrName = fields[i].name; |
| 697 | |
| 698 | if (!strcmp(attrName, "input_height")) |
| 699 | { |
| 700 | PLUGIN_VALIDATE(fields[i].type == PluginFieldType::kINT32); |
| 701 | inputHeight = *(static_cast<int32_t const*>(fields[i].data)); |
| 702 | } |
| 703 | else if (!strcmp(attrName, "input_width")) |
| 704 | { |
| 705 | PLUGIN_VALIDATE(fields[i].type == PluginFieldType::kINT32); |
| 706 | inputWidth = *(static_cast<int32_t const*>(fields[i].data)); |
| 707 | } |
| 708 | else if (!strcmp(attrName, "rpn_stride")) |
| 709 | { |
| 710 | PLUGIN_VALIDATE(fields[i].type == PluginFieldType::kINT32); |
| 711 | rpnStride = *(static_cast<int32_t const*>(fields[i].data)); |
| 712 | } |
| 713 | else if (!strcmp(attrName, "roi_min_size")) |
| 714 | { |
| 715 | PLUGIN_VALIDATE(fields[i].type == PluginFieldType::kFLOAT32); |
| 716 | roiMinSize = *(static_cast<float const*>(fields[i].data)); |
| 717 | } |
| 718 | else if (!strcmp(attrName, "nms_iou_threshold")) |
| 719 | { |
| 720 | PLUGIN_VALIDATE(fields[i].type == PluginFieldType::kFLOAT32); |
| 721 | nmsIouThreshold = *(static_cast<float const*>(fields[i].data)); |
| 722 | } |
| 723 | else if (!strcmp(attrName, "pre_nms_top_n")) |
| 724 | { |
| 725 | PLUGIN_VALIDATE(fields[i].type == PluginFieldType::kINT32); |
| 726 | preNmsTopN = *(static_cast<int32_t const*>(fields[i].data)); |
| 727 | } |
| 728 | else if (!strcmp(attrName, "post_nms_top_n")) |
| 729 | { |
| 730 | PLUGIN_VALIDATE(fields[i].type == PluginFieldType::kINT32); |
| 731 | postNmsTopN = *(static_cast<int32_t const*>(fields[i].data)); |
| 732 | } |
| 733 | else if (!strcmp(attrName, "anchor_sizes")) |
| 734 | { |
| 735 | PLUGIN_VALIDATE(fields[i].type == PluginFieldType::kFLOAT32); |
nothing calls this directly
no test coverage detected