No result when using tensorRT Sample FasterRCNN with other images

Hi,

It should be DimsCHW(5,1,1).

Thanks.

Hi,

ok, thx

and if in caffe: top[0]->Reshape( bottom[1]->num(), 5, 5, 5 );
but in tesorRT we cannot return DimsNCHW(inputs[1].d[0], 5, 5, 5);

how to solve it?

Hi,

There is something wrong in comment #21. I have corrected it.

For

shape {
dim: 300
dim: 5
}

This will automatically transfer to

shape {
dim: 300
dim: 5
dim: 1
dim: 1
}

That is:

BATCH_SIZE=300
DimsCHW = (5,1,1)

Thanks and sorry for the misleading.

one more question about im_info

in im_info, do we need to put the original size (height, width) or the resized size?

if I put resized size in im_info, the result is not what I expect.

Hi,

I face wrong result when doing convolution with dilation=2 (TensorRT2 on TX2)

and that may be the issue in

https://devtalk.nvidia.com/default/topic/1004959/?comment=5131210

  1. my cudnn version is 6.0.21, is the same problem?

  2. and if I update cudnn, should I do any setting for TensorRT2 on TX2?

Hi,

The topic you posted is for Kepler GPU. TX2 is Pascal architecture, doesn’t have this issue.

Not sure what error do you face.
Do you have different accuracy between DIGITs and TensorRT? Or Caffe and TensorRT?

A most common issue in accuracy drop is the different mean subtraction implementation.
Please read this topic for more detail:
[url]https://devtalk.nvidia.com/default/topic/993552/jetson-tx1/detection-result-difference-between-jetson-inference2-3-and-digits5-1/post/5097211/#5097211[/url]

Thanks.

Hi,

in the layer (attached below) “res5a” (Eltwise), two input dimensions are different

and get message~ {res5a: all elementwise inputs must have same dimensions}

but in caffe, there is no such issue

and after test, I find input[1] of “res5a” with wrong dimension after “res5a_branch2b”

=========================================

input: “data”
input_shape {
dim: 1
dim: 3
dim: 224
dim: 224
}

layer {
bottom: “data”
top: “res5a_branch1”
name: “res5a_branch1”
type: “Convolution”
convolution_param {
num_output: 2048
kernel_size: 1
pad: 0
stride: 1
bias_term: false
}
param {
lr_mult: 1.0
}
}

