Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
use kornia io to load images
Browse files
app.py
CHANGED
|
@@ -5,9 +5,12 @@ from kornia.contrib import ImageStitcher
|
|
| 5 |
import kornia.feature as KF
|
| 6 |
import torch
|
| 7 |
|
| 8 |
-
def inference(file_1, file_2):
|
| 9 |
-
img_1 = K.
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
| 11 |
IS = ImageStitcher(KF.LoFTR(pretrained='outdoor'), estimator='ransac')
|
| 12 |
with torch.no_grad():
|
| 13 |
result = IS(img_1, img_2)
|
|
|
|
| 5 |
import kornia.feature as KF
|
| 6 |
import torch
|
| 7 |
|
| 8 |
+
def inference(file_1, file_2):
|
| 9 |
+
img_1: Tensor = K.io.load_image(file_1, K.io.ImageLoadType.RGB32)
|
| 10 |
+
img_1 = img_1[None] # 1xCxHxW / fp32 / [0, 1]
|
| 11 |
+
img_2: Tensor = K.io.load_image(file_2, K.io.ImageLoadType.RGB32)
|
| 12 |
+
img_2 = img_1[None] # 1xCxHxW / fp32 / [0, 1]
|
| 13 |
+
|
| 14 |
IS = ImageStitcher(KF.LoFTR(pretrained='outdoor'), estimator='ransac')
|
| 15 |
with torch.no_grad():
|
| 16 |
result = IS(img_1, img_2)
|