Datasets:
Download code/evaluation-code/v0.2-0c2690ae/embodied_pipeline/rendering/quality.py from VEHwang/cocogni4d: direct link, hf CLI and curl.
- Browser
- Download file 974 Bytes
-
https://huggingface.co/datasets/VEHwang/cocogni4d/resolve/main/code/evaluation-code/v0.2-0c2690ae/embodied_pipeline/rendering/quality.py
- Command line
-
hf download hf://datasets/VEHwang/cocogni4d/code/evaluation-code/v0.2-0c2690ae/embodied_pipeline/rendering/quality.py
-
curl -L -o quality.py https://huggingface.co/datasets/VEHwang/cocogni4d/resolve/main/code/evaluation-code/v0.2-0c2690ae/embodied_pipeline/rendering/quality.py
974 Bytes
| """Image raw statistics. Threshold profiles and content acceptance belong to consumers.""" | |
| import numpy as np | |
| def image_statistics(rgb,depth,previous): | |
| valid=np.isfinite(depth)&(depth>0);h,w=depth.shape | |
| center=depth[h//3:2*h//3,w//3:2*w//3];cv=np.isfinite(center)&(center>0) | |
| luma=rgb.astype(np.float32)@np.array([.2126,.7152,.0722],np.float32) | |
| if previous is not None: | |
| difference=np.subtract(rgb,previous,dtype=np.int16) | |
| np.abs(difference,out=difference) | |
| mad=float(difference.mean()) | |
| else:mad=np.nan | |
| return dict(luma_mean=float(luma.mean()),luma_std=float(luma.std()), | |
| previous_frame_mad=mad, | |
| invalid_depth_fraction=float(1-valid.mean()),min_valid_depth_m=float(depth[valid].min()) if valid.any() else np.nan, | |
| center_depth_median_m=float(np.median(center[cv])) if cv.any() else np.nan, | |
| **{'near_fraction_'+str(d).replace('.','_')+'m':float((valid&(depth<d)).mean()) for d in (.3,.5,1.,1.5)}) | |