diff --git a/README.md b/README.md index f799a02..ebd48d6 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,8 @@ python model_test.py -t landsatMA python model_test.py -t viirs ``` +*Note: For a beginner-friendly, end-to-end evaluation script, check out the [examples/](./examples/) folder.* + --- ## 📖 Citation diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 0000000..e2415a0 --- /dev/null +++ b/examples/README.md @@ -0,0 +1,10 @@ +# Evaluation Example + +This folder contains a minimal, end-to-end example to reproduce evaluation metrics on TIRAuxCloud pretrained models. + +## Usage +1. Download the dataset and model weights from the TIRAuxCloud Hugging Face dataset page. +2. Populate the correct paths in `example_saved_model_run.json`. +3. Run the evaluation: + ```bash + python examples/run_example_evaluation.py --subset landsat \ No newline at end of file diff --git a/examples/example_saved_model_run.json b/examples/example_saved_model_run.json new file mode 100644 index 0000000..09e307a --- /dev/null +++ b/examples/example_saved_model_run.json @@ -0,0 +1,10 @@ +{ + "landsat": { + "dataset_dir": "./data/landsat_samples", + "dataset_folder": "./data/landsat_csvs", + "device": "cuda", + "cpuworkers": 4, + "batch_size": 8, + "model_path": "./models/pretrained_landsat.pth" + } +} \ No newline at end of file diff --git a/examples/run_example_evaluation.py b/examples/run_example_evaluation.py new file mode 100644 index 0000000..1215ca6 --- /dev/null +++ b/examples/run_example_evaluation.py @@ -0,0 +1,35 @@ +import argparse +import json +import os +import subprocess +from pathlib import Path + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("--subset", type=str, default="landsat", + choices=["landsat", "landsatMA", "viirs"]) + parser.add_argument("--config", type=str, + default="examples/example_saved_model_run.json") + args = parser.parse_args() + + config_path = Path(args.config) + if not config_path.exists(): + raise FileNotFoundError(f"Config file not found: {config_path}") + + with open(config_path) as f: + cfg = json.load(f)[args.subset] + + dataset_dir = Path(cfg["dataset_dir"]) + dataset_folder = Path(cfg["dataset_folder"]) + + if not dataset_dir.exists(): + raise FileNotFoundError(f"dataset_dir does not exist: {dataset_dir}") + if not dataset_folder.exists(): + raise FileNotFoundError(f"dataset_folder does not exist: {dataset_folder}") + + # Call existing script + cmd = ["python", "model_test.py", "-t", args.subset] + subprocess.run(cmd, check=True) + +if __name__ == "__main__": + main() \ No newline at end of file