Skip to content

Commit aaf3abe

Browse files
Fix match_two
1 parent b82dfe8 commit aaf3abe

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ This will create three output files in the folder specified by `result_save_fold
116116
python match_two.py \
117117
--config_path patchnetvlad/configs/performance.ini \
118118
--first_im_path=patchnetvlad/example_images/tokyo_query.jpg \
119-
--second_im_path=patchnetvlad/example_images/tokyo_db_patch_success.png
119+
--second_im_path=patchnetvlad/example_images/tokyo_db.png
120120
```
121121

122122
We provide the `match_two.py` script which computes the Patch-NetVLAD features for two given images and then determines the local feature matching between these images. While we provide example images, any image pair can be used.

match_two.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,6 @@ def match_two(model, device, config, im_one, im_two, plot_save_path):
101101
im_one_pil = Image.fromarray(cv2.cvtColor(im_one, cv2.COLOR_BGR2RGB))
102102
im_two_pil = Image.fromarray(cv2.cvtColor(im_two, cv2.COLOR_BGR2RGB))
103103

104-
# im_one = Image.open(opt.first_im_path)
105-
# im_two = Image.open(opt.second_im_path)
106-
107104
im_one_pil = it(im_one_pil).unsqueeze(0)
108105
im_two_pil = it(im_two_pil).unsqueeze(0)
109106

@@ -217,7 +214,11 @@ def main():
217214
raise FileNotFoundError("=> no checkpoint found at '{}'".format(resume_ckpt))
218215

219216
im_one = cv2.imread(opt.first_im_path, -1)
217+
if im_one is None:
218+
raise FileNotFoundError(opt.first_im_path + " does not exist")
220219
im_two = cv2.imread(opt.second_im_path, -1)
220+
if im_two is None:
221+
raise FileNotFoundError(opt.second_im_path + " does not exist")
221222

222223
match_two(model, device, config, im_one, im_two, opt.plot_save_path)
223224

0 commit comments

Comments
 (0)