Shuijing725 / CrowdNav_Prediction_AttnGraph

[ICRA 2023] Intention Aware Robot Crowd Navigation with Attention-Based Interaction Graph
https://sites.google.com/view/intention-aware-crowdnav/home
MIT License
148 stars 29 forks source link

Test.py settings partial settings not working #8

Open Lilyoung2000 opened 9 months ago

Lilyoung2000 commented 9 months ago

Hello, do you still remember me? I still have some issues with the test.py, when I set save_slides=True, the folder trained_models/GST_predictor_rand/social_eval/41665 where the results are saved is empty. There is also a problem with the --test_case parameter setting. When I set any other positive number, the test will still run for 500 episodes. I'm confused and made some modifications to evaluation.py but it doesn't work. Do you have any suggestions? Maybe the uploaded file is incomplete

Shuijing725 commented 9 months ago

Sorry about that. Can you copy-paste the following codes into line 236 in crowd_sim_pred_real_gst.py (right before plt.pause(0.1))?

  # save plot for slide show
  if self.config.save_slides:
      import os
      folder_path = os.path.join(self.config.save_path, str(self.episode_k))
      if not os.path.isdir(folder_path):
          os.makedirs(folder_path, exist_ok = True)
      plt.savefig(os.path.join(folder_path, str(self.step_counter)+'.png'), dpi=300)

Also, in test.py, you need to set both --visualize and --save_slides to True.

Lilyoung2000 commented 9 months ago

Thanks for the quick reply, that works. But I still have the following three questions

  1. When the test case is changed from -1 to a positive number, 500 cases are still run.
  2. I want to add other mechanisms to the network defined by selfAttn_srnn_temp_node.py. Is it feasible?
  3. I trained other trajectory predictors and got a pkl file, but when I converted it to a pt file and replaced 41665.pt, an error occurred. _cgi-bin_mmwebwx-bin_webwxgetmsgimg  MsgID=1205188368518026180 skey=@crypt_51605252_6b4e81ce556782e936e9620a36e582cc mmweb_appid=wx_webfilehelper
Shuijing725 commented 9 months ago
  1. Yes it is a bug. For a quick fix, you can set the desired seed in this line
  2. Yes you can redefine the human-human attention function here and robot-human attention here
  3. I'm confused about what you mean. "41665.pt" sounds like the name of a robot policy checkpoint, not a human trajectory predictor.
Shuijing725 commented 9 months ago

Sorry about that. Can you copy-paste the following codes into line 236 in crowd_sim_pred_real_gst.py (right before plt.pause(0.1))?

  # save plot for slide show
  if self.config.save_slides:
      import os
      folder_path = os.path.join(self.config.save_path, str(self.episode_k))
      if not os.path.isdir(folder_path):
          os.makedirs(folder_path, exist_ok = True)
      plt.savefig(os.path.join(folder_path, str(self.step_counter)+'.png'), dpi=300)

Also, in test.py, you need to set both --visualize and --save_slides to True.

The code for saving slides is added in save_slides branch. The output figures are saved in your_model_path/social_eval/ folder. Please let me know if you have any issues.

Lilyoung2000 commented 8 months ago

Awesome, everything you said is correct! What should I do if I want to change the visualization style? Specifically, I want to add a dotted line on the path where the robot moves, so that the trajectory of the robot is more intuitive.

Shuijing725 commented 8 months ago

To achieve this, you can use some data structure to save all positions of the robot before the episode ends, then draw a line between every pair of adjacent positions.

Lilyoung2000 commented 8 months ago

Thank you! But where is the script for the visualization file

Shuijing725 commented 8 months ago

The code is in another repo. I just added you as a collaborator. The code is in trajectory_graphing branch (check the latest few commits in this branch). Note that the code is not cleaned, and please don't overwrite anything.

Lilyoung2000 commented 8 months ago

Thanks for your support, I found the visualization files in that branch. 1704164764874 But why can crowd++ visualize without this script, so I have some questions, how to modify the visualization of crowd++

Shuijing725 commented 8 months ago

Sorry, I thought we were talking about another paper. I just added you to the correct repo. I believe the code is in "adds saving episode trajectory plot capability" commit in "render_traj" branch. And again, please don't overwrite anything in the repo.

Lilyoung2000 commented 8 months ago

I'm still a little confused, I think we're talking about the Intention Aware Robot Crowd Navigation with Attention-Based Interaction Graph article, and its repository. Your previous work is great and I know about it, but what I want to modify is this visualization. 31e17a771f9ab1833ec60ff9b4e3b78 I think the submission of adds saving episode trajectory plot capability may not be the key.

Lilyoung2000 commented 8 months ago

I think the visualization file in the CrowdNav_Prediction_AttnGraph project may be in crowd_sim.py. But it doesn't work when I make simple changes to the visualization, like when I change the color on line 758

Shuijing725 commented 6 months ago

Sorry about the late reply. The CrowdNav_Prediction repo is indeed the development version of our ICRA 2023 paper, not ICRA 2021 paper. It's easier for me to help you if you can give me the error trace or output figure and what changes you made to which file(s).