ckyrkou commited on
Commit
c323260
·
verified ·
1 Parent(s): 2cb5dda

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +2 -2
  2. model.py +6 -1
app.py CHANGED
@@ -4,7 +4,7 @@ from PIL import Image
4
  import torch
5
  from torchvision.transforms import ToTensor
6
  from torchvision import transforms
7
-
8
 
9
  # Load the ONNX model
10
  model_path = "./SRnet.pth" # Replace with your model path
@@ -27,7 +27,7 @@ def superresolve(image):
27
 
28
 
29
  # Run inference
30
- output = net(image)
31
 
32
  # Postprocess the output
33
  output = output.permute(0,2,3,1)[0].data.numpy()
 
4
  import torch
5
  from torchvision.transforms import ToTensor
6
  from torchvision import transforms
7
+ from model import pixact
8
 
9
  # Load the ONNX model
10
  model_path = "./SRnet.pth" # Replace with your model path
 
27
 
28
 
29
  # Run inference
30
+ output = pixact(net(image))
31
 
32
  # Postprocess the output
33
  output = output.permute(0,2,3,1)[0].data.numpy()
model.py CHANGED
@@ -3,6 +3,11 @@ import torch.nn as nn
3
  import torch.nn.init as init
4
  import math
5
 
 
 
 
 
 
6
  # class Net(nn.Module):
7
  # def __init__(self, upscale_factor):
8
  # super(Net, self).__init__()
@@ -239,7 +244,7 @@ class Net(nn.Module):
239
  x = self.conv6(x)
240
  x = self.conv7(x)
241
  x = self.conv7_1(x)
242
- x = self.relu(self.conv8(x))
243
  return x
244
 
245
  # def _initialize_weights(self):
 
3
  import torch.nn.init as init
4
  import math
5
 
6
+
7
+ def pixact(x):
8
+ #return (torch.tanh(x) + 1) / 2
9
+ return x.sigmoid()
10
+
11
  # class Net(nn.Module):
12
  # def __init__(self, upscale_factor):
13
  # super(Net, self).__init__()
 
244
  x = self.conv6(x)
245
  x = self.conv7(x)
246
  x = self.conv7_1(x)
247
+ x = self.conv8(x)
248
  return x
249
 
250
  # def _initialize_weights(self):