geoai-py 0.27.0__py2.py3-none-any.whl → 0.28.0__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- geoai/__init__.py +15 -1
- geoai/extract.py +6 -6
- geoai/hf.py +3 -3
- geoai/moondream.py +2 -2
- geoai/onnx.py +1155 -0
- geoai/prithvi.py +1 -1
- geoai/train.py +1 -1
- geoai/utils.py +547 -0
- {geoai_py-0.27.0.dist-info → geoai_py-0.28.0.dist-info}/METADATA +6 -4
- {geoai_py-0.27.0.dist-info → geoai_py-0.28.0.dist-info}/RECORD +14 -13
- {geoai_py-0.27.0.dist-info → geoai_py-0.28.0.dist-info}/WHEEL +0 -0
- {geoai_py-0.27.0.dist-info → geoai_py-0.28.0.dist-info}/entry_points.txt +0 -0
- {geoai_py-0.27.0.dist-info → geoai_py-0.28.0.dist-info}/licenses/LICENSE +0 -0
- {geoai_py-0.27.0.dist-info → geoai_py-0.28.0.dist-info}/top_level.txt +0 -0
geoai/__init__.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
__author__ = """Qiusheng Wu"""
|
|
4
4
|
__email__ = "giswqs@gmail.com"
|
|
5
|
-
__version__ = "0.
|
|
5
|
+
__version__ = "0.28.0"
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
import os
|
|
@@ -106,6 +106,8 @@ from .utils import (
|
|
|
106
106
|
regularization,
|
|
107
107
|
hybrid_regularization,
|
|
108
108
|
adaptive_regularization,
|
|
109
|
+
flipnslide_augmentation,
|
|
110
|
+
export_flipnslide_tiles,
|
|
109
111
|
)
|
|
110
112
|
|
|
111
113
|
from .timm_train import (
|
|
@@ -170,6 +172,18 @@ except ImportError:
|
|
|
170
172
|
# super_resolution not available (missing dependency)
|
|
171
173
|
pass
|
|
172
174
|
|
|
175
|
+
# ONNX Runtime support
|
|
176
|
+
try:
|
|
177
|
+
from .onnx import (
|
|
178
|
+
ONNXGeoModel,
|
|
179
|
+
export_to_onnx,
|
|
180
|
+
onnx_semantic_segmentation,
|
|
181
|
+
onnx_image_classification,
|
|
182
|
+
)
|
|
183
|
+
except ImportError:
|
|
184
|
+
# ONNX not available (missing dependency)
|
|
185
|
+
pass
|
|
186
|
+
|
|
173
187
|
# Moondream Vision Language Model
|
|
174
188
|
try:
|
|
175
189
|
from .moondream import (
|
geoai/extract.py
CHANGED
|
@@ -1717,21 +1717,21 @@ class ObjectDetector:
|
|
|
1717
1717
|
confidence = None
|
|
1718
1718
|
try:
|
|
1719
1719
|
confidence = row.confidence
|
|
1720
|
-
except:
|
|
1720
|
+
except Exception:
|
|
1721
1721
|
pass
|
|
1722
1722
|
|
|
1723
1723
|
# Method 2: Try dictionary-style access
|
|
1724
1724
|
if confidence is None:
|
|
1725
1725
|
try:
|
|
1726
1726
|
confidence = row["confidence"]
|
|
1727
|
-
except:
|
|
1727
|
+
except Exception:
|
|
1728
1728
|
pass
|
|
1729
1729
|
|
|
1730
1730
|
# Method 3: Try accessing by index from the GeoDataFrame
|
|
1731
1731
|
if confidence is None:
|
|
1732
1732
|
try:
|
|
1733
1733
|
confidence = gdf.iloc[idx]["confidence"]
|
|
1734
|
-
except:
|
|
1734
|
+
except Exception:
|
|
1735
1735
|
pass
|
|
1736
1736
|
|
|
1737
1737
|
if confidence is not None:
|
|
@@ -1879,19 +1879,19 @@ class ObjectDetector:
|
|
|
1879
1879
|
confidence = None
|
|
1880
1880
|
try:
|
|
1881
1881
|
confidence = row.confidence
|
|
1882
|
-
except:
|
|
1882
|
+
except Exception:
|
|
1883
1883
|
pass
|
|
1884
1884
|
|
|
1885
1885
|
if confidence is None:
|
|
1886
1886
|
try:
|
|
1887
1887
|
confidence = row["confidence"]
|
|
1888
|
-
except:
|
|
1888
|
+
except Exception:
|
|
1889
1889
|
pass
|
|
1890
1890
|
|
|
1891
1891
|
if confidence is None:
|
|
1892
1892
|
try:
|
|
1893
1893
|
confidence = visible_gdf.iloc[idx]["confidence"]
|
|
1894
|
-
except:
|
|
1894
|
+
except Exception:
|
|
1895
1895
|
pass
|
|
1896
1896
|
|
|
1897
1897
|
if confidence is not None:
|
geoai/hf.py
CHANGED
|
@@ -343,7 +343,7 @@ def mask_generation(
|
|
|
343
343
|
# Try to convert from tensor or other format if needed
|
|
344
344
|
try:
|
|
345
345
|
mask_data = np.array(mask_data)
|
|
346
|
-
except:
|
|
346
|
+
except Exception:
|
|
347
347
|
print(f"Could not convert mask at index {i} to numpy array")
|
|
348
348
|
continue
|
|
349
349
|
|
|
@@ -395,7 +395,7 @@ def mask_generation(
|
|
|
395
395
|
try:
|
|
396
396
|
mask_data = np.array(mask_result)
|
|
397
397
|
score = 1.0 # Default score
|
|
398
|
-
except:
|
|
398
|
+
except Exception:
|
|
399
399
|
print(f"Could not process mask at index {i}")
|
|
400
400
|
continue
|
|
401
401
|
|
|
@@ -404,7 +404,7 @@ def mask_generation(
|
|
|
404
404
|
if not isinstance(mask_data, np.ndarray):
|
|
405
405
|
try:
|
|
406
406
|
mask_data = np.array(mask_data)
|
|
407
|
-
except:
|
|
407
|
+
except Exception:
|
|
408
408
|
print(f"Could not convert mask at index {i} to numpy array")
|
|
409
409
|
continue
|
|
410
410
|
|
geoai/moondream.py
CHANGED
|
@@ -1305,7 +1305,7 @@ class MoondreamGeo:
|
|
|
1305
1305
|
try:
|
|
1306
1306
|
summary_result = self.model.query(question=summary_prompt)
|
|
1307
1307
|
combined_answer = summary_result.get("answer", "")
|
|
1308
|
-
except:
|
|
1308
|
+
except Exception:
|
|
1309
1309
|
# Fall back to concatenation if summarization fails
|
|
1310
1310
|
combined_answer = " ".join([ta["answer"] for ta in tile_answers])
|
|
1311
1311
|
else:
|
|
@@ -1411,7 +1411,7 @@ class MoondreamGeo:
|
|
|
1411
1411
|
try:
|
|
1412
1412
|
summary_result = self.model.query(question=summary_prompt)
|
|
1413
1413
|
combined_caption = summary_result.get("answer", "")
|
|
1414
|
-
except:
|
|
1414
|
+
except Exception:
|
|
1415
1415
|
# Fall back to concatenation if summarization fails
|
|
1416
1416
|
combined_caption = " ".join([tc["caption"] for tc in tile_captions])
|
|
1417
1417
|
else:
|