signal SIGABRT errors accured when running the example of sampleSSD

Hi,
New Xavier board, JetPack-L4T-4.1.1-linux-x64_b57,Tensorrt 5.0
some signal SIGABRT errors accured when i run the example of sampleSSD in the Jetson Xavier,the logs as follows,please tell me the solution of this error and describe the purpose of these function: chooseFormatsAndTactics , makeEngineFromGraph and EngineTacticSupply,thanks.

End parsing model...
Begin building engine...
sample_ssd: ../builder/cudnnBuilder2.cpp:834: virtual std::vector<nvinfer1::query::RequirementsCombination> nvinfer1::builder::EngineTacticSupply::getSupportedFormats(const nvinfer1::builder::Node&, const 
nvinfer1::query::Ports<nvinfer1::query::AbstractTensor>&): <b>Assertion `!formats.empty()</b>' failed.
Thread 1 "sample_ssd" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) where
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x0000007fafe2d8b4 in __GI_abort () at abort.c:79
#2  0x0000007fafe25b44 in __assert_fail_base (
    fmt=0x7faff210c0 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
    assertion=assertion@entry=0x7fb0c98800 "<b>!formats.empty()</b>", 
    file=file@entry=0x7fb0c987e0 "../builder/cudnnBuilder2.cpp", 
    line=line@entry=834, 
    function=function@entry=0x7fb0c970d0 "virtualstd::vector<nvinfer1::query::RequirementsCombination>nvinfer1::builder::EngineTacticSupply::<b>getSupportedFormats</b>(const nvinfer1::builder::Node&, const nvinfer1::query::Ports<nvinfer1::query::A"...) at assert.c:92
#4  0x0000007fb0951664 in nvinfer1::builder:<b>:EngineTacticSupply</b>::getSupportedFormats(nvinfer1::builder::Node const&, nvinfer1::query::Ports<nvinfer1::query::AbstractTensor> const&) () from /usr/lib/aarch64-linux-gnu/libnvinfe r.so.5
#5  0x0000007fb097e168 in nvinfer1::builder::<b>chooseFormatsAndTactics</b>(nvinfer1::builder::Graph&, nvinfer1::builder::TacticSupply&, std::unordered_map<std::string---Type <return> to continue, or q <return> to quit---return, std::vector<float, std::allocator<float> >, std::hash<std::string>, std::equal_to<std::string>, std::allocator<std::pair<std::string const, std::vector<float, std::allocator<float> > > > >*, bool) ()from /usr/lib/aarch64-linux-gnu/libnvinfer.so.5
#6  0x0000007fb0957040 in nvinfer1::builder::<b>makeEngineFromGraph</b>(nvinfer1::CudaEngineBuildConfig const&, nvinfer1::rt::HardwareContext const&, nvinfer1::builder::Graph&, std::unordered_map<std::string, std::vector<float, std::allocator<float> >, std::hash<std::string>, std::equal_to<std::string>, std::allocator<std::pair<std::string const, std::vector<float, std::allocator<float> > > > >*, int)
    () from /usr/lib/aarch64-linux-gnu/libnvinfer.so.5
#7  0x0000007fb095aacc in nvinfer1::builder::<b>buildEngine</b>(nvinfer1::CudaEngineBuildConfig&, nvinfer1::rt::HardwareContext const&, nvinfer1::Network const&)() from /usr/lib/aarch64-linux-gnu/libnvinfer so.5
#8  0x0000007fb09c52ec in nvinfer1::builder::Builder::<b>buildCudaEngine</b>(nvinfer1::INetworkDefinition&) () from /usr/lib/aarch64-linux-gnu/libnvinfer.so.5
#9  0x0000005555559adc in <b>caffeToTRTModel()</b>
#10 0x000000555555a588 in <b>main</b> ()

In order to successfully running the example of sampleSSD,some modifications made in the source code based on the README.TXT as follows:
1.modify the deploy.prototxt.(1)change all the flaten layer to reshape with dims{0,-1,1,1};(2)add "keep_count"as the other top to detection_out layer;
2.modify the function of caffeToTRTModel in the sampleSSD.cpp

void caffeToTRTModel(const std::string& deployFile,           // Name for caffe prototxt
                     const std::string& modelFile,            // Name for model
                     const std::vector<std::string>& outputs, // Network outputs
                     unsigned int maxBatchSize,               // Batch size - NB must be at least as large as the batch we want to run with)
                     MODE mode,                               // Precision mode
                     nvcaffeparser1::IPluginFactoryExt* pluginFactory, //factory for plugin layers
                     IHostMemory** trtModelStream)            // Output stream for the TensorRT model
{
    // Create the builder
    IBuilder* builder = createInferBuilder(gLogger);
……
    std::cout << "Begin parsing model..." << std::endl;
    std::cout << mode << " mode running..." << std::endl;

	[b]//todo:add plugin
	parser->setPluginFactoryExt(pluginFactory);
[/b]

    const IBlobNameToTensor* blobNameToTensor = parser->parse(locateFile(deployFile).c_str(),
                                                              locateFile(modelFile).c_str(),
                                                              *network,
                                                              dataType);
    std::cout << "End parsing model..." << std::endl;
……

3.Implemention the class of PluginFactory ,change priorbox,detection_out and normalize layer to the custom layer,

class PluginFactory : public nvinfer1::IPluginFactory,public nvcaffeparser1::IPluginFactoryExt
{
public:
	virtual nvinfer1::IPlugin* createPlugin(const char* layerName, const nvinfer1::Weights* weights, int nbWeights) override;
	
	nvinfer1::IPlugin* createPlugin(const char* layerName,const void* seriaData,size_t seriaLength)override;
    // caffe parser plugin implementation
	bool isPlugin(const char* name) override { return isPluginExt(name); }
	
    bool isPluginExt(const char* name) override ;
    
    void destroyPlugin();

    void (*pluginDeleter)( nvinfer1::plugin::INvPlugin*) {[]( nvinfer1::plugin::INvPlugin* ptr) {ptr->destroy();}};
	//priorbox layer
    std::unique_ptr< nvinfer1::plugin::INvPlugin, decltype(pluginDeleter)>mconv4_3_norm_mbox_priorbox_layer {nullptr, pluginDeleter};
	std::unique_ptr< nvinfer1::plugin::INvPlugin, decltype(pluginDeleter)>mfc7_mbox_priorbox_layer {nullptr, pluginDeleter};
	std::unique_ptr< nvinfer1::plugin::INvPlugin, decltype(pluginDeleter)>mconv6_2_mbox_priorbox_layer {nullptr, pluginDeleter};
	std::unique_ptr< nvinfer1::plugin::INvPlugin, decltype(pluginDeleter)>mconv7_2_mbox_priorbox_layer {nullptr, pluginDeleter};
	std::unique_ptr< nvinfer1::plugin::INvPlugin, decltype(pluginDeleter)>mconv8_2_mbox_priorbox_layer {nullptr, pluginDeleter};
	std::unique_ptr< nvinfer1::plugin::INvPlugin, decltype(pluginDeleter)>mconv9_2_mbox_priorbox_layer {nullptr, pluginDeleter};
	//detection output layer
	std::unique_ptr< nvinfer1::plugin::INvPlugin, decltype(pluginDeleter)> mdetection_out_layer{nullptr, pluginDeleter};
	//normallize layer
	std::unique_ptr<nvinfer1::plugin::INvPlugin, decltype(pluginDeleter)> mconv4_3_norm_layer{ nullptr, pluginDeleter };

};
//pluginfactory
/****************************************************/
nvinfer1::IPlugin* PluginFactory::createPlugin(const char* layerName, const nvinfer1::Weights* weights, int nbWeights)
{
	std::cout << "====layer: "<< layerName <<" create start===" << std::endl;
	
	if (!strcmp(layerName,"conv4_3_norm_mbox_priorbox"))	
	{
		assert(mconv4_3_norm_mbox_priorbox_layer.get() == nullptr);
		plugin::PriorBoxParameters params = {0};
		float _minSize[1] = {30};
		float _maxSize[1] = {60};
		float _aspectRatios[1] = {2};
		params.minSize = _minSize;
		params.maxSize = _maxSize;
		params.aspectRatios = _aspectRatios;
		params.numMinSize = 1;
		params.numMaxSize = 1;
		params.numAspectRatios = 1;
		params.flip = true;
		params.clip = false;
		params.variance[0] = 0.1;
		params.variance[1] = 0.1;
		params.variance[2] = 0.2;
		params.variance[3] = 0.2;
		params.imgH = 0;
		params.imgW = 0;
		params.stepH = 8;
		params.stepW = 8;
		params.offset = 0.5;
		mconv4_3_norm_mbox_priorbox_layer = std::unique_ptr<nvinfer1::plugin::INvPlugin, decltype(pluginDeleter)>(plugin::createSSDPriorBoxPlugin(params),pluginDeleter);
		std::cout << "====layer: "<< layerName <<" create succ===" << std::endl;
		return mconv4_3_norm_mbox_priorbox_layer.get();	
	}

	……//the other priorbox layer do not list
	
	else if (!strcmp(layerName,"conv4_3_norm"))
	{
		assert(mconv4_3_norm_layer.get() == nullptr);

		mconv4_3_norm_layer = std::unique_ptr<nvinfer1::plugin::INvPlugin, decltype(pluginDeleter)>(plugin::createSSDNormalizePlugin(weights, false, false, 0.001),pluginDeleter);
		std::cout << "====layer: "<< layerName <<" create succ===" << std::endl;
		return mconv4_3_norm_layer.get();
	}

	else if (!strcmp(layerName,"detection_out"))
	{
		assert(mdetection_out_layer.get() == nullptr);
		plugin::DetectionOutputParameters params;
		params.shareLocation = true;
		params.varianceEncodedInTarget = false;
		params.backgroundLabelId = 0;
		params.numClasses = 21;
		params.topK = 400;
		params.keepTopK = 200;
		params.confidenceThreshold = 0.1;
		params.nmsThreshold = 0.45;
		params.codeType = CodeTypeSSD::CENTER_SIZE;
		params.inputOrder[0] = 0;
		params.inputOrder[1] = 1;
		params.inputOrder[2] = 2;
		params.confSigmoid = false;
		params.isNormalized = true;

		mdetection_out_layer = std::unique_ptr<nvinfer1::plugin::INvPlugin, decltype(pluginDeleter)>(plugin::createSSDDetectionOutputPlugin(params),pluginDeleter);
		std::cout << "====layer: "<< layerName <<" create succ===" << std::endl;
		return mdetection_out_layer.get();
	}

	else
	{
		std::cout << "the layer is not exit:" << layerName << std::endl;
		assert(0);
		return nullptr;
	}

}

Hi,

Please use the ssd.prototxt file in the attachment.
The sample should work without any modification.

Thanks.
ssd.prototxt.zip (2.14 KB)

Hi,
According to the README.md, there are 3 plugin layers, Normalize, PriorBox and DetectionOutput, should be implemented, but you said that I do not need do any modification and it works. I don’t know whether the sampleSSD.cpp has implemented it or the current version of tensorrt has supported the three layers, if it is the first one, please tell me the plugin implementation in the code which I don’t find anywhere.

Thanks for your reply.

Hi,

README indicates that some modification is needed for the .prototxt.
So you can run the sample with the .prototxt file I shared with you directly.

Thanks.