-
Notifications
You must be signed in to change notification settings - Fork 82
Description
Executing script for downloaded weights do not work:
import os
import yaml
import immatch
from immatch.utils import plot_matches
for method in [ 'patch2pix', 'loftr', 'superglue', 'caps_superpoint', 'd2net', 'r2d2', 'dogaffnethardnet']:
print(f'\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Visualize matches of {method}')
config_file = f'../configs/{method}.yml'
with open(config_file, 'r') as f:
args = yaml.load(f, Loader=yaml.FullLoader)['example']
if 'ckpt' in args:
args['ckpt'] = os.path.join('..', args['ckpt'])
class_name = args['class']
# Init model
model = immatch.__dict__[class_name](args)
matcher = lambda im1, im2: model.match_pairs(im1, im2)
# Put some example image pairs
im1 = '../third_party/1.jpg'
im2 = '../third_party/2.jpg'
matches, _, _, _ = matcher(im1, im2)
plot_matches(im1, im2, matches, radius=2, lines=True)
Error:
Exception has occurred: AttributeError
'Conv4d' object has no attribute 'weight'
File "/home/developer/matching/image-matching-toolbox/third_party/patch2pix/networks/ncn/conv4d.py", line 86, in init
self.weight.data=self.weight.data.permute(2,0,1,3,4,5).contiguous()
File "/home/developer/matching/image-matching-toolbox/third_party/patch2pix/networks/ncn/model.py", line 139, in init
nn_modules.append(Conv4d(in_channels=ch_in,out_channels=ch_out,kernel_size=k_size,bias=True))
File "/home/developer/matching/image-matching-toolbox/third_party/patch2pix/networks/patch2pix.py", line 32, in init
self.ncn = NeighConsensus(kernel_sizes=[3, 3], channels=[16, 1])
File "/home/developer/matching/image-matching-toolbox/third_party/patch2pix/utils/eval/model_helper.py", line 60, in load_model
net = Patch2Pix(config)
File "/home/developer/matching/image-matching-toolbox/immatch/modules/patch2pix.py", line 27, in init
self.model = load_model(args.ckpt, method="patch2pix")
File "/home/developer/matching/image-matching-toolbox/notebooks/test.py", line 18, in
model = immatch.dictclass_name
AttributeError: 'Conv4d' object has no attribute 'weight'