From c6c0f98bb03fe49b11bcb4e23d77817038e7c2cb Mon Sep 17 00:00:00 2001 From: Eric Chen Date: Wed, 24 Apr 2024 02:24:06 +0000 Subject: [PATCH] fix path double slash and os dir --- README.md | 6 +++--- fog_x/database/polars_connector.py | 2 +- fog_x/dataset.py | 9 +++++++-- requirements.txt | 5 ++++- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 6b93567..f38be4c 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ -# 🦊 Fog-X +# 🦊 Fog-RT-X [![codecov](https://codecov.io/gh/KeplerC/fog_x/branch/main/graph/badge.svg?token=fog_x_token_here)](https://codecov.io/gh/KeplerC/fog_x) [![CI](https://github.com/KeplerC/fog_x/actions/workflows/main.yml/badge.svg)](https://github.com/KeplerC/fog_x/actions/workflows/main.yml) -🦊 Fog-X: An Efficient and Scalable Data Collection and Management Framework For Robotics Learning. Support [Open-X-Embodiment](https://robotics-transformer-x.github.io/), 🤗[HuggingFace](https://huggingface.co/). +🦊 Fog-RT-X: An Efficient and Scalable Data Collection and Management Framework For Robotics Learning. Support [Open-X-Embodiment](https://robotics-transformer-x.github.io/), 🤗[HuggingFace](https://huggingface.co/). -🦊 Fog-X considers both speed 🚀 and memory efficiency 📈 with active metadata and lazily-loaded trajectory data. It supports flexible and distributed dataset partitioning. +🦊 Fog-RT-X considers both speed 🚀 and memory efficiency 📈 with active metadata and lazily-loaded trajectory data. It supports flexible and distributed dataset partitioning. ## Install diff --git a/fog_x/database/polars_connector.py b/fog_x/database/polars_connector.py index 051cd0d..c9bef50 100644 --- a/fog_x/database/polars_connector.py +++ b/fog_x/database/polars_connector.py @@ -139,7 +139,7 @@ def load_tables(self, table_names: List[str]): # load tables from the path for table_name in table_names: - path = self.path.strip("/") + path = self.path.removesuffix("/") path = f"{path}/{table_name}.parquet" logger.info(f"Prepare to load table {table_name} loaded from {path}.") diff --git a/fog_x/dataset.py b/fog_x/dataset.py index eb99de0..1f9f987 100644 --- a/fog_x/dataset.py +++ b/fog_x/dataset.py @@ -100,7 +100,8 @@ def __init__( * is replace_existing actually used anywhere? """ self.name = name - path = os.path.expanduser(path).strip("/") + path = os.path.expanduser(path).removesuffix("/") + logger.info(f"Dataset path: {path}") self.path = path if path is None: raise ValueError("Path is required") @@ -112,7 +113,7 @@ def __init__( self.features = features self.enable_feature_inference = enable_feature_inference if episode_info_connector is None: - episode_info_connector = DataFrameConnector(f"{path}/") + episode_info_connector = DataFrameConnector(f"{path}") if step_data_connector is None: if not os.path.exists(f"{path}/{name}"): @@ -437,6 +438,10 @@ def _prepare_rtx_metadata( feature_name = r["feature"] if "image" in feature_name and "depth" not in feature_name: image = np.load(io.BytesIO(r["value"])) + + # convert from RGB to BGR + image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR) + if feature_name not in video_writers: output_filename = f"{self.name}_{counter}_{feature_name}" diff --git a/requirements.txt b/requirements.txt index c65802b..3293b2f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,4 +11,7 @@ torch tensorflow tensorflow_datasets envlogger -opencv-python \ No newline at end of file +opencv-python +# cloud +boto3 +smart_open \ No newline at end of file