mirror of
https://github.com/huggingface/lerobot.git
synced 2026-07-23 17:56:07 +00:00
feat(leagcy metadata): adding automatic metadata update for legacy 'video.is_depth_map' feature
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
import contextlib
|
import contextlib
|
||||||
|
import logging
|
||||||
from collections.abc import Callable, Iterable
|
from collections.abc import Callable, Iterable
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@@ -634,7 +635,14 @@ class LeRobotDatasetMetadata:
|
|||||||
new_info = get_video_info(video_path, video_encoder=video_encoder)
|
new_info = get_video_info(video_path, video_encoder=video_encoder)
|
||||||
# Drop preserved keys so the existing values win on merge.
|
# Drop preserved keys so the existing values win on merge.
|
||||||
new_info = {k: v for k, v in new_info.items() if k not in preserve_set}
|
new_info = {k: v for k, v in new_info.items() if k not in preserve_set}
|
||||||
self.info.features[key]["info"] = {**existing, **new_info}
|
merged = {**existing, **new_info}
|
||||||
|
# Migrate the legacy depth marker to the canonical key.
|
||||||
|
if "video.is_depth_map" in merged:
|
||||||
|
logging.warning(
|
||||||
|
f"Migrating legacy 'video.is_depth_map' to 'is_depth_map' for feature {key!r}."
|
||||||
|
)
|
||||||
|
merged.setdefault("is_depth_map", merged.pop("video.is_depth_map"))
|
||||||
|
self.info.features[key]["info"] = merged
|
||||||
|
|
||||||
def update_chunk_settings(
|
def update_chunk_settings(
|
||||||
self,
|
self,
|
||||||
|
|||||||
Reference in New Issue
Block a user