Alpr-unconstrained postprocessing

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) -> T4
• DeepStream Version -> 5.0
• JetPack Version (valid for Jetson only)
• TensorRT Version -> 7.0
• NVIDIA GPU Driver Version (valid for GPU only) -> 440.82

So, I have been able to convert alpr-unconstrained to TensorRT and getting the correct infer results.

Now, I want to detect LP on top of objectDetector_Yolo, I have been able to create a pipeline with back to back detectors. The problem is the postprocessing of LPD output.

Do, I have to write the port all the post processing code in C++ from NumPy/Python which is very tedious task and my inexperience in C++ make it even more difficult. Or can I use python itself to parse the output.

Below is the output parsing in python:

def reconstruct(I,Y,out_size,threshold=.9):
    net_stride  = 2**4
    side        = ((208. + 40.)/2.)/net_stride # 7.75
    Probs = Y[...,0]
    Affines = Y[...,2:]
    rx,ry = Y.shape[:2]
    ywh = Y.shape[1::-1]
    iwh = np.array(I.shape[1::-1],dtype=float).reshape((2,1))
    xx,yy = np.where(Probs>threshold)
    WH = getWH(I.shape)
    MN = WH/net_stride
    vxx = vyy = 0.5 #alpha
    base = lambda vx,vy: np.matrix([[-vx,-vy,1.],[vx,-vy,1.],[vx,vy,1.],[-vx,vy,1.]]).T
    labels = []
    for i in range(len(xx)):
        y,x = xx[i],yy[i]
        affine = Affines[y,x]
        prob = Probs[y,x]
        mn = np.array([float(x) + .5,float(y) + .5])
        A = np.reshape(affine,(2,3))
        A[0,0] = max(A[0,0],0.)
        A[1,1] = max(A[1,1],0.)
        pts = np.array(A*base(vxx,vyy)) #*alpha
        pts_MN_center_mn = pts*side
        pts_MN = pts_MN_center_mn + mn.reshape((2,1))
        pts_prop = pts_MN/MN.reshape((2,1))
     final_labels = nms(labels,.1)
     TLps = []
      return final_labels

The problem is C++ buffers are 1D array and the post processing in original code is done in NumPy nd array. Thanks in advance.

Currently, only C++ DeepStream support customized post-processing. There is no python interface to do this.

1 Like