Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
kamangir committed Feb 19, 2025
1 parent e815b7d commit a27fe06
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@ graph LR

[![pylint](https://github.com/kamangir/roofai/actions/workflows/pylint.yml/badge.svg)](https://github.com/kamangir/roofai/actions/workflows/pylint.yml) [![pytest](https://github.com/kamangir/roofai/actions/workflows/pytest.yml/badge.svg)](https://github.com/kamangir/roofai/actions/workflows/pytest.yml) [![bashtest](https://github.com/kamangir/roofai/actions/workflows/bashtest.yml/badge.svg)](https://github.com/kamangir/roofai/actions/workflows/bashtest.yml) [![PyPI version](https://img.shields.io/pypi/v/roofai.svg)](https://pypi.org/project/roofai/) [![PyPI - Downloads](https://img.shields.io/pypi/dd/roofai)](https://pypistats.org/packages/roofai)

built by 🌀 [`blue_options-4.223.1`](https://github.com/kamangir/awesome-bash-cli), based on 🏛️ [`roofai-6.240.1`](https://github.com/kamangir/roofai).
built by 🌀 [`blue_options-4.223.1`](https://github.com/kamangir/awesome-bash-cli), based on 🏛️ [`roofai-6.241.1`](https://github.com/kamangir/roofai).
2 changes: 1 addition & 1 deletion roofai/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

DESCRIPTION = f"{ICON} everything ai about roofs."

VERSION = "6.240.1"
VERSION = "6.241.1"

MARQUEE = "https://github.com/kamangir/assets/blob/main/2023-10-28-16-28-36-88493-predict.gif?raw=true"

Expand Down
2 changes: 1 addition & 1 deletion roofai/google_maps/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
count=args.count,
)
elif args.task == "predict":
success, _, _ = predict(
success, _, _, _ = predict(
lat=args.lat,
lon=args.lon,
address=args.address,
Expand Down
4 changes: 3 additions & 1 deletion roofai/google_maps/semseg/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __init__(
self.chip_width = DatasetTarget.TORCH.chip_width
self.chip_overlap = chip_overlap

success, self.matrix, _ = get_static_image(
success, self.matrix, metadata = get_static_image(
lat=lat,
lon=lon,
filename=(
Expand All @@ -49,6 +49,8 @@ def __init__(
)
assert success

self.gsd = metadata["gsd"]

self.ids: List[str] = []
for y in range(
self.chip_height_offset,
Expand Down
9 changes: 7 additions & 2 deletions roofai/google_maps/semseg/predict.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import List, Tuple
from typing import List, Tuple, Dict
import segmentation_models_pytorch as smp
import numpy as np
from tqdm import tqdm
Expand Down Expand Up @@ -37,7 +37,7 @@ def predict(
in_notebook: bool = False,
batch_size: int = 32,
verbose: bool = False,
) -> Tuple[bool, np.ndarray, np.ndarray]:
) -> Tuple[bool, np.ndarray, np.ndarray, Dict]:
output_matrix: np.ndarray = np.array(())
input_matrix: np.ndarray = np.array(())

Expand Down Expand Up @@ -189,6 +189,7 @@ def predict(
)
),
f"{chip_count:,} chip(s)",
f"gsd: {dataset.gsd:.2f} m",
],
footer=[fullname()],
dynamic_range=[0, 1.0],
Expand All @@ -208,6 +209,7 @@ def predict(
prediction_object_name,
NAME.replace(".", "-"),
{
"gsd": dataset.gsd,
"lat": lat,
"lon": lon,
"chip_count": chip_count,
Expand All @@ -220,4 +222,7 @@ def predict(
),
output_matrix,
dataset.matrix,
{
"gsd": dataset.gsd,
},
)
3 changes: 2 additions & 1 deletion roofai/tests/test_google_maps_predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_google_maps_predict(
model_object_name = env.ROOFAI_DEFAULT_GOOGLE_MAPS_MODEL
assert objects.download(model_object_name)

success, output_image, input_image = predict(
success, output_image, input_image, metadata = predict(
lat=lat,
lon=lon,
model_object_name=model_object_name,
Expand All @@ -40,3 +40,4 @@ def test_google_maps_predict(
assert success
assert isinstance(output_image, np.ndarray)
assert isinstance(input_image, np.ndarray)
assert "gsd" in metadata

0 comments on commit a27fe06

Please # to comment.