mischeiwiller commited on
Commit
307c14f
1 Parent(s): 50ba528

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -6,11 +6,12 @@ import kornia.feature as KF
6
  import torch
7
  import numpy as np
8
 
9
- def inference(file_1, file_2):
10
- img_1: Tensor = K.io.load_image(file_1, K.io.ImageLoadType.RGB32)
11
- img_1 = img_1[None] # 1xCxHxW / fp32 / [0, 1]
12
- img_2: Tensor = K.io.load_image(file_2, K.io.ImageLoadType.RGB32)
13
- img_2 = img_2[None] # 1xCxHxW / fp32 / [0, 1]
 
14
 
15
  IS = ImageStitcher(KF.LoFTR(pretrained='outdoor'), estimator='ransac')
16
  with torch.no_grad():
 
6
  import torch
7
  import numpy as np
8
 
9
+ def inference(img_1, img_2):
10
+ # Convert numpy arrays to Tensors
11
+ img_1: Tensor = K.image_to_tensor(img_1, keepdim=False).float() / 255.0
12
+ img_1 = img_1.unsqueeze(0) # Add batch dimension
13
+ img_2: Tensor = K.image_to_tensor(img_2, keepdim=False).float() / 255.0
14
+ img_2 = img_2.unsqueeze(0) # Add batch dimension
15
 
16
  IS = ImageStitcher(KF.LoFTR(pretrained='outdoor'), estimator='ransac')
17
  with torch.no_grad():