-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add inference segmentation test files
- Loading branch information
valhassan
committed
May 15, 2024
1 parent
fd5dfe8
commit e7d610e
Showing
4 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
tests/data/inference/test.tif |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import os | ||
from pathlib import Path | ||
from omegaconf import DictConfig | ||
from inference_segmentation import main as run_inference | ||
|
||
def test_inference_segmentation(): | ||
"""Test inference segmentation""" | ||
working_folder = "tests/data/inference" | ||
model_path = "tests/data/inference/test_model.pt" | ||
raw_data_csv = "tests/data/inference/test.csv" | ||
data_dir = "tests/data/inference" | ||
bands_requested = [1, 2, 3] | ||
output_mask = Path("tests/data/inference/test_mask.tif") | ||
|
||
cfg = {"general": {"project_name": "inference_segmentation_test"}, | ||
"dataset": {"bands": bands_requested, | ||
"raw_data_dir": data_dir,}, | ||
"inference": {"model_path": model_path, | ||
"raw_data_csv": raw_data_csv, | ||
"root_dir":working_folder}, | ||
"tiling": {"clahe_clip_limit": 0},} | ||
|
||
cfg = DictConfig(cfg) | ||
run_inference(cfg) | ||
assert output_mask.exists() | ||
os.remove(output_mask) | ||
|