Safetensors
mhassanch commited on
Commit
97ffcc6
·
1 Parent(s): c6c1400

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.

Files changed (1) hide show
  1. infer.py +1 -1
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).filled(np.nan).astype(np.float32)
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),