chenzhi1992 / TensorRT-SSD

Use TensorRT API to implement Caffe-SSD, SSD(channel pruning), Mobilenet-SSD
251 stars 84 forks source link

Did you solve detectionout error in tensorrt4? #37

Closed chamcham115 closed 5 years ago

chamcham115 commented 5 years ago

NvPluginSSD.cu:795: virtual void nvinfer1::plugin::DetectionOutput::configure(const nvinfer1::Dims, int, const nvinfer1::Dims, int, int): Assertion `numPriorsnumLocClasses4 == inputDims[param.inputOrder[0]].d[0]' failed.

Ghustwb commented 5 years ago

I met the same problems,I use tensorRT3.0,is the tensorRT version cause the error?

Ghustwb commented 5 years ago

I solved the problems. If you use tensorRT4.0,you could "use inputOrder = {0,1,2}" in detection_out layer. or If you usr tensorRT3.0,you could modify the "getOutputDimensions()" function in reshape class(pluginImplement.h)

return DimsCHW(OutC, inputs[0].d[0] inputs[0].d[1] / OutC, inputs[0].d[2]); || return DimsCHW( inputs[0].d[0] inputs[0].d[1] / OutC, OutC, inputs[0].d[2]);

chamcham115 commented 5 years ago

@Ghustwb Did you solve? I use the tensorRT 4. but i don't solve the this problem. what does that mean " use inputOrder={0, 1, 2}"?

chamcham115 commented 5 years ago

I got it

yiboliu31 commented 5 years ago

@chamcham115 what does that mean " use inputOrder={0, 1, 2}"?,thank you

yiboliu31 commented 5 years ago

@Ghustwb what does that mean " use inputOrder={0, 1, 2}"?,thank you,i m not clear about it

Ghustwb commented 5 years ago

@yiboliu31

else if (!strcmp(layerName, "detection_out"))
    {
        assert(mDetection_out.get() == nullptr);
        DetectionOutputParameters params;

        params.backgroundLabelId = 0;
        params.codeType = CodeTypeSSD::CENTER_SIZE;
        //params.codeType = CodeType_t::CENTER_SIZE; // tensorRT3
        params.keepTopK = 100;
        params.shareLocation = true;
        params.varianceEncodedInTarget = false;
        params.topK = 100;
        params.nmsThreshold = 0.45;
        params.numClasses = 5;
        params.inputOrder[0] = 0;
        params.inputOrder[1] = 1;
        params.inputOrder[2] = 2;
        params.confidenceThreshold = 0.4;

//        params.confSigmoid = false;
//        params.isNormalized = false;

        mDetection_out = std::unique_ptr<INvPlugin, decltype(nvPluginDeleter)>
                (createSSDDetectionOutputPlugin(params), nvPluginDeleter);

        return mDetection_out.get();
    }
yiboliu31 commented 5 years ago

@Ghustwb Thank you so much!!!!!!!!!!

chamcham115 commented 5 years ago

@Ghustwb Did you change the input image size? I changed input image size but it cannot get the correct confidence and bbox coordinates. How about you?

Ghustwb commented 5 years ago

https://github.com/Ghustwb/MobileNet-SSD-TensorRT This is my code,I hope it can help you.

On 10/26/2018 09:44,chamcham115notifications@github.com wrote:

@Ghustwb Did you change the input image size? I changed input image size but it cannot get the correct confidence and bbox coordinates. How about you?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

chamcham115 commented 5 years ago

@Ghustwb Thank you for reply. Actually, I don't find error's reason for detected confidence and bbox coordinates. 0 2 12.1817 0 0.372353 0.289283 0.759816 0 1 7.76855 0.321184 0.41581 0.362759 0.637062 0 8 5.42908 0.12657 0 0.182774 0.0952782 0 4 4.17458 0.709085 0.452517 0.795548 0.531907 0 2 4.0492 0 0.766915 0.169306 0.932616 0 3 3.52001 0.701974 0 0.966738 0.199839 0 7 3.5158 0.442823 0.39471 0.450492 0.41702 0 3 2.7862 0 0.142733 0.252467 0.451741 0 5 2.71503 0.315841 0.567701 0.365061 0.676568

Maybe your code helps me. Thanks. If I solved this problem, I will tell you. Thanx.

Ghustwb commented 5 years ago

According to your printed information,Maybe you forgot to scale the input image. mean value 127.5 scale 0.007825 you can find it in my code

On 10/26/2018 12:53,chamcham115notifications@github.com wrote:

@Ghustwb Thank you for reply. Actually, I don't find error's reason for detected confidence and bbox coordinates. 0 2 12.1817 0 0.372353 0.289283 0.759816 0 1 7.76855 0.321184 0.41581 0.362759 0.637062 0 8 5.42908 0.12657 0 0.182774 0.0952782 0 4 4.17458 0.709085 0.452517 0.795548 0.531907 0 2 4.0492 0 0.766915 0.169306 0.932616 0 3 3.52001 0.701974 0 0.966738 0.199839 0 7 3.5158 0.442823 0.39471 0.450492 0.41702 0 3 2.7862 0 0.142733 0.252467 0.451741 0 5 2.71503 0.315841 0.567701 0.365061 0.676568

Maybe your code helps me. Thanks. If I solved this problem, I will tell you. Thanx.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

chamcham115 commented 5 years ago

@Ghustwb Do you think that the problem is about image? But I resize the input image and I applied mean value. So, My code is correctly executed when I use the 300x300 ssd network. But, I change the size and aspect ratio of neural network to 600 x 336 And I also change the input image resize method. maybe I think that problem is to change aspect ratio of network's input I will find the solution.

Thanks.

chamcham115 commented 5 years ago

@Ghustwb Do you know this problem when I change voc 512x512..? I met the error again.

inference: NvPluginSSD.cu:795: virtual void nvinfer1::plugin::DetectionOutput::configure(const nvinfer1::Dims, int, const nvinfer1::Dims, int, int): Assertion `numPriorsnumLocClasses4 == inputDims[param.inputOrder[0]].d[0]' failed.

in voc 512, inserted conv10_2_priorbox. So I met the error again.

Do you know this problem?