| import h5py | |
| import numpy as np | |
| import os | |
| def check_data_quality(h5_path): | |
| if not os.path.exists(h5_path): | |
| print(f"File not found: {h5_path}") | |
| return | |
| print(f"Analyzing {h5_path}...") | |
| with h5py.File(h5_path, 'r') as f: | |
| gt_l = f['left_gaze'][:] | |
| gt_r = f['right_gaze'][:] | |
| gt = (gt_l + gt_r) / 2 | |
| gt_deg = gt * (180.0 / np.pi) | |
| pitch = gt_deg[:, 0] | |
| yaw = gt_deg[:, 1] | |
| total = len(pitch) | |
| extreme_pitch = np.sum(np.abs(pitch) > 60) | |
| extreme_yaw = np.sum(np.abs(yaw) > 60) | |
| print(f"Total samples: {total}") | |
| print(f"Pitch range: [{pitch.min():.2f}, {pitch.max():.2f}]") | |
| print(f"Yaw range: [{yaw.min():.2f}, {yaw.max():.2f}]") | |
| print(f"Extreme Pitch (>60 deg): {extreme_pitch}") | |
| print(f"Extreme Yaw (>60 deg): {extreme_yaw}") | |
| # Check for NaNs | |
| nan_count = np.isnan(pitch).sum() + np.isnan(yaw).sum() | |
| print(f"NaN count: {nan_count}") | |
| if __name__ == "__main__": | |
| check_data_quality('data/processed/p08_v16_new.h5') | |