Zhaoting123 commited on
Commit
2fb0eb7
·
verified ·
1 Parent(s): a54b7c3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -8
app.py CHANGED
@@ -69,6 +69,8 @@ DEFAULT_PRESET = "Robosuite Square Correction"
69
  REPO_TYPE = "dataset"
70
  DEFAULT_CHUNK_LEN = 16
71
  DEFAULT_DISPLAY_SCALE = 1
 
 
72
  PREFERRED_IMAGE_KEYS = [
73
  "image1",
74
  "image2",
@@ -720,7 +722,7 @@ def get_video_status_plot_base(repo_id, filename, traj_id, valid_window_len):
720
 
721
  no_teacher, valid_indices = _compute_valid_start_indices(traj, int(valid_window_len))
722
 
723
- fig, ax = plt.subplots(figsize=(10.5, 2.8), dpi=170)
724
  ax.step(
725
  np.arange(total_steps),
726
  no_teacher,
@@ -741,14 +743,14 @@ def get_video_status_plot_base(repo_id, filename, traj_id, valid_window_len):
741
 
742
  ax.set_xlim(0, max(total_steps - 1, 1))
743
  ax.set_ylim(-0.38, 1.1)
744
- ax.set_ylabel("Flag", fontsize=10)
745
- ax.set_xlabel("Timestep index", fontsize=10)
746
  ax.set_yticks([0, 1])
747
  ax.set_yticklabels(["False", "True"])
748
  ax.grid(True, axis="x", alpha=0.2)
749
- ax.set_title("no_teacher_action and valid starts", fontsize=11)
750
- ax.tick_params(axis="both", labelsize=9)
751
- ax.legend(loc="upper right", fontsize=9)
752
  fig.tight_layout()
753
  fig.canvas.draw()
754
 
@@ -849,7 +851,7 @@ def _get_fast_video_writer(out_path, fps):
849
  )
850
 
851
 
852
- def build_current_trajectory_video(preset_name, custom_repo_id, custom_filename, traj_id, image_keys, display_scale, reverse_channels, fps, valid_window_len, video_stride=1):
853
  if imageio is None:
854
  return None, "Video export requires imageio and imageio-ffmpeg in requirements.txt."
855
 
@@ -1121,7 +1123,7 @@ def build_app():
1121
  preload_btn = gr.Button("Preload current trajectory")
1122
  video_btn = gr.Button("Build trajectory video")
1123
  video_fps = gr.Slider(minimum=1, maximum=30, value=10, step=1, label="Video FPS")
1124
- video_stride = gr.Slider(minimum=1, maximum=10, value=1, step=1, label="Video frame stride")
1125
 
1126
  preload_status = gr.Textbox(label="Preload / video status", lines=4, value="Not preloaded yet.", interactive=False)
1127
 
 
69
  REPO_TYPE = "dataset"
70
  DEFAULT_CHUNK_LEN = 16
71
  DEFAULT_DISPLAY_SCALE = 1
72
+ VIDEO_STATUS_FIGSIZE = (6.0, 1.8)
73
+ VIDEO_STATUS_DPI = 120
74
  PREFERRED_IMAGE_KEYS = [
75
  "image1",
76
  "image2",
 
722
 
723
  no_teacher, valid_indices = _compute_valid_start_indices(traj, int(valid_window_len))
724
 
725
+ fig, ax = plt.subplots(figsize=VIDEO_STATUS_FIGSIZE, dpi=VIDEO_STATUS_DPI)
726
  ax.step(
727
  np.arange(total_steps),
728
  no_teacher,
 
743
 
744
  ax.set_xlim(0, max(total_steps - 1, 1))
745
  ax.set_ylim(-0.38, 1.1)
746
+ ax.set_ylabel("Flag", fontsize=8)
747
+ ax.set_xlabel("Timestep index", fontsize=8)
748
  ax.set_yticks([0, 1])
749
  ax.set_yticklabels(["False", "True"])
750
  ax.grid(True, axis="x", alpha=0.2)
751
+ ax.set_title("no_teacher_action and valid starts", fontsize=9)
752
+ ax.tick_params(axis="both", labelsize=7)
753
+ ax.legend(loc="upper right", fontsize=7)
754
  fig.tight_layout()
755
  fig.canvas.draw()
756
 
 
851
  )
852
 
853
 
854
+ def build_current_trajectory_video(preset_name, custom_repo_id, custom_filename, traj_id, image_keys, display_scale, reverse_channels, fps, valid_window_len, video_stride=4):
855
  if imageio is None:
856
  return None, "Video export requires imageio and imageio-ffmpeg in requirements.txt."
857
 
 
1123
  preload_btn = gr.Button("Preload current trajectory")
1124
  video_btn = gr.Button("Build trajectory video")
1125
  video_fps = gr.Slider(minimum=1, maximum=30, value=10, step=1, label="Video FPS")
1126
+ video_stride = gr.Slider(minimum=1, maximum=10, value=4, step=1, label="Video frame stride")
1127
 
1128
  preload_status = gr.Textbox(label="Preload / video status", lines=4, value="Not preloaded yet.", interactive=False)
1129