File size: 1,107 Bytes
a10ba7f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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')