InhwanBae / GPGraph

Official Code for "Learning Pedestrian Group Representations for Multi-modal Trajectory Prediction (ECCV 2022)"
https://ihbae.com/publication/gpgraph/
MIT License
60 stars 9 forks source link

Group Visualization #7

Open Luo624 opened 8 months ago

Luo624 commented 8 months ago

Hello, I am very interested in your work. I would like to know how it is done in the group visualization piece and what is the name of the graph, I would like to try to plot it but I don't know the name of the graph. _cgi-bin_mmwebwx-bin_webwxgetmsgimg__ MsgID=908891790643046299 skey=@crypt_9876ca9_6e71b062e702241b7520f3d617c3a30b mmweb_appid=wx_webfilehelper

InhwanBae commented 8 months ago

Hi, @Luo624!

I used a convex hull algorithm to group the members into regions for visualization. I hope the code snippet below is helpful to you.

from scipy.spatial import ConvexHull
import matplotlib.pyplot as plt
from matplotlib.patches import Polygon

plt.figure()
r, theta = 16, np.arange(0, 32, 1) / 32 * 2 * np.pi
circle_points = np.column_stack([r * np.cos(theta), r * np.sin(theta)])
group_member = points[indices == group_idx]
group_circle_points = np.concatenate([circle_points + member for member in group_member], axis=0)
hull = ConvexHull(group_circle_points)
point = group_circle_points[hull.vertices]
p = Polygon(point, facecolor='#DCE3E9', edgecolor='#23445D', linewidth=3, zorder=-hull.area)
plt.gca().add_patch(p)
Luo624 commented 8 months ago

Hi, InhwanBae! Thanks for your reply, I think I know how to realize.

chenxi-xr commented 8 months ago

Hi, InhwanBae! I don't know how to define some of the variables in the above code snippet, can you please publish the complete group visualization code? Thank you very much!!

Pradur241 commented 7 months ago

@Luo624 Hi, have you realize the visualization of group? Can you please share the code? Thank you very much!!

Luo624 commented 7 months ago

@Pradur241 You can refer to the author's reply above, trust me, it's not hard.