config = { 'superpoint': { 'nms_radius': opt.nms_radius, 'keypoint_threshold': opt.keypoint_threshold, 'max_keypoints': opt.max_keypoints }, 'superglue': { 'weights': opt.superglue, 'sinkhorn_iterations': opt.sinkhorn_iterations, 'match_threshold': opt.match_threshold, } } matching = Matching(config).eval().to(device) keys = ['keypoints', 'scores', 'descriptors'] vs = VideoStreamer(opt.input, opt.resize, opt.skip, opt.image_glob, opt.max_length) frame, ret = vs.next_frame() assert ret, 'Error when reading the first frame (try different --input?)' frame_tensor = frame2tensor(frame, device) last_data = matching.superpoint({'image': frame_tensor}) last_data = {k + '0': last_data[k] for k in keys} last_data['image0'] = frame_tensor last_frame = frame last_image_id = 0 if opt.output_dir is not None: print('==> Will write outputs to {}'.format(opt.output_dir)) Path(opt.output_dir).mkdir(exist_ok=True) # Create a window to display the demo.
config = { 'superpoint': { 'nms_radius': opt.nms_radius, 'detection_threshold': opt.keypoint_thresh, 'max_keypoints': opt.max_keypoints }, 'superglue': { 'weights': opt.superglue, 'num_sinkhorn_iterations': opt.sinkhorn_iterations, 'filter_threshold': opt.match_thresh, } } matching = Matching(config).eval().to(device) keys = ['keypoints', 'scores', 'descriptors'] vs = VideoStreamer(opt.input, opt.resize, opt.skip, opt.img_glob, opt.maxlen) frame, ret = vs.next_frame() assert ret, 'Error when reading the first frame (try different --input?)' frame_tensor = frame2tensor(frame, device) last_data = matching.superpoint({'image': frame_tensor}) last_data = {k + '0': last_data[k] for k in keys} last_data['image0'] = frame_tensor last_frame = frame last_image_id = 0 if opt.write: print('==> Will write outputs to {}'.format(opt.write_dir)) Path(opt.write_dir).mkdir(exist_ok=True) # Create a window to display the demo.