import pandas as pd
from PIL import Image
import os

# Essential load script for PopEYE_2022
def load_sample(relpath, root_dir="."):
    """Load an image and its label from the dataset."""
    img_path = os.path.join(root_dir, relpath)
    return Image.open(img_path)

if __name__ == "__main__":
    df = pd.read_csv("labels.csv")
    print(f"Dataset loaded: {len(df)} samples.")
    # Example: display the first image
    img = load_sample(df.iloc[0]['relpath'])
    img.show()