edgarriba commited on
Commit
20d1027
1 Parent(s): e9d0a8b

use kornia io to load images

Browse files
Files changed (1) hide show
  1. app.py +6 -3
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.image_to_tensor(io.imread(file_1), False).float() / 255.
10
- img_2 = K.image_to_tensor(io.imread(file_2), False).float() / 255.
 
 
 
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)