diff --git a/benchmarks/Visualization.ipynb b/benchmarks/Visualization.ipynb index d88765a..8cb6e29 100644 --- a/benchmarks/Visualization.ipynb +++ b/benchmarks/Visualization.ipynb @@ -55,7 +55,7 @@ "import seaborn as sns\n", "sns.set_context(\"poster\")\n", "# Read the CSV file\n", - "df = pd.read_csv('./format_comparison_results.csv')\n", + "df = pd.read_csv('../format_comparison_results.csv') # openx_ByFrame.py is writing into fog_x/\n", "\n", "# Define colors and markers for each format\n", "format_styles = {\n", @@ -69,6 +69,7 @@ "# Update the format name from 'VLA' to 'Fog-VLA-DM' in the DataFrame\n", "df['Format'] = df['Format'].replace('VLA', 'Fog-VLA-DM')\n", "df['Format'] = df['Format'].replace('FFV1', 'Fog-VLA-DM-lossless')\n", + "df['Format'] = df['Format'].replace('HF', 'LEROBOT')\n", "\n", "# Update the format_styles dictionary\n", "format_styles['Fog-VLA-DM'] = format_styles.pop('VLA', ('blue', 'o'))\n", @@ -239,7 +240,7 @@ "import seaborn as sns\n", "\n", "# Read the CSV file\n", - "df = pd.read_csv('./format_comparison_results.csv')\n", + "df = pd.read_csv('../format_comparison_results.csv')\n", "\n", "# Update the format names\n", "df['Format'] = df['Format'].replace('VLA', 'Fog-VLA-DM')\n", @@ -340,7 +341,7 @@ "sns.set_context(\"poster\")\n", "\n", "# Read the CSV file\n", - "df = pd.read_csv('./format_comparison_results.csv')\n", + "df = pd.read_csv('../format_comparison_results.csv')\n", "\n", "# Define colors and markers for each format\n", "format_styles = {\n", diff --git a/benchmarks/openx_by_episode.py b/benchmarks/openx_by_episode.py index f8db194..5ba27d4 100644 --- a/benchmarks/openx_by_episode.py +++ b/benchmarks/openx_by_episode.py @@ -3,7 +3,7 @@ import argparse import time import numpy as np -from fog_x.loader import RLDSLoader, VLALoader, HDF5Loader +from fog_x.loader import RLDSLoader, VLALoader import tensorflow as tf import pandas as pd import fog_x @@ -340,13 +340,13 @@ def evaluation(args): logger.debug(f"Evaluating dataset: {dataset_name}") handlers = [ - # VLAHandler( - # args.exp_dir, - # dataset_name, - # args.num_batches, - # args.batch_size, - # args.log_frequency, - # ), + VLAHandler( + args.exp_dir, + dataset_name, + args.num_batches, + args.batch_size, + args.log_frequency, + ), HDF5Handler( args.exp_dir, dataset_name, @@ -354,20 +354,20 @@ def evaluation(args): args.batch_size, args.log_frequency, ), - # LeRobotHandler( - # args.exp_dir, - # dataset_name, - # args.num_batches, - # args.batch_size, - # args.log_frequency, - # ), - # RLDSHandler( - # args.exp_dir, - # dataset_name, - # args.num_batches, - # args.batch_size, - # args.log_frequency, - # ), + LeRobotHandler( + args.exp_dir, + dataset_name, + args.num_batches, + args.batch_size, + args.log_frequency, + ), + RLDSHandler( + args.exp_dir, + dataset_name, + args.num_batches, + args.batch_size, + args.log_frequency, + ), # FFV1Handler( # args.exp_dir, # dataset_name, @@ -438,4 +438,4 @@ def evaluation(args): ) args = parser.parse_args() - evaluation(args) + evaluation(args) \ No newline at end of file diff --git a/benchmarks/openx_by_frame.py b/benchmarks/openx_by_frame.py index c94d927..8e97887 100644 --- a/benchmarks/openx_by_frame.py +++ b/benchmarks/openx_by_frame.py @@ -423,9 +423,13 @@ def evaluation(args): # Write all results to CSV results_df = pd.DataFrame(all_results) - results_df.to_csv(csv_file, index=False) + results_df.to_csv(csv_file, index = False) logger.debug(f"Results appended to {csv_file}") + # if os.path.exists(csv_file): + # print("exist in", os.path.abspath(csv_file)) + # print(pd.read_csv(csv_file)) + if __name__ == "__main__": parser = argparse.ArgumentParser( @@ -458,4 +462,4 @@ def evaluation(args): ) args = parser.parse_args() - evaluation(args) + evaluation(args) \ No newline at end of file diff --git a/fog_x/loader/rlds.py b/fog_x/loader/rlds.py index 8403580..e43035b 100644 --- a/fog_x/loader/rlds.py +++ b/fog_x/loader/rlds.py @@ -142,8 +142,11 @@ def to_numpy(step_data): num_frames = len(traj["steps"]) if num_frames >= self.slice_length: random_from = np.random.randint(0, num_frames - self.slice_length + 1) + # random_to = random_from + self.slice_length trajs = traj["steps"].skip(random_from).take(self.slice_length) else: + # random_from = 0 + # random_to = num_frames trajs = traj["steps"] for step in trajs: trajectory.append(to_numpy(step))