SR-LSTM icon indicating copy to clipboard operation
SR-LSTM copied to clipboard

Visualization of trajectories

Open zhangpur opened this issue 2 years ago • 14 comments

Since there are some questions about visualization, I've listed the solutions below.

  1. Use the ORIGINAL data (trajectories in meters, which I've updated named with 'true_pos_origin.csv') and download videos from the ETH/UCY website.

  2. Value of the homography: `Homo_set= [np.array([[2.8128700e-02, 2.0091900e-03, -4.6693600e+00], [8.0625700e-04, 2.5195500e-02, -5.0608800e+00], [3.4555400e-04 , 9.2512200e-05 , 4.6255300e-01]]),

    np.array([[1.1048200e-02, 6.6958900e-04, -3.3295300e+00], [-1.5966000e-03 , 1.1632400e-02 , -5.3951400e+00], [1.1190700e-04 , 1.3617400e-05 , 5.4276600e-01]]),

    np.array( [[-2.5956517e-02, -5.1572804e-18, 7.8388681e+00], [-1.0953874e-03 , 2.1664330e-02 , -1.0032272e+01], [1.9540125e-20, 4.2171410e-19 , 1.0000000e+00]]),

    np.array([[-2.5956517e-02, -5.1572804e-18, 7.8388681e+00], [-1.0953874e-03, 2.1664330e-02, -1.0032272e+01], [1.9540125e-20, 4.2171410e-19, 1.0000000e+00]]),

    np.array([[ -2.3002776e-02, 5.3741914e-04, 8.6657256e+00], [ -5.2753792e-04, 1.9565153e-02, -6.0889188e+00], [ 0.0000000e+00 , -0.0000000e+00 , 1.0000000e+00]])]`

corresponding to 5 sequences (homography of other sequences is not found): data_dirs_v = ['./data/eth/univ', './data/eth/hotel', './data/ucy/zara/zara01', './data/ucy/zara/zara02', 'data/ucy/univ/students003']

  1. Use this to get trajectories from meter to pixel. Homo = np.linalg.inv(Homo_set[setid]) pred_pixel = np.dot(Homo, pred_meter.transpose())

Then you can draw trajectories in pixels along with the video frames. Hope to help.

zhangpur avatar Aug 24 '22 15:08 zhangpur

I would like to know what is the difference between true_pos_origin.csv and true_pos_.csv. Thank you for your information @zhangpur

WangHonghui123 avatar Aug 17 '23 12:08 WangHonghui123

在经过逆阵运算后的轨迹画在eth/univ上时,会出现轨迹无法与行人路线对其的问题。请问这种问题该如何解决呢? case_eth_1

Pradur241 avatar Sep 18 '23 17:09 Pradur241

I would like to know what is the difference between true_pos_origin.csv and true_pos_.csv. Thank you for your information @zhangpur

Files of 'true_pos_origin.csv' are downloaded from the original official ETH/UCY website. Files of 'true_pos_.csv' might come from SGAN's repo or a preprocessed version. Homography transforms of the two versions of data are very different. I remember that we first used SGAN's data for visualization but the was not completely satisfactory because of their preprocessing and precision of homography, thus we used the original ones for visualization. Really sorry since it has been too long ago to remember.

zhangpur avatar Sep 22 '23 01:09 zhangpur

ata/eth/univ

We might not carefully check the correction of the homography/visualization of eth/univ. We only visualized on datasets of UCY at that time. Since it has been too long, we recommend that you follow the visualization in other repos. Sorry for this.

zhangpur avatar Sep 22 '23 02:09 zhangpur

在经过逆阵运算后的轨迹画在eth/univ上时,会出现轨迹无法与行人路线对其的问题。请问这种问题该如何解决呢? case_eth_1

We might not carefully check the correction of the homography/visualization of eth/univ. We only visualized on datasets of UCY at that time. Since it has been too long, we recommend that you follow the visualization in other repos. Sorry for this.

zhangpur avatar Sep 22 '23 02:09 zhangpur

在经过逆阵运算后的轨迹画在eth/univ上时,会出现轨迹无法与行人路线对其的问题。请问这种问题该如何解决呢? case_eth_1

We might not carefully check the correction of the homography/visualization of eth/univ. We only visualized on datasets of UCY at that time. Since it has been too long, we recommend that you follow the visualization in other repos. Sorry for this.

Thanks for your reply.

Pradur241 avatar Sep 22 '23 02:09 Pradur241

I have some issues with the visualization of the prediction trajectory. How do you draw a trajectory like a diagram in a paper? Can you share with me the code for the trajectory visualization? Thank you!

wwwwerfvgv avatar Dec 30 '23 11:12 wwwwerfvgv

在经过逆阵运算后的轨迹画在eth/univ上时,会出现轨迹无法与行人路线对其的问题。请问这种问题该如何解决呢? case_eth_1 我在预测轨迹的可视化方面遇到了一些问题。你如何在画出的轨迹? 你能和我分享一下轨迹可视化的代码吗?谢谢!

wwwwerfvgv avatar Jan 01 '24 07:01 wwwwerfvgv

@wwwwerfvgv 可视化这块的代码我们做的也不是很好,还是存在一些点对不上的问题。主要是利用数据集提供的单应性矩阵来计算。

if dset == 'zara01':

            pts_img = np.array([[311, -45],
                                [182, -31],
                                [-348, 129],
                                [-258, 36]])
            pts_img = np.stack((288 - pts_img[:, 1], 360 + pts_img[:, 0]), axis=-1)
            pts_world = np.array([[14.1222088559, 5.79943313304],
                                  [11.4072089417, 6.13355685264],
                                  [0.252558131551, 9.95211364805],
                                  [2.14674411818, 7.73257751072]])
            H_zara01, _ = cv2.findHomography(pts_img, pts_world)
            H_zara01_inv = np.linalg.inv(H_zara01)

        # zara02
        elif dset == 'zara02':

            pts_img = np.array([[279, -123],
                                [274, -102],
                                [206, -102],
                                [202, -72]])
            pts_img = np.stack((288 - pts_img[:, 1], 360 + pts_img[:, 0]), axis=-1)
            pts_world = np.array([[13.4487205051, 3.93788669527],
                                  [13.3434879503, 4.43907227467],
                                  [11.9123252048, 4.43907227467],
                                  [11.828139161, 5.15505167381]])
            H_zara02, _ = cv2.findHomography(pts_img, pts_world)
            H_zara02_inv = np.linalg.inv(H_zara02)

        # students003
        elif dset == 'univ':
            pts_img = np.array([[70, -35],
                                [179, 22],
                                [-71, -137],
                                [-252, -28]])
            pts_img = np.stack((288 - pts_img[:, 1], 360 + pts_img[:, 0]), axis=-1)
            pts_world = np.array([[9.0499997139, 6.03809293275],
                                  [11.3440694088, 7.39845379112],
                                  [6.08244166818, 3.60376297567],
                                  [2.27302318396, 6.20515479255]])
            H_univ, _ = cv2.findHomography(pts_img, pts_world)
            H_univ_inv = np.linalg.inv(H_univ)

        # hotel
        elif dset == 'hotel':

            H_hotel = np.array([[1.1048200e-02, 6.6958900e-04, -3.3295300e+00],
                                [-1.5966000e-03, 1.1632400e-02, -5.3951400e+00],
                                [1.1190700e-04, 1.3617400e-05, 5.4276600e-01]])
            H_hotel_inv = np.linalg.inv(H_hotel)

        elif dset == 'eth':

            H_eth = np.array([[2.8128700e-02, 2.0091900e-03, -4.6693600e+00],
                              [8.0625700e-04, 2.5195500e-02, -5.0608800e+00],
                              [3.4555400e-04, 9.2512200e-05, 4.6255300e-01]])
            H_eth_inv = np.linalg.inv(H_eth)

可以参考一下 https://github.com/abduallahmohamed/Social-Implicit 这个仓库里的可视化,时间有点久了,我忘了参考的代码都有啥了

Pradur241 avatar Jan 01 '24 07:01 Pradur241

@wwwwerfvgv 可视化这块的代码我们做的也不是很好,还是存在一些点对不上的问题。主要是利用数据集提供的单应性矩阵来计算。

if dset == 'zara01':

            pts_img = np.array([[311, -45],
                                [182, -31],
                                [-348, 129],
                                [-258, 36]])
            pts_img = np.stack((288 - pts_img[:, 1], 360 + pts_img[:, 0]), axis=-1)
            pts_world = np.array([[14.1222088559, 5.79943313304],
                                  [11.4072089417, 6.13355685264],
                                  [0.252558131551, 9.95211364805],
                                  [2.14674411818, 7.73257751072]])
            H_zara01, _ = cv2.findHomography(pts_img, pts_world)
            H_zara01_inv = np.linalg.inv(H_zara01)

        # zara02
        elif dset == 'zara02':

            pts_img = np.array([[279, -123],
                                [274, -102],
                                [206, -102],
                                [202, -72]])
            pts_img = np.stack((288 - pts_img[:, 1], 360 + pts_img[:, 0]), axis=-1)
            pts_world = np.array([[13.4487205051, 3.93788669527],
                                  [13.3434879503, 4.43907227467],
                                  [11.9123252048, 4.43907227467],
                                  [11.828139161, 5.15505167381]])
            H_zara02, _ = cv2.findHomography(pts_img, pts_world)
            H_zara02_inv = np.linalg.inv(H_zara02)

        # students003
        elif dset == 'univ':
            pts_img = np.array([[70, -35],
                                [179, 22],
                                [-71, -137],
                                [-252, -28]])
            pts_img = np.stack((288 - pts_img[:, 1], 360 + pts_img[:, 0]), axis=-1)
            pts_world = np.array([[9.0499997139, 6.03809293275],
                                  [11.3440694088, 7.39845379112],
                                  [6.08244166818, 3.60376297567],
                                  [2.27302318396, 6.20515479255]])
            H_univ, _ = cv2.findHomography(pts_img, pts_world)
            H_univ_inv = np.linalg.inv(H_univ)

        # hotel
        elif dset == 'hotel':

            H_hotel = np.array([[1.1048200e-02, 6.6958900e-04, -3.3295300e+00],
                                [-1.5966000e-03, 1.1632400e-02, -5.3951400e+00],
                                [1.1190700e-04, 1.3617400e-05, 5.4276600e-01]])
            H_hotel_inv = np.linalg.inv(H_hotel)

        elif dset == 'eth':

            H_eth = np.array([[2.8128700e-02, 2.0091900e-03, -4.6693600e+00],
                              [8.0625700e-04, 2.5195500e-02, -5.0608800e+00],
                              [3.4555400e-04, 9.2512200e-05, 4.6255300e-01]])
            H_eth_inv = np.linalg.inv(H_eth)

可以参考一下 https://github.com/abduallahmohamed/Social-Implicit 这个仓库里的可视化,时间有点久了,我忘了参考的代码都有啥了 感谢您的回复,但还是没有实现可视化,如果可以,能不能分享一下源代码,感谢!

wwwwerfvgv avatar Jan 13 '24 12:01 wwwwerfvgv

最近有点忙,刚看见,你留下邮箱吧 @wwwwerfvgv

Pradur241 avatar Feb 01 '24 13:02 Pradur241

最近有点忙,刚看见,你留下邮箱吧 @wwwwerfvgv

不好意思,刚看到,非常感谢,这是我的邮箱[email protected]

wwwwerfvgv avatar Feb 21 '24 06:02 wwwwerfvgv

您好,我在可视化轨迹时也遇到了一些问题,请问可以分享一下源代码吗,谢谢!我的邮箱是[email protected]

DongDaisy avatar Apr 15 '24 06:04 DongDaisy