import pandas as pd import warnings warnings.filterwarnings('ignore') csv_path = "/data1/nasiruddink/rockglacier/RockGlacierNet/patch_dataset/patches_128/metadata/patch_metadata.csv" df = pd.read_csv(csv_path) # Filter for only the patches that are currently kept in the dataset kept = df[df["kept_or_filtered"] == "kept"].copy() # Define finer bins for analysis bins = [-1, 0.0, 0.1, 1.0, 2.0, 5.0, 10.0, 100.0] labels = [ "0% (Pure Background)", "0.01% - 0.1% (Trace)", "0.1% - 1.0%", "1.0% - 2.0%", "2.0% - 5.0%", "5.0% - 10.0%", "> 10.0% (Good Coverage)" ] kept['coverage_bin'] = pd.cut(kept['glacier_percentage'], bins=bins, labels=labels) counts = kept['coverage_bin'].value_counts(sort=False) percentages = (counts / len(kept)) * 100 print("\nROCK GLACIER COVERAGE ANALYSIS OF KEPT PATCHES:") print("=" * 65) print(f"{'Coverage Range':<25} | {'Count':<10} | {'Percentage of Dataset':<20}") print("-" * 65) for label in labels: print(f"{label:<25} | {counts[label]:<10} | {percentages[label]:.1f}%") print("=" * 65) print(f"Total Kept Patches: {len(kept)}\n") # Suggest what happens if we set a threshold threshold = 1.0 retained = len(kept[kept['glacier_percentage'] >= threshold]) + len(kept[kept['glacier_percentage'] == 0.0]) print(f"If you set MIN_GLACIER_PERCENTAGE = {threshold}% in config.py:") print(f"- You would drop {(len(kept) - retained)} patches with trace/negligible glacier pixels.") print(f"- The new dataset size would be {retained} patches.")