Some questions about TensorRT 3.0 createPlugin

I want to use TensorRT 3.0 to run SSD with some Plugin layers. When I add createSSDPriorBoxPlugin in my coda as below:

virtual nvinfer1::IPlugin* createPlugin(const char* layerName, const nvinfer1::Weights* weights, int nbWeights) override
    	{

    		if (!strcmp(layerName, "PriorBox"))
    		{
    			assert(mPluginPriorBox == nullptr);
    			PriorBox = std::unique_ptr<INvPlugin, decltype(nvPluginDeleter)>
    				(createSSDPriorBoxPlugin(PriorBoxPara), nvPluginDeleter);
    			return mPluginPriorBox.get();
    		}
    ......
    }

I need to pass PriorBoxPara which is a PriorBoxParameters struct to createSSDPriorBoxPlugin. Struct PriorBoxParameters is defined as below :

struct PriorBoxParameters
    {
            float *minSize, *maxSize, *aspectRatios;
            int numMinSize, numMaxSize, numAspectRatios;
    	bool flip;
    	bool clip;
    	float variance[4];
    	int imgH, imgW;
    	float stepH, stepW;
    	float offset;
    }

I have no idea how to give the prior box parameters such as minSize, maxSize, aspectRatios, numMinSize, numMaxSize and numAspectRatios. For example, defferent PriorBox layers may have different minSizes, and one PriorBox may have two aspect ratios, how could I pass these parameters when I creat PriorBox plugin layer? Could someone give me some suggestions? Thank you in advance!

Hi,

It looks like you file the same topic on TX2 board.
Could you share which platform do you use first?

Thanks.

@fujiaweigege For each priorbox layer,you should feed the parameters which in prototxt. So, you should do like this
float min_size=60.0, max_size=110.0, aspect_ratio[3]={1.0, 2.0, 3.0};
mPluginPriorBoxfc7 = std::unique_ptr<INvPlugin, decltype(nvPluginDeleter)>
(createSSDPriorBoxPlugin({&min_size, &max_size, aspect_ratio, 1 , 1, 3, true, false, {0.1, 0.1, 0.2, 0.2}, 0, 0, 16.0, 16.0, 0.5}), nvPluginDeleter); You can do this more gentle.

By the way, AastaLL, I want to ask why I use the createSSDDetectionOutputPlugin plugin, it may return a error message “Plugin layer output count is not equal to caffe output count”.
For more information you can look at [url]https://devtalk.nvidia.com/default/topic/1025153/tensorrt-3-0-rc-run-ssd-error-in-detectionoutput-layer/?offset=2[/url] .

Thanks.

Hi 604588292,

It’s recommended to file another topic for a new problem.
This will make it clear for others who meet the same issue.

Thanks.

When I use the createSSDDetectionOutputPlugin plugin, I have the same problem about “Plugin layer output count is not equal to caffe output count”.However, when I remove the detectout layer from prototxt file, it can run well and I can get output of the mbox_loc and mbox_conf layer

Hi chenzhi745320,

Our user also meet this issue before.
Please check this topic for more information:

Thanks.

Hi everyone,

How to know what is the middle output of network:

PriorBox = std::unique_ptr<INvPlugin, decltype(nvPluginDeleter)>
    				(createSSDPriorBoxPlugin(PriorBoxPara), nvPluginDeleter);

The method createSSDPriorBoxPlugin(PriorBoxPara) is just send some params, but how to know that is the output? How to apply algorithm on data?

Hi @chenzhi745320 @604588292

please see this thread for the fix of error ‘Plugin layer output count is not equal to caffe output count’
[url]TensorRT 3.0 RC run SSD error in DetectionOutput layer - GPU-Accelerated Libraries - NVIDIA Developer Forums