Upload 2 files
Browse files- satlas/run.py +2 -2
- satlas/utils.py +4 -3
satlas/run.py
CHANGED
|
@@ -21,10 +21,10 @@ results = run_satlas(
|
|
| 21 |
|
| 22 |
# Display the results
|
| 23 |
fig, ax = plt.subplots(1, 3, figsize=(10, 5))
|
| 24 |
-
ax[0].imshow(results["lr"].transpose(1, 2, 0)/
|
| 25 |
ax[0].set_title("LR")
|
| 26 |
ax[0].axis("off")
|
| 27 |
-
ax[1].imshow(results["sr"].transpose(1, 2, 0)/
|
| 28 |
ax[1].set_title("SR")
|
| 29 |
ax[1].axis("off")
|
| 30 |
ax[2].imshow(results["hr"].transpose(1, 2, 0) / 3000)
|
|
|
|
| 21 |
|
| 22 |
# Display the results
|
| 23 |
fig, ax = plt.subplots(1, 3, figsize=(10, 5))
|
| 24 |
+
ax[0].imshow(results["lr"].transpose(1, 2, 0)/3000)
|
| 25 |
ax[0].set_title("LR")
|
| 26 |
ax[0].axis("off")
|
| 27 |
+
ax[1].imshow(results["sr"].transpose(1, 2, 0)/3000)
|
| 28 |
ax[1].set_title("SR")
|
| 29 |
ax[1].axis("off")
|
| 30 |
ax[2].imshow(results["hr"].transpose(1, 2, 0) / 3000)
|
satlas/utils.py
CHANGED
|
@@ -40,7 +40,7 @@ def run_satlas(
|
|
| 40 |
overlap: int = 0,
|
| 41 |
device: Union[str, torch.device] = "cuda"
|
| 42 |
) -> torch.Tensor:
|
| 43 |
-
# Load the LR image
|
| 44 |
lr = torch.from_numpy(lr[[3, 2, 1]]/3558).float().to(device).clamp(0, 1)
|
| 45 |
|
| 46 |
# Select the raster with the lowest resolution
|
|
@@ -85,9 +85,10 @@ def run_satlas(
|
|
| 85 |
|
| 86 |
# Save the result
|
| 87 |
results = {
|
| 88 |
-
"lr": (lr.cpu().numpy() *
|
| 89 |
-
"sr": (sr.cpu().numpy() *
|
| 90 |
"hr": hr[0:3]
|
| 91 |
}
|
|
|
|
| 92 |
|
| 93 |
return results
|
|
|
|
| 40 |
overlap: int = 0,
|
| 41 |
device: Union[str, torch.device] = "cuda"
|
| 42 |
) -> torch.Tensor:
|
| 43 |
+
# Load the LR image
|
| 44 |
lr = torch.from_numpy(lr[[3, 2, 1]]/3558).float().to(device).clamp(0, 1)
|
| 45 |
|
| 46 |
# Select the raster with the lowest resolution
|
|
|
|
| 85 |
|
| 86 |
# Save the result
|
| 87 |
results = {
|
| 88 |
+
"lr": (lr.cpu().numpy() * 3558).astype(np.uint16),
|
| 89 |
+
"sr": (sr.cpu().numpy() * 3558).astype(np.uint16),
|
| 90 |
"hr": hr[0:3]
|
| 91 |
}
|
| 92 |
+
|
| 93 |
|
| 94 |
return results
|