Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with binary scripted model #34

Merged
merged 3 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.0
3.1.0
2 changes: 1 addition & 1 deletion geo_inference/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Geo-inference: Extract features from high-resolution geospatial imagery using foundation models"""

__author__ = "Victor Alhassan"
__version__ = "3.0.0"
__version__ = "3.1.0"
1 change: 0 additions & 1 deletion geo_inference/geo_dask.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@ def sum_overlapped_chunks(
where=full_array[-1, :, :] != 0,
)
if final_result.shape[0] == 1:
final_result = expit(final_result)
final_result = (
np.where(final_result > prediction_threshold, 1, 0).squeeze(0).astype(np.uint8)
)
Expand Down
4 changes: 2 additions & 2 deletions geo_inference/geo_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,12 +261,12 @@ async def async_run_inference(self,
):
if self.json is None:
aoi_dask_array = xr.concat(
[aoi_dask_array[i - 1, :, :] for i in bands_requested],
[aoi_dask_array[int(i) - 1, :, :] for i in bands_requested],
dim="band"
)
else:
aoi_dask_array = da.stack(
[aoi_dask_array[i - 1, :, :] for i in bands_requested],
[aoi_dask_array[int(i) - 1, :, :] for i in bands_requested],
axis =0,
)
except Exception as e:
Expand Down
6 changes: 3 additions & 3 deletions geo_inference/utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,8 @@ def cmd_interface(argv=None):
parser.add_argument(
"-br",
"--bands_requested",
nargs=1,
help="bands_requested in this format['Red','Green','Blue'] or [1,2,3]",
nargs="*",
help="bands_requested in this format '-b Red Green Blue' or '-br 1 2 3'",
)

parser.add_argument(
Expand Down Expand Up @@ -512,7 +512,7 @@ def cmd_interface(argv=None):
model = args.model[0] if args.model else None
bbox = args.bbox[0] if args.bbox else None
work_dir = args.work_dir[0] if args.work_dir else None
bands_requested = args.bands_requested[0] if args.bands_requested else []
bands_requested = args.bands_requested if args.bands_requested else []
workers = args.workers[0] if args.workers else 0
vec = args.vec[0] if args.vec else False
yolo = args.yolo[0] if args.yolo else False
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ geo_inference = "geo_inference.geo_inference:main"
include = ["geo_inference*"]

[tool.bumpver]
current_version = "3.0.0"
current_version = "3.1.0"
version_pattern = "MAJOR.MINOR.PATCH"
commit_message = "bump version {old_version} -> {new_version}"
commit = true
Expand Down
4 changes: 2 additions & 2 deletions tests/utils/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,14 @@ def test_cmd_interface_with_args(monkeypatch, test_data_dir):

def test_cmd_interface_with_image(monkeypatch):
# Mock the command line arguments
monkeypatch.setattr('sys.argv', ['prog', '-i', 'image.tif'])
monkeypatch.setattr('sys.argv', ['prog', '-i', 'image.tif', '-br', '1', '2', '3'])
# Call the function
result = cmd_interface()
# Assert the result
assert result == {
"image": "image.tif",
"bbox": None,
"bands_requested" : [],
"bands_requested" : ['1', '2', '3'],
"workers": 0,
"model": None,
"work_dir": None,
Expand Down
Loading