KasaHealth / utils /inspect_labels.py
78anand's picture
Upload folder using huggingface_hub
4fcfef4 verified
import numpy as np
import os
base_dir = r"c:\Users\ASUS\lung_ai_project\data"
path1_y = os.path.join(base_dir, "hear_embeddings_optimized", "y_hear_opt_merged.npy")
path2_y = os.path.join(base_dir, "hear_embeddings_coughvid", "y_coughvid.npy")
y1 = np.load(path1_y)
y2 = np.load(path2_y)
print(f"y1 dtype: {y1.dtype}, unique: {np.unique(y1)}")
print(f"y2 dtype: {y2.dtype}, unique: {np.unique(y2)}")
# Convert y1 if string
if y1.dtype.kind in ['U', 'S']:
y1_converted = np.where(y1 == 'sick', 1, 0).astype(np.int32)
print(f"y1 converted dtype: {y1_converted.dtype}, unique: {np.unique(y1_converted)}")
else:
y1_converted = y1.astype(np.int32)
# Convert y2 if string
if y2.dtype.kind in ['U', 'S']:
y2_converted = np.where(y2 == 'sick', 1, 0).astype(np.int32)
print(f"y2 converted dtype: {y2_converted.dtype}, unique: {np.unique(y2_converted)}")
else:
y2_converted = y2.astype(np.int32)
y_merged = np.concatenate([y1_converted, y2_converted])
print(f"y_merged dtype: {y_merged.dtype}, unique: {np.unique(y_merged)}")