File size: 863 Bytes
99a3901
7c8cf1a
99a3901
 
7c8cf1a
99a3901
 
 
 
 
 
 
 
 
26d106d
 
 
 
 
 
 
99a3901
26d106d
 
8cb5e5a
26d106d
 
8cb5e5a
26d106d
 
 
 
99a3901
26d106d
7c8cf1a
7c04404
7c8cf1a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import torch
import benchmark
import opensr_test
import matplotlib.pyplot as plt
from satlas.utils import load_satlas_sr, run_satlas

# Load the model
model = load_satlas_sr(device="cuda")

# Load the dataset
dataset = opensr_test.load("naip")
lr_dataset, hr_dataset = dataset["L1C"], dataset["HRharm"]

# Predict a image
results = run_satlas(
    model=model,
    lr=lr_dataset[4],
    hr=hr_dataset[4],
    cropsize=32,
    overlap=0
)

# Display the results
fig, ax = plt.subplots(1, 3, figsize=(10, 5))
ax[0].imshow(results["lr"].transpose(1, 2, 0)/3000)
ax[0].set_title("LR")
ax[0].axis("off")
ax[1].imshow(results["sr"].transpose(1, 2, 0)/3000)
ax[1].set_title("SR")
ax[1].axis("off")
ax[2].imshow(results["hr"].transpose(1, 2, 0) / 3000)
ax[2].set_title("HR")
plt.show()

# Run the experiment
benchmark.create_geotiff(model, run_satlas, "all", "satlas/")