zhangpur / SR-LSTM

States Refinement LSTM
MIT License
116 stars 36 forks source link

Visualization of trajectories #8

Open zhangpur opened 2 years ago

zhangpur commented 2 years ago

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.

WangHonghui123 commented 1 year ago

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

Pradur241 commented 1 year ago

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

zhangpur commented 1 year ago

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

Files of 'true_pos_origin.csv' are downloaded from the original official ETH/UCY website. Files of 'truepos.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 commented 1 year ago

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 commented 1 year ago

在经过逆阵运算后的轨迹画在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.

Pradur241 commented 1 year ago

在经过逆阵运算后的轨迹画在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.

wwwwerfvgv commented 11 months ago

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 commented 11 months ago

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

Pradur241 commented 11 months ago

@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 commented 10 months ago

@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 commented 10 months ago

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

wwwwerfvgv commented 9 months ago

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

不好意思,刚看到,非常感谢,这是我的邮箱wo20220728@gmail.com

DongDaisy commented 7 months ago

您好,我在可视化轨迹时也遇到了一些问题,请问可以分享一下源代码吗,谢谢!我的邮箱是dongxingchen0111@163.com

sky-wind-13 commented 3 months ago

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

不好意思,刚看到,非常感谢,这是我的邮箱 wo20220728@gmail.com 您好,我在可视化轨迹时也遇到了一些问题,请问可以分享一下源代码吗,谢谢!我的邮箱是yuzhang200102@163.com

Joker-hang commented 3 weeks ago

您好,我在可视化轨迹时也遇到了一些问题,请问可以分享一下源代码吗,谢谢!我的邮箱是526291005@qq.com