Skip to content

Commit

Permalink
Fix the bugs related to the change
Browse files Browse the repository at this point in the history
  • Loading branch information
Xinghui-Li committed Nov 17, 2020
1 parent a7f3f14 commit a158453
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 12 deletions.
7 changes: 3 additions & 4 deletions HPatches/eval_hpatches.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
parser.add_argument('--image_size', type=int, default=1600, help='image size used')
parser.add_argument('--Npts', type=int, default=2000, help='how many matches selected')
parser.add_argument('--iter_step', type=int, default=1000)
parser.add_argument('--selection', type=str, default='partial')
parser.add_argument('--im_fe_ratio', type=int, default=16)
parser.add_argument('--device', type=int, default=0, help='which gpu should the experiment be run on')
parser.add_argument('--benchmark', type=bool, default=False, help='whether to benchmark the speed. If does, it will use the first image for 20 times')
Expand All @@ -51,8 +50,8 @@
matcher = tools.ImgMatcher(use_cuda=use_cuda, half_precision=half_precision, checkpoint=args.checkpoint, postprocess_device=feature_extractor_device, im_fe_ratio=args.im_fe_ratio)

if not args.benchmark:
experiment_name = '%s_%d_%d_%s' % (args.experiment_name, args.image_size, args.Npts, args.selection)
output_name = 'hpatches_%s_%d_%d_%s.txt' % (args.experiment_name, args.image_size, args.Npts, args.selection)
experiment_name = '%s_%d_%d' % (args.experiment_name, args.image_size, args.Npts)
output_name = 'hpatches_%s_%d_%d.txt' % (args.experiment_name, args.image_size, args.Npts)
out = open(output_name, 'w')
print(output_name)

Expand Down Expand Up @@ -109,7 +108,7 @@
batch['target_image'] = ref_im.cuda()

start = time.time()
matches, score, _ = matcher(batch, num_pts=args.Npts, central_align=True, iter_step=args.iter_step, selection=args.selection)
matches, score, _ = matcher(batch, num_pts=args.Npts, central_align=True, iter_step=args.iter_step)
end = time.time()

if args.benchmark:
Expand Down
3 changes: 1 addition & 2 deletions aachen_day_and_night/eval_aachen_extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
parser.add_argument('--Npts', type=int, default=8000)
parser.add_argument('--image_pairs', type=str, default='all')
parser.add_argument('--iter_step', type=int, default=1000)
parser.add_argument('--selection', type=str, default='partial')
parser.add_argument('--device', type=int, default=0)
parser.add_argument('--benchmark', type=bool, default=False)
args = parser.parse_args()
Expand Down Expand Up @@ -87,7 +86,7 @@
hB_,wB_=tgt.shape[-2:]

with torch.no_grad():
result, scores, features = matcher({'source_image':src, 'target_image':tgt}, num_pts=args.Npts, central_align=False, iter_step=args.iter_step, selection=args.selection, args=args)
result, scores, features = matcher({'source_image':src, 'target_image':tgt}, num_pts=args.Npts, central_align=False, iter_step=args.iter_step, args=args)
# pdb.set_trace()
corr4d, featureA_0, featureB_0 = features
fs1, fs2 = featureA_0.shape[2:]
Expand Down
5 changes: 2 additions & 3 deletions inloc/eval_inloc_extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
parser.add_argument('--n_queries', type=int, default=356)
parser.add_argument('--n_panos', type=int, default=10)
parser.add_argument('--iter_step', type=int, default=1000)
parser.add_argument('--selection', type=str, default='partial')
parser.add_argument('--im_fe_ratio', type=int, default=16)
parser.add_argument('--device', type=int, default=0)
parser.add_argument('--benchmark', type=bool, default=False)
Expand All @@ -47,7 +46,7 @@
model = tools.ImgMatcher(use_cuda=use_cuda, half_precision=half_precision, checkpoint=args.checkpoint, postprocess_device=feature_extractor_device, im_fe_ratio=args.im_fe_ratio)

# Generate output folder path
output_folder = args.experiment_name + '_'+ args.selection
output_folder = args.experiment_name
print('Output matches folder: '+output_folder)

scale_factor = 0.0625
Expand Down Expand Up @@ -103,7 +102,7 @@
hB,wB=tgt.shape[-2:]
tgt=resize(normalize(tgt), args.image_size, scale_factor)
hB_,wB_=tgt.shape[-2:]
result, scores, _ = model({'source_image': src, 'target_image': tgt}, num_pts=args.Npts, central_align=True, iter_step=args.iter_step, selection=args.selection, args=args)
result, scores, _ = model({'source_image': src, 'target_image': tgt}, num_pts=args.Npts, central_align=True, iter_step=args.iter_step, args=args)
H_src, W_src = src.shape[-2:]
H_tgt, W_tgt = tgt.shape[-2:]

Expand Down
3 changes: 0 additions & 3 deletions train.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
'''
Train ncnet with strong loss
'''
import os
import numpy as np
import numpy.random
Expand Down

0 comments on commit a158453

Please sign in to comment.