Fix RGB data handling in fetch_rgb_geotiff function
Browse files- Adjusted the order of method calls to ensure NaN values are filled after converting the dataset to float32.
- This change improves the robustness of RGB imagery processing in the inference pipeline.
infer.py
CHANGED
|
@@ -97,7 +97,7 @@ def fetch_rgb_geotiff(url: str) -> tuple[Image.Image, dict[str, Any]]:
|
|
| 97 |
raise ValueError(
|
| 98 |
f"GeoText requires RGB imagery; input has {dataset.count} band(s)."
|
| 99 |
)
|
| 100 |
-
rgb = dataset.read([1, 2, 3], masked=True).
|
| 101 |
metadata = {
|
| 102 |
"crs": str(dataset.crs),
|
| 103 |
"bounds": list(dataset.bounds),
|
|
|
|
| 97 |
raise ValueError(
|
| 98 |
f"GeoText requires RGB imagery; input has {dataset.count} band(s)."
|
| 99 |
)
|
| 100 |
+
rgb = dataset.read([1, 2, 3], masked=True).astype(np.float32).filled(np.nan)
|
| 101 |
metadata = {
|
| 102 |
"crs": str(dataset.crs),
|
| 103 |
"bounds": list(dataset.bounds),
|