sergiomsilva / alpr-unconstrained

License Plate Detection and Recognition in Unconstrained Scenarios

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LP detector TensorRT Incorrect Result

AsharFatmi opened this issue · comments

I have a custom Keras Detection model [ From ALPR-unconstrained GitHub repo ], I am attaching a link to the model JSON file here:-

modelconfig.json

I converted the Keras model to onnx using keras2onnx, Then used onnx_to_tensorrt.py to convert the model to the TRT engine.

onnx_to_tensorrt.py

The output of the two models are not the same, so I cannot get the detection region.

Keras model output:-

[[[ 5.35682165e-16  1.00000000e+00  1.02072847e+00 ... -2.07958460e-01
    5.04563272e-01 -1.20855430e-02]
  [ 8.77869645e-17  1.00000000e+00  7.72716165e-01 ... -1.96673796e-01
    6.91386938e-01 -5.71288705e-01]
  [ 1.62569552e-29  1.00000000e+00  1.13321781e+00 ... -1.17423847e-01
    7.27890730e-01 -2.67761678e-01]
  ...
  [ 9.93481616e-11  1.00000000e+00  8.08987558e-01 ... -1.09358504e-01
    3.96312863e-01 -3.76817733e-02]
  [ 5.05836795e-08  1.00000000e+00  6.38040662e-01 ...  2.58072745e-03
    4.28376526e-01 -3.47221732e-01]
  [ 2.63872035e-09  1.00000000e+00  8.12149942e-01 ... -1.26684764e-02
    1.86289668e-01 -6.14305809e-02]]

 [[ 1.15013890e-12  1.00000000e+00  1.06367087e+00 ... -5.53396583e-01
    3.23190212e-01 -1.00925833e-01]
  [ 7.17620210e-18  1.00000000e+00  8.54213297e-01 ...  4.44860458e-01
   -6.65633440e-01 -1.41143531e-01]
  [ 4.54133458e-24  1.00000000e+00  1.19984531e+00 ...  1.20644540e-01
   -3.73397738e-01 -6.67934895e-01]
  ...
  [ 1.03462021e-08  1.00000000e+00  1.14307857e+00 ... -1.53487191e-01
    2.21320093e-01 -2.01362371e-01]
  [ 1.97145482e-08  1.00000000e+00  9.24914479e-01 ...  3.22847784e-01
   -6.38035834e-02 -2.14298382e-01]
  [ 1.70783192e-08  1.00000000e+00  9.65804636e-01 ...  4.09364104e-02
    2.28743017e-01 -3.36741388e-01]]

 [[ 8.94335161e-11  1.00000000e+00  7.75921345e-01 ...  1.04476353e-02
    1.51742458e-01  5.28428927e-02]
  [ 9.04731773e-16  1.00000000e+00  4.41512674e-01 ...  1.06468916e-01
   -8.99115801e-02  2.96098143e-01]
  [ 2.10258343e-17  1.00000000e+00  2.47518599e-01 ...  7.37828463e-02
   -1.92303687e-01  4.42358196e-01]
  ...
  [ 2.41078150e-16  1.00000000e+00  8.20632398e-01 ... -1.57306686e-01
    1.35591239e-01 -4.33367584e-03]
  [ 1.30340170e-13  1.00000000e+00  6.97541475e-01 ... -1.88214704e-01
    8.80702883e-02 -1.52649814e-02]
  [ 5.57648372e-09  1.00000000e+00  9.97833073e-01 ... -1.55004978e-01
    2.76494384e-01 -6.27942905e-02]]

 ...

 [[ 0.00000000e+00  1.00000000e+00  8.85395885e-01 ...  3.80443633e-02
    4.81112301e-01 -1.28768587e+00]
  [ 0.00000000e+00  1.00000000e+00  1.00841582e+00 ... -2.23223472e+00
   -3.39565903e-01 -5.87081552e-01]
  [ 0.00000000e+00  1.00000000e+00  1.37934232e+00 ... -1.70936894e+00
    2.07115859e-01 -2.22187567e+00]
  ...
  [ 2.83864250e-25  1.00000000e+00  1.45969176e+00 ... -7.09485292e-01
    2.28834689e-01 -3.29626322e-01]
  [ 1.24496172e-15  1.00000000e+00  1.31729507e+00 ... -6.66390240e-01
    1.25542924e-01 -1.47483870e-01]
  [ 2.48216048e-09  1.00000000e+00  1.15188110e+00 ... -1.47737026e-01
    3.60481203e-01 -2.20017970e-01]]

 [[ 0.00000000e+00  1.00000000e+00  1.48687065e-01 ... -8.53215158e-01
   -1.15160823e+00  8.59936476e-01]
  [ 0.00000000e+00  1.00000000e+00  6.86580241e-01 ...  2.05904245e-02
    3.43396455e-01 -6.00309968e-01]
  [ 0.00000000e+00  1.00000000e+00 -1.29906058e-01 ...  8.33660722e-01
    6.93807364e-01  5.96281648e-01]
  ...
  [ 2.00734995e-30  1.00000000e+00  8.45168352e-01 ...  4.50236648e-02
    3.50932181e-01 -7.83286393e-02]
  [ 2.55876199e-19  1.00000000e+00  9.60333586e-01 ...  2.57166326e-02
    5.82121909e-02 -9.72378105e-02]
  [ 4.64498925e-12  1.00000000e+00  9.78434443e-01 ...  6.36013597e-02
    3.79364163e-01 -3.65832038e-02]]

 [[ 0.00000000e+00  1.00000000e+00 -1.19233370e-01 ... -3.39587510e-01
    8.02178085e-02  1.38728428e+00]
  [ 0.00000000e+00  1.00000000e+00 -2.54251719e-01 ...  9.89254951e-01
   -1.02365923e+00  1.74043214e+00]
  [ 0.00000000e+00  1.00000000e+00  6.75196886e-01 ...  1.14767244e-02
    8.67833734e-01  5.49621701e-01]
  ...
  [ 1.01715141e-30  1.00000000e+00  1.23101699e+00 ... -3.87017936e-01
    1.34929419e-01  1.46293178e-01]
  [ 5.34217413e-22  1.00000000e+00  1.08855963e+00 ... -6.93247654e-04
    1.25452936e-01  7.26785064e-02]
  [ 2.12459472e-13  1.00000000e+00  9.25891340e-01 ... -5.17582297e-02
    1.55512884e-01 -1.80828243e-01]]]

TensorRT model OUTPUT:-

[ 0. 1. 78.799255 ... 40.333122 4.732708 48.27634 ]

Any idea how to solve this?

Thanks in advance