lerobot_utils
DepthVideoReader
Bases: VideoReader
Adapted from torchvision.io.VideoReader to support gray16le decoding for depth
Source code in OmniGibson/omnigibson/learning/utils/lerobot_utils.py
__next__()
Decodes and returns the next frame of the current stream. Frames are encoded as a dict with mandatory data and pts fields, where data is a tensor, and pts is a presentation timestamp of the frame expressed in seconds as a float.
Returns:
| Type | Description |
|---|---|
dict
|
a dictionary and containing decoded frame ( |
Dict[str, Any]
|
and corresponding timestamp ( |
Source code in OmniGibson/omnigibson/learning/utils/lerobot_utils.py
aggregate_feature_stats(stats_ft_list)
Aggregates stats for a single feature.
Source code in OmniGibson/omnigibson/learning/utils/lerobot_utils.py
aggregate_stats(stats_list)
Aggregate stats from multiple compute_stats outputs into a single set of stats.
The final stats will have the union of all data keys from each of the stats dicts.
For instance: - new_min = min(min_dataset_0, min_dataset_1, ...) - new_max = max(max_dataset_0, max_dataset_1, ...) - new_mean = (mean of all data, weighted by counts) - new_std = (std of all data)
Source code in OmniGibson/omnigibson/learning/utils/lerobot_utils.py
decode_video_frames_torchvision(video_path, timestamps, tolerance_s, log_loaded_timestamps=False, backend=None)
Adapted from decode_video_frames_vision to handle depth decoding
Source code in OmniGibson/omnigibson/learning/utils/lerobot_utils.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | |
hf_transform_to_torch(items_dict)
Adapted from lerobot.datasets.utils.hf_transform_to_torch Preserve float64 for timestamp to avoid precision issues Below is the original docstring: Get a transform function that convert items from Hugging Face dataset (pyarrow) to torch tensors. Importantly, images are converted from PIL, which corresponds to a channel last representation (h w c) of uint8 type, to a torch image representation with channel first (c h w) of float32 type in range [0,1].