114514
Browse files
app.py
CHANGED
|
@@ -26,9 +26,7 @@ net_i.eval().to('cuda')
|
|
| 26 |
net_c.eval().to('cuda')
|
| 27 |
|
| 28 |
def align(x1):
|
| 29 |
-
|
| 30 |
-
h, w = h // 32 * 32, w // 32 * 32
|
| 31 |
-
x1 = torch.nn.functional.interpolate(x1, size=(h, w), mode='bilinear')
|
| 32 |
return x1
|
| 33 |
|
| 34 |
|
|
@@ -37,7 +35,9 @@ def align(x1):
|
|
| 37 |
def predict(img):
|
| 38 |
with torch.no_grad():
|
| 39 |
image_tensor = torch.from_numpy(img).permute(2, 0, 1).float().unsqueeze(0)
|
| 40 |
-
|
|
|
|
|
|
|
| 41 |
ipt=net_c(image_tensor)
|
| 42 |
image_tensor = image_tensor.half()
|
| 43 |
ipt = ipt.half()
|
|
|
|
| 26 |
net_c.eval().to('cuda')
|
| 27 |
|
| 28 |
def align(x1):
|
| 29 |
+
|
|
|
|
|
|
|
| 30 |
return x1
|
| 31 |
|
| 32 |
|
|
|
|
| 35 |
def predict(img):
|
| 36 |
with torch.no_grad():
|
| 37 |
image_tensor = torch.from_numpy(img).permute(2, 0, 1).float().unsqueeze(0)
|
| 38 |
+
h, w = image_tensor.shape[-2], image_tensor.shape[-1]
|
| 39 |
+
h, w = h // 32 * 32, w // 32 * 32
|
| 40 |
+
image_tensor = torch.nn.functional.interpolate(image_tensor, size=(h, w), mode='bilinear')
|
| 41 |
ipt=net_c(image_tensor)
|
| 42 |
image_tensor = image_tensor.half()
|
| 43 |
ipt = ipt.half()
|