Datasets:
Download code/evaluation-code/v0.2-0c2690ae/embodied_pipeline/rendering/sampling.py from VEHwang/cocogni4d: direct link, hf CLI and curl.
- Browser
- Download file 1.31 kB
-
https://huggingface.co/datasets/VEHwang/cocogni4d/resolve/main/code/evaluation-code/v0.2-0c2690ae/embodied_pipeline/rendering/sampling.py
- Command line
-
hf download hf://datasets/VEHwang/cocogni4d/code/evaluation-code/v0.2-0c2690ae/embodied_pipeline/rendering/sampling.py
-
curl -L -o sampling.py https://huggingface.co/datasets/VEHwang/cocogni4d/resolve/main/code/evaluation-code/v0.2-0c2690ae/embodied_pipeline/rendering/sampling.py
1.31 kB
| """Deterministic audit indices; decoding and frame-clock validation remain complete.""" | |
| from ..artifacts import ContractError | |
| def audit_indices(frame_count,policy): | |
| if type(frame_count) is not int or frame_count<=0: | |
| raise ContractError('Positive recording frame count required') | |
| if policy['mode']=='full':return tuple(range(frame_count)) | |
| if policy['mode']!='sampled':raise ContractError('Unknown RGB audit mode') | |
| return tuple(sorted(set(range(0,frame_count,policy['every_n_frames']))|{0,frame_count-1})) | |
| def ground_indices(keys,policy,plan_times): | |
| """Local frame cadence plus exact recorded plan ticks; never choose nearest. | |
| Missing plan samples are retained as explicit non-comparability metadata. | |
| """ | |
| selected={key.frame_index for key in keys if key.frame_index%policy['every_n_frames']==0} | |
| by_time={key.world_s:key.frame_index for key in keys};missing=[];extra=[] | |
| for t in plan_times: | |
| if float(t) not in by_time:missing.append(float(t));continue | |
| index=by_time[float(t)] | |
| if index not in selected:extra.append(index) | |
| selected.add(index) | |
| return tuple(sorted(selected)),dict(extra_plan_frame_indices=sorted(set(extra)),missing_plan_times_s=missing, | |
| rule=policy['rule'],every_n_frames=policy['every_n_frames']) | |