TRT_Ultra_Fast_Lane_Detect icon indicating copy to clipboard operation
TRT_Ultra_Fast_Lane_Detect copied to clipboard

The result can not display correctly

Open hwang12345 opened this issue 3 years ago • 2 comments

hey, @KopiSoftware thanks your nice code ,i had get the trt model,but i have a problem about display the result on image.

the err code:

            out_j = trt_outputs[0].reshape(101, 56, 4)
            prob = scipy.special.softmax(out_j[:-1, :, :], axis=0)

            idx = np.arange(100) + 1
            idx = idx.reshape(-1, 1, 1)

            loc = np.sum(prob * idx, axis=0)
            out_j = np.argmax(out_j, axis=0)
            loc[out_j == 100] = 0
            out_j = loc
            for i in range(out_j.shape[1]):
                if np.sum(out_j[:, i] != 0) > 2:
                    for k in range(out_j.shape[0]):
                        if out_j[k, i] > 0:
                            ppp = (int(out_j[k, i] * col_sample_w * img_w / 800) - 1,
                                   int(img_h * (row_anchor[cls_num_per_lane - 1 - k] / 288)) - 1)
                            cv2.circle(frame, ppp, 5, (0, 255, 0), -1)

Screenshot from 2022-02-18 18-10-31 i use pytorch code is correct:

        out_j = out[0].data.cpu().numpy()
        out_j = out_j[:, ::-1, :]
        prob = scipy.special.softmax(out_j[:-1, :, :], axis=0)

        idx = np.arange(cfg.griding_num) + 1
        idx = idx.reshape(-1, 1, 1)

        loc = np.sum(prob * idx, axis=0)
        out_j = np.argmax(out_j, axis=0)
        loc[out_j == cfg.griding_num] = 0
        out_j = loc
         for i in range(out_j.shape[1]):
                if np.sum(out_j[:, i] != 0) > 2:
                    for k in range(out_j.shape[0]):
                        if out_j[k, i] > 0:
                            ppp = (int(out_j[k, i] * col_sample_w * img_w / 800) - 1, int(img_h * (row_anchor[cls_num_per_lane-1-k]/288)) - 1 )
                            cv2.circle(frame,ppp,5,(0,255,0),-1)

result

hwang12345 avatar Feb 18 '22 10:02 hwang12345

Yeeeeeeeeeeeeeeeeeeeeesss, there is some problem with my code, but I so busy recently. Thanks for your attribution. I will try it out lately.

KopiSoftware avatar Mar 16 '22 13:03 KopiSoftware

Apologize, I was gonna say " thanks for your contribution".

KopiSoftware avatar Mar 17 '22 10:03 KopiSoftware