Each script should be executed in the following order:

───────────────────────────────────────────────
STEP 01 — Extract Features (ResNet50)
───────────────────────────────────────────────
• Role: Extract avg-pooled feature vectors from selected ResNet50 layers.
• Input: Image folder (e.g., ImageNet validation set)
• Output: Per-layer feature .pkl file (e.g., layer4_2_avgpool.pkl)

───────────────────────────────────────────────
STEP 02 — Activated Neuron Detection (Thresholding)
───────────────────────────────────────────────
• Role: For each feature vector, identify neurons where value > mean + k*std.
• Input: Feature file from Step 1 (.pkl or .npy)
• Output: .npy file with per-image activated neuron indices (dtype=object)

───────────────────────────────────────────────
STEP 03 — FINCH Clustering
───────────────────────────────────────────────
• Role: Perform clustering on features using FINCH and save cluster labels.
• Input: Feature file from Step 1
• Output: CSVs with cluster assignments (per level)

───────────────────────────────────────────────
STEP 04 — Cluster Filtering (Metrics & Valid Set)
───────────────────────────────────────────────
• Role: Compute cluster quality metrics (cohesion, purity, Rᵢ) and filter valid clusters.
• Input: Feature file + cluster CSVs
• Output: Cluster metrics CSV + good_clusters_{level}.txt

───────────────────────────────────────────────
STEP 05 — Aggregate Neuron Sets by Cluster
───────────────────────────────────────────────
• Role: For each valid cluster, aggregate commonly activated neurons across images and layers.
• Input: FINCH CSVs + good_clusters.txt + per-image neuron index files (.npy from Step 2)
• Output: Per-cluster CSV showing selected neurons per layer

───────────────────────────────────────────────
Execution Summary:
───────────────────────────────────────────────
step01_extract_features.py  
step02_activated_neurons.py  
step03_finch_clustering.py  
step04_cluster_filtering.py  
step05_aggregate_neuron_sets.py  

Notes:
• Paths are standardized as path/to/... or outputs/... → change to your setup.
• Layer dimensions: layer1=256, layer2=512, layer3=1024, layer4=2048
• FINCH clustering requires `finchpy` or a local `finch.py` with a FINCH() function.
