Skip to content

Commit

Permalink
Accept changes
Browse files Browse the repository at this point in the history
  • Loading branch information
KeplerC committed Oct 2, 2024
2 parents c9975fe + f129d37 commit 834fdcd
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 28 deletions.
7 changes: 4 additions & 3 deletions benchmarks/Visualization.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
46 changes: 23 additions & 23 deletions benchmarks/openx_by_episode.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -340,34 +340,34 @@ 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,
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,
# ),
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,
Expand Down Expand Up @@ -438,4 +438,4 @@ def evaluation(args):
)
args = parser.parse_args()

evaluation(args)
evaluation(args)
8 changes: 6 additions & 2 deletions benchmarks/openx_by_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -458,4 +462,4 @@ def evaluation(args):
)
args = parser.parse_args()

evaluation(args)
evaluation(args)
3 changes: 3 additions & 0 deletions fog_x/loader/rlds.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 834fdcd

Please sign in to comment.