镜像自地址
https://github.com/MINT-SJTU/Evo-RL.git
已同步 2026-11-20 18:17:06 +00:00
* feat: add episode boundary frame export script * feat: add boundary frame export hints after recording and in dataset report Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: print scp hint when running in SSH session Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address review findings — deduplicate utils, fix CHW handling, fix --json output - Replace duplicated resolve_dataset_root/load_info/HF_LEROBOT_HOME with imports from existing modules - Replace custom tensor_to_pil_image with torchvision.transforms.functional.to_pil_image - Fix select_camera_key to use names field for CHW/HWC shape disambiguation - Move dataset report tip inside text-only branch to preserve --json output - Move prepare_output_dir after dataset construction to avoid premature deletion - Fix resolve_repo_id to always derive from resolved dataset_root - Remove unnecessary scripts/__init__.py - Fix episode spec display in README.txt for non-contiguous selections - Use episodes.column_names for column containment check Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: shuyuan <shuyuan@shuyuandeMac-mini.local> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
78 行
2.6 KiB
Python
78 行
2.6 KiB
Python
#!/usr/bin/env python
|
|
|
|
# Copyright 2026 The HuggingFace Inc. team. All rights reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
import pytest
|
|
|
|
from lerobot.scripts.lerobot_export_boundary_frames import (
|
|
parse_episode_indices,
|
|
select_camera_key,
|
|
)
|
|
|
|
|
|
def test_parse_episode_indices_supports_ranges_and_deduplicates():
|
|
assert parse_episode_indices("0-2,4,2,6-7", total_episodes=10) == [0, 1, 2, 4, 6, 7]
|
|
|
|
|
|
def test_parse_episode_indices_supports_all_keyword():
|
|
assert parse_episode_indices("all", total_episodes=4) == [0, 1, 2, 3]
|
|
|
|
|
|
def test_parse_episode_indices_rejects_out_of_range_indices():
|
|
with pytest.raises(ValueError, match="out of range"):
|
|
parse_episode_indices("0-5", total_episodes=5)
|
|
|
|
|
|
def test_select_camera_key_prefers_front_camera():
|
|
info = {
|
|
"features": {
|
|
"observation.images.left_wrist": {"dtype": "video", "shape": [480, 640, 3]},
|
|
"observation.images.right_front": {"dtype": "video", "shape": [320, 320, 3]},
|
|
"observation.images.right_wrist": {"dtype": "video", "shape": [720, 1280, 3]},
|
|
}
|
|
}
|
|
|
|
assert select_camera_key(info, None) == "observation.images.right_front"
|
|
|
|
|
|
def test_select_camera_key_falls_back_to_largest_resolution():
|
|
info = {
|
|
"features": {
|
|
"observation.images.left_wrist": {"dtype": "video", "shape": [480, 640, 3]},
|
|
"observation.images.right_wrist": {"dtype": "video", "shape": [720, 1280, 3]},
|
|
}
|
|
}
|
|
|
|
assert select_camera_key(info, None) == "observation.images.right_wrist"
|
|
|
|
|
|
def test_select_camera_key_handles_chw_shape_with_names():
|
|
info = {
|
|
"features": {
|
|
"observation.images.small": {
|
|
"dtype": "image",
|
|
"shape": [3, 240, 320],
|
|
"names": ["channels", "height", "width"],
|
|
},
|
|
"observation.images.large": {
|
|
"dtype": "image",
|
|
"shape": [3, 720, 1280],
|
|
"names": ["channels", "height", "width"],
|
|
},
|
|
}
|
|
}
|
|
|
|
assert select_camera_key(info, None) == "observation.images.large"
|