MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / createPlugin

Method createPlugin

plugin/nmsPlugin/nmsPlugin.cpp:629–732  ·  view source on GitHub ↗

Creates the NMS plugin

Source from the content-addressed store, hash-verified

627
628// Creates the NMS plugin
629IPluginV2Ext* NMSPluginCreator::createPlugin(char const* name, PluginFieldCollection const* fc) noexcept
630{
631 try
632 {
633 PluginField const* fields = fc->fields;
634 // Default init values for TF SSD network
635 params.codeType = CodeTypeSSD::TF_CENTER;
636 params.inputOrder[0] = 0;
637 params.inputOrder[1] = 2;
638 params.inputOrder[2] = 1;
639 // scoreBits defaults to 16
640 mScoreBits = 16;
641
642 // Read configurations from each fields
643 for (int32_t i = 0; i < fc->nbFields; ++i)
644 {
645 char const* attrName = fields[i].name;
646 if (!strcmp(attrName, "shareLocation"))
647 {
648 PLUGIN_VALIDATE(fields[i].type == PluginFieldType::kINT32);
649 params.shareLocation = static_cast<int32_t>(*(static_cast<int32_t const*>(fields[i].data)));
650 }
651 else if (!strcmp(attrName, "varianceEncodedInTarget"))
652 {
653 PLUGIN_VALIDATE(fields[i].type == PluginFieldType::kINT32);
654 params.varianceEncodedInTarget = static_cast<int32_t>(*(static_cast<int32_t const*>(fields[i].data)));
655 }
656 else if (!strcmp(attrName, "backgroundLabelId"))
657 {
658 PLUGIN_VALIDATE(fields[i].type == PluginFieldType::kINT32);
659 params.backgroundLabelId = static_cast<int32_t>(*(static_cast<int32_t const*>(fields[i].data)));
660 }
661 else if (!strcmp(attrName, "numClasses"))
662 {
663 PLUGIN_VALIDATE(fields[i].type == PluginFieldType::kINT32);
664 params.numClasses = static_cast<int32_t>(*(static_cast<int32_t const*>(fields[i].data)));
665 }
666 else if (!strcmp(attrName, "topK"))
667 {
668 PLUGIN_VALIDATE(fields[i].type == PluginFieldType::kINT32);
669 params.topK = static_cast<int32_t>(*(static_cast<int32_t const*>(fields[i].data)));
670 }
671 else if (!strcmp(attrName, "keepTopK"))
672 {
673 PLUGIN_VALIDATE(fields[i].type == PluginFieldType::kINT32);
674 params.keepTopK = static_cast<int32_t>(*(static_cast<int32_t const*>(fields[i].data)));
675 }
676 else if (!strcmp(attrName, "confidenceThreshold"))
677 {
678 PLUGIN_VALIDATE(fields[i].type == PluginFieldType::kFLOAT32);
679 params.confidenceThreshold = static_cast<float>(*(static_cast<float const*>(fields[i].data)));
680 }
681 else if (!strcmp(attrName, "nmsThreshold"))
682 {
683 PLUGIN_VALIDATE(fields[i].type == PluginFieldType::kFLOAT32);
684 params.nmsThreshold = static_cast<float>(*(static_cast<float const*>(fields[i].data)));
685 }
686 else if (!strcmp(attrName, "confSigmoid"))

Callers

nothing calls this directly

Calls 4

caughtErrorFunction · 0.85
c_strMethod · 0.80
setScoreBitsMethod · 0.45
setPluginNamespaceMethod · 0.45

Tested by

no test coverage detected