rockglacierNET / datacollection /run_pipeline.py
kabiriitb's picture
Upload folder using huggingface_hub
80e070e verified
Raw History Blame Contribute Delete
1.68 kB
import os
import subprocess
import yaml
def load_config():
config_path = os.path.join(os.path.dirname(__file__), 'config.yaml')
with open(config_path, 'r') as f:
return yaml.safe_load(f)
def run_script(script_name):
script_path = os.path.join(os.path.dirname(__file__), script_name)
print(f"\n{'='*50}")
print(f"Running {script_name}...")
print(f"{'='*50}")
result = subprocess.run(["python", script_path], text=True)
if result.returncode != 0:
print(f"Error running {script_name}. Aborting pipeline.")
exit(1)
def main():
config = load_config()
print("Starting Data Collection Pipeline")
print(f"Padding: {config['preprocessing']['padding_m']}m (variable-sized outputs)")
print(f"Background image ratio: {config['preprocessing']['background_ratio'] * 100}%")
print(f"Patch size: {config['patching']['patch_size']}x{config['patching']['patch_size']}")
print(f"Stride: {config['patching']['stride']}")
print(f"Min glacier %: {config['patching']['minimum_glacier_percentage']}%")
# Step 1: Separate polygons from shapefile
run_script("separate_polygons.py")
# Step 2: Generate masks (variable-sized + pure background)
run_script("generate_masks.py")
# Step 3: Download 12-band features from Google Earth Engine
run_script("gee_feature_extraction.py")
# Step 4: Split into train/val/test
run_script("split_dataset.py")
# Step 5: Extract 128x128 patches
run_script("extract_patches.py")
print("\n" + "="*50)
print("Data collection pipeline completed successfully!")
print("="*50)
if __name__ == '__main__':
main()