layer {
bottom: “res5a_branch1”
top: “res5a_branch1”
name: “bn5a_branch1”
type: “BatchNorm”
batch_norm_param {
use_global_stats: true
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
}

layer {
bottom: “res5a_branch1”
top: “res5a_branch1”
name: “scale5a_branch1”
type: “Scale”
scale_param {
bias_term: true
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
}

layer {
bottom: “data”
top: “res5a_branch2a”
name: “res5a_branch2a”
type: “Convolution”
convolution_param {
num_output: 512
kernel_size: 1
pad: 0
stride: 1
bias_term: false
}
param {
lr_mult: 1.0
}
}

layer {
bottom: “res5a_branch2a”
top: “res5a_branch2a”
name: “bn5a_branch2a”
type: “BatchNorm”
batch_norm_param {
use_global_stats: true
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
}

layer {
bottom: “res5a_branch2a”
top: “res5a_branch2a”
name: “scale5a_branch2a”
type: “Scale”
scale_param {
bias_term: true
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
}

layer {
top: “res5a_branch2a”
bottom: “res5a_branch2a”
name: “res5a_branch2a_relu”
type: “ReLU”
}

layer {
bottom: “res5a_branch2a”
top: “res5a_branch2b”
name: “res5a_branch2b”
type: “Convolution”
convolution_param {
num_output: 512
kernel_size: 3
dilation: 2
pad: 2
stride: 1
bias_term: false
}
param {
lr_mult: 1.0
}
}

layer {
bottom: “res5a_branch2b”
top: “res5a_branch2b”
name: “bn5a_branch2b”
type: “BatchNorm”
batch_norm_param {
use_global_stats: true
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
}

layer {
bottom: “res5a_branch2b”
top: “res5a_branch2b”
name: “scale5a_branch2b”
type: “Scale”
scale_param {
bias_term: true
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
}

layer {
top: “res5a_branch2b”
bottom: “res5a_branch2b”
name: “res5a_branch2b_relu”
type: “ReLU”
}

layer {
bottom: “res5a_branch2b”
top: “res5a_branch2c”
name: “res5a_branch2c”
type: “Convolution”
convolution_param {
num_output: 2048
kernel_size: 1
pad: 0
stride: 1
bias_term: false
}
param {
lr_mult: 1.0
}
}

layer {
bottom: “res5a_branch2c”
top: “res5a_branch2c”
name: “bn5a_branch2c”
type: “BatchNorm”
batch_norm_param {
use_global_stats: true
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
}

layer {
bottom: “res5a_branch2c”
top: “res5a_branch2c”
name: “scale5a_branch2c”
type: “Scale”
scale_param {
bias_term: true
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
}

layer {
bottom: “res5a_branch1”
bottom: “res5a_branch2c”
top: “res5a”
name: “res5a”
type: “Eltwise”
}

layer {
bottom: “res5a”
top: “res5a”
name: “res5a_relu”
type: “ReLU”
}

layer {
bottom: “res5a”
top: “res5b_branch2a”
name: “res5b_branch2a”
type: “Convolution”
convolution_param {
num_output: 512
kernel_size: 1
pad: 0
stride: 1
bias_term: false
}
param {
lr_mult: 1.0
}
}

layer {
bottom: “res5b_branch2a”
top: “res5b_branch2a”
name: “bn5b_branch2a”
type: “BatchNorm”
batch_norm_param {
use_global_stats: true
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
}

======================================

Oh,

I find that maybe the reason TensorRT2 doesn’t support dilated convolution

and it produce wrong result because pad size~ after updating to TensorRT3 it solved. Thx!!

by the way, if reshape

shape {
dim: -1
dim: 12
}

we should return DimsCHW = (12,1,1) right?

Hi,

batch size of TensorRT is set on following code:

  1. Set maximum batch size when creating the engine
    [url]https://github.com/dusty-nv/jetson-inference/blob/master/tensorNet.cpp#L158[/url]

  2. Set the real inference batch size when executing.
    [url]https://github.com/dusty-nv/jetson-inference/blob/master/imageNet.cpp#L306[/url]

Beside BatchSize information, DimsCHW = (12,1,1).

Hi,

thx for your note!!

but if with two input

and we wanna get bottom[1]->num

how can we do that in tensorRT enqueue??

because batchSize represents for bottom[0]->num ??

Hi,

BatchSize is identical across the networks.

Thx for your reply.

Hi,

when I test sample [FasterRCNN]

I revise the load image part to read .jpg

====================================
cv::Mat image = cv::imread( argv[1], CV_LOAD_IMAGE_UNCHANGED );

image -= cv::Scalar(pixelMean[0], pixelMean[1], pixelMean[2]);

unsigned volChl = INPUT_H*INPUT_W;

float* data = new float[NINPUT_CINPUT_H*INPUT_W];

cv::Mat_cv::Vec3f::iterator it, itend;

for (int c = 0; c < INPUT_C; ++c)
{
cv::Mat_cv::Vec3f::iterator it = image.begincv::Vec3f();
cv::Mat_cv::Vec3f::iterator itend = image.endcv::Vec3f();
for (unsigned j = 0; j < volChl; ++j){
data[(2-c)*volChl + j] = float ((*it)[c]);
it++;
}
}

and test this jpg image

,yet there are no correct result.

Note: the github jetson-inference using QT instead of OpenCV to load image

Is any suggestion for this problem?

Hi,

  1. QT format is RGBA while OpenCV is BGR.
  2. Please remember to convert image format from CHW to HWC.

Thanks.

Hi,

I finally find we should resize image to match the input dims → 500*375 set in protofile

and it still using openCV to load image

then it works!

thx~

Hi,

if the layer is custom layer

how could we get the parameter in the protofile?

or we only have to key in them in our code?

Hi,

IPlugin layer doesn’t support parameter parsing.
Please handle it with a self-defined file read/write.

Thanks and sorry for the inconvenience.

=========================================

input: “data”
input_shape {
dim: 1
dim: 3
dim: 224
dim: 224
}

layer {
bottom: “data”
top: “res5a_branch1”
name: “res5a_branch1”
type: “Convolution”
convolution_param {
num_output: 2048
kernel_size: 1
pad: 0
stride: 1
bias_term: false
}
param {
lr_mult: 1.0
}
}

layer {
bottom: “res5a_branch1”
top: “res5a_branch1”
name: “bn5a_branch1”
type: “BatchNorm”
batch_norm_param {
use_global_stats: true
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
}

layer {
bottom: “res5a_branch1”
top: “res5a_branch1”
name: “scale5a_branch1”
type: “Scale”
scale_param {
bias_term: true
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
}

layer {
bottom: “data”
top: “res5a_branch2a”
name: “res5a_branch2a”
type: “Convolution”
convolution_param {
num_output: 512
kernel_size: 1
pad: 0
stride: 1
bias_term: false
}
param {
lr_mult: 1.0
}
}

layer {
bottom: “res5a_branch2a”
top: “res5a_branch2a”
name: “bn5a_branch2a”
type: “BatchNorm”
batch_norm_param {
use_global_stats: true
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
}

layer {
bottom: “res5a_branch2a”
top: “res5a_branch2a”
name: “scale5a_branch2a”
type: “Scale”
scale_param {
bias_term: true
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
}

layer {
top: “res5a_branch2a”
bottom: “res5a_branch2a”
name: “res5a_branch2a_relu”
type: “ReLU”
}

layer {
bottom: “res5a_branch2a”
top: “res5a_branch2b”
name: “res5a_branch2b”
type: “Convolution”
convolution_param {
num_output: 512
kernel_size: 3
dilation: 2
pad: 2
stride: 1
bias_term: false
}
param {
lr_mult: 1.0
}
}

layer {
bottom: “res5a_branch2b”
top: “res5a_branch2b”
name: “bn5a_branch2b”
type: “BatchNorm”
batch_norm_param {
use_global_stats: true
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
}

layer {
bottom: “res5a_branch2b”
top: “res5a_branch2b”
name: “scale5a_branch2b”
type: “Scale”
scale_param {
bias_term: true
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
}

layer {
top: “res5a_branch2b”
bottom: “res5a_branch2b”
name: “res5a_branch2b_relu”
type: “ReLU”
}

layer {
bottom: “res5a_branch2b”
top: “res5a_branch2c”
name: “res5a_branch2c”
type: “Convolution”
convolution_param {
num_output: 2048
kernel_size: 1
pad: 0
stride: 1
bias_term: false
}
param {
lr_mult: 1.0
}
}

layer {
bottom: “res5a_branch2c”
top: “res5a_branch2c”
name: “bn5a_branch2c”
type: “BatchNorm”
batch_norm_param {
use_global_stats: true
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
}

layer {
bottom: “res5a_branch2c”
top: “res5a_branch2c”
name: “scale5a_branch2c”
type: “Scale”
scale_param {
bias_term: true
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
}

layer {
bottom: “res5a_branch1”
bottom: “res5a_branch2c”
top: “res5a”
name: “res5a”
type: “Eltwise”
}

layer {
bottom: “res5a”
top: “res5a”
name: “res5a_relu”
type: “ReLU”
}

layer {
bottom: “res5a”
top: “res5b_branch2a”
name: “res5b_branch2a”
type: “Convolution”
convolution_param {
num_output: 512
kernel_size: 1
pad: 0
stride: 1
bias_term: false
}
param {
lr_mult: 1.0
}
}

layer {
bottom: “res5b_branch2a”
top: “res5b_branch2a”
name: “bn5b_branch2a”
type: “BatchNorm”
batch_norm_param {
use_global_stats: true
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
}

======================================

[/quote]

How do you implement BatchNormilazation layer ? can you give me a hint?

Hi,

BatchNormalization layer can be handled directly with TensorRT scale layer.
Thanks.

Hi ,
I have trained my FRCNN using tensorflow 1.8 , i want to run the model on TX2 board , but with tensorrt 4.0 version i was getting errors. With tensor rt 5 can i use FRCNN+InceptionV2 to run on the TX2 board?

Do let me know the steps to convert FRCNN graph to work on Tensor rt