Create example.py
Browse files- example.py +17 -0
example.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# example.py
|
| 2 |
+
import torch
|
| 3 |
+
from model import MeteoGAN # Import your model class
|
| 4 |
+
|
| 5 |
+
# Load the pre-trained model
|
| 6 |
+
model = MeteoGAN(in_channels=3, out_channels=3, upscale=4)
|
| 7 |
+
model.load_state_dict(torch.load("best_netG.pth")) # Load model weights
|
| 8 |
+
|
| 9 |
+
# Create a random input tensor (e.g., for testing purposes)
|
| 10 |
+
input_tensor = torch.rand(1, 3, 128, 128) # Batch size 1, 3 channels, 128x128 image
|
| 11 |
+
|
| 12 |
+
# Perform inference
|
| 13 |
+
output_tensor = model(input_tensor)
|
| 14 |
+
|
| 15 |
+
# Print input and output shapes
|
| 16 |
+
print("Input shape:", input_tensor.shape)
|
| 17 |
+
print("Output shape:", output_tensor.shape)
|