[visualization] Ignore 2d or 3d data for now (#809)

This commit is contained in:
Mishig 2025-03-04 10:53:01 +01:00 committed by GitHub
parent 3827974b58
commit a27411022d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 58 additions and 40 deletions

View File

@ -158,7 +158,7 @@ def run_server(
if major_version < 2: if major_version < 2:
return "Make sure to convert your LeRobotDataset to v2 & above." return "Make sure to convert your LeRobotDataset to v2 & above."
episode_data_csv_str, columns = get_episode_data(dataset, episode_id) episode_data_csv_str, columns, ignored_columns = get_episode_data(dataset, episode_id)
dataset_info = { dataset_info = {
"repo_id": f"{dataset_namespace}/{dataset_name}", "repo_id": f"{dataset_namespace}/{dataset_name}",
"num_samples": dataset.num_frames "num_samples": dataset.num_frames
@ -218,6 +218,7 @@ def run_server(
videos_info=videos_info, videos_info=videos_info,
episode_data_csv_str=episode_data_csv_str, episode_data_csv_str=episode_data_csv_str,
columns=columns, columns=columns,
ignored_columns=ignored_columns,
) )
app.run(host=host, port=port) app.run(host=host, port=port)
@ -236,6 +237,14 @@ def get_episode_data(dataset: LeRobotDataset | IterableNamespace, episode_index)
selected_columns = [col for col, ft in dataset.features.items() if ft["dtype"] == "float32"] selected_columns = [col for col, ft in dataset.features.items() if ft["dtype"] == "float32"]
selected_columns.remove("timestamp") selected_columns.remove("timestamp")
ignored_columns = []
for column_name in selected_columns:
shape = dataset.features[column_name]["shape"]
shape_dim = len(shape)
if shape_dim > 1:
selected_columns.remove(column_name)
ignored_columns.append(column_name)
# init header of csv with state and action names # init header of csv with state and action names
header = ["timestamp"] header = ["timestamp"]
@ -291,7 +300,7 @@ def get_episode_data(dataset: LeRobotDataset | IterableNamespace, episode_index)
csv_writer.writerows(rows) csv_writer.writerows(rows)
csv_string = csv_buffer.getvalue() csv_string = csv_buffer.getvalue()
return csv_string, columns return csv_string, columns, ignored_columns
def get_episode_video_paths(dataset: LeRobotDataset, ep_index: int) -> list[str]: def get_episode_video_paths(dataset: LeRobotDataset, ep_index: int) -> list[str]:

View File

@ -224,6 +224,7 @@
</p> </p>
</div> </div>
<div>
<table class="text-sm border-collapse border border-slate-700" x-show="currentFrameData"> <table class="text-sm border-collapse border border-slate-700" x-show="currentFrameData">
<thead> <thead>
<tr> <tr>
@ -267,6 +268,14 @@
<div id="labels" class="hidden"> <div id="labels" class="hidden">
</div> </div>
{% if ignored_columns|length > 0 %}
<div class="m-2 text-orange-700 max-w-96">
Columns {{ ignored_columns }} are NOT shown since the visualizer currently does not support 2D or 3D data.
</div>
{% endif %}
</div>
</div> </div>
</div> </div>