{
  "id": 415279,
  "title": "Any success while trying to use SuperPoint as a local feature extractor ?",
  "url": "/competitions/image-matching-challenge-2023/discussion/415279",
  "author_name": "",
  "post_date": "2023-06-05T21:37:50.763269600Z",
  "votes": null,
  "comment_count": 4,
  "views": 0,
  "content": "<p>Hey Everyone 👋,</p>\n<p>I've been lately trying to use SuperPoint as a feature extractor. The output are extracted successfully upon passing the grayscale image to the pre-trained model weights.</p>\n<p>The architecture of whose is</p>\n<pre><code>class SuperPointNet(torch.nn.Module):\n  \n  def __init__(self):\n    super(SuperPointNet, self).__init__()\n    self.relu = torch.nn.ReLU(=)\n    self.pool = torch.nn.MaxPool2d(=2, =2)\n    c1, c2, c3, c4, c5, d1 = 64, 64, 128, 128, 256, 256\n    # Shared Encoder.\n    self.conv1a = torch.nn.Conv2d(1, c1, =3, =1, =1)\n    self.conv1b = torch.nn.Conv2d(c1, c1, =3, =1, =1)\n    self.conv2a = torch.nn.Conv2d(c1, c2, =3, =1, =1)\n    self.conv2b = torch.nn.Conv2d(c2, c2, =3, =1, =1)\n    self.conv3a = torch.nn.Conv2d(c2, c3, =3, =1, =1)\n    self.conv3b = torch.nn.Conv2d(c3, c3, =3, =1, =1)\n    self.conv4a = torch.nn.Conv2d(c3, c4, =3, =1, =1)\n    self.conv4b = torch.nn.Conv2d(c4, c4, =3, =1, =1)\n    # Detector Head.\n    self.convPa = torch.nn.Conv2d(c4, c5, =3, =1, =1)\n    self.convPb = torch.nn.Conv2d(c5, 65, =1, =1, =0)\n    # Descriptor Head.\n    self.convDa = torch.nn.Conv2d(c4, c5, =3, =1, =1)\n    self.convDb = torch.nn.Conv2d(c5, d1, =1, =1, =0)\n\n  def forward(self, x):\n    \n    # Shared Encoder.\n    x = self.relu(self.conv1a(x))\n    x = self.relu(self.conv1b(x))\n    x = self.pool(x)\n    x = self.relu(self.conv2a(x))\n    x = self.relu(self.conv2b(x))\n    x = self.pool(x)\n    x = self.relu(self.conv3a(x))\n    x = self.relu(self.conv3b(x))\n    x = self.pool(x)\n    x = self.relu(self.conv4a(x))\n    x = self.relu(self.conv4b(x))\n    # Detector Head.\n    cPa = self.relu(self.convPa(x))\n    semi = self.convPb(cPa)\n    # Descriptor Head.\n    cDa = self.relu(self.convDa(x))\n    desc = self.convDb(cDa)\n    dn = torch.norm(desc, =2, =1) # Compute the norm.\n    desc = desc.div(torch.unsqueeze(dn, 1)) # Divide by norm  normalize.\n    return semi, desc\n</code></pre>\n<p>Kinda modified the detect_features function, too. I am getting the error in laf calculation.</p>\n<pre><code> ():\n     LOCAL_FEATURE == :\n        \n        superpoint = SuperPointNet()\n        \n        weights_path = \n        state_dict = torch.load(weights_path)\n        superpoint.load_state_dict(state_dict)\n        superpoint.to(device)\n        superpoint.()\n     LOCAL_FEATURE == :\n        \n        disk = KF.DISK().to(device)\n        pretrained_dict = torch.load(, map_location=device)\n        disk.load_state_dict(pretrained_dict[])\n        disk.()\n     LOCAL_FEATURE == :\n        feature = KeyNetAffNetHardNet(num_feats, upright, device).to(device).()\n      os.path.isdir(feature_dir):\n        os.makedirs(feature_dir)\n     h5py.File(, mode=)  f_laf, \\\n         h5py.File(, mode=)  f_kp, \\\n         h5py.File(, mode=)  f_desc:\n        ((img_fnames))\n         img_path  progress_bar(img_fnames):\n            img_fname = img_path.split()[-]\n            key = img_fname\n             torch.inference_mode():\n                timg = load_torch_image(img_path, device=device)\n                H, W = timg.shape[:]\n                 resize_small_edge_to  :\n                    timg_resized = timg\n                :\n                    timg_resized = K.geometry.resize(timg, resize_small_edge_to, antialias=)\n                    ()\n                h, w = timg_resized.shape[:]\n                 LOCAL_FEATURE == :\n                    features = disk(timg_resized, num_feats, pad_if_not_divisible=)[]\n                    kps1, descs = features.keypoints, features.descriptors\n                    lafs = KF.laf_from_center_scale_ori(kps1.unsqueeze(), torch.ones(, (kps1), , , device=device))\n                 LOCAL_FEATURE == :\n                    \n                    timg_resized_gray = K.color.rgb_to_grayscale(timg_resized)\n                    \n                    timg_resized_gray_norm = timg_resized_gray / \n                    \n                    semi,desc= superpoint(timg_resized_gray_norm)\n                    lafs = KF.laf_from_center_scale_ori(semi, desc)\n                    (lafs.shape)\n\n                    (lafs.shape)\n                 LOCAL_FEATURE == :\n                    lafs, resps, descs = feature(K.color.rgb_to_grayscale(timg_resized))\n                lafs[:, :, , :] *= (W) / (w)\n                lafs[:, :, , :] *= (H) / (h)\n                desc_dim = descs.shape[-]\n                kpts = KF.get_laf_center(lafs).reshape(-, ).detach().cpu().numpy()\n                descs = descs.reshape(-, desc_dim).detach().cpu().numpy()\n                f_laf[key] = lafs.detach().cpu().numpy()\n                f_kp[key] = kpts\n                f_desc[key] = descs\n    \n</code></pre>\n<p>The laf i.e local affine frame calculation is the erroneous part ! Anyone has an idea of what can be a potential fix ?</p>\n<p>Error log :: </p>\n<pre><code>---------------------------------------------------------------------------\nTypeError                                 Traceback (most recent call last)\n/tmp/ipykernel_27/1931577555.py in &lt;module&gt;\n----&gt; 1 detect_features(image_fnames,2048,feature_dir=feature_dir,upright=True,device=device,resize_small_edge_to=600)\n\n/tmp/ipykernel_27/3102801615.py in detect_features(img_fnames, num_feats, upright, device, feature_dir, resize_small_edge_to)\n     51                     # Extract Superpoint keypoints and descriptors\n     52                     semi,desc= superpoint(timg_resized_gray_norm)\n---&gt; 53                     lafs = KF.laf_from_center_scale_ori(semi, desc)\n     54                     print(lafs.shape)\n     55 \n\n/opt/conda/lib/python3.7/site-packages/kornia/feature/laf.py in laf_from_center_scale_ori(xy, scale, ori)\n    116         LAF :math:`(B, N, 2, 3)`\n    117     \"\"\"\n--&gt; 118     KORNIA_CHECK_SHAPE(xy, [\"B\", \"N\", \"2\"])\n    119     device = xy.device\n    120     dtype = xy.dtype\n\n/opt/conda/lib/python3.7/site-packages/kornia/core/check.py in KORNIA_CHECK_SHAPE(x, shape)\n     59 \n     60     if len(x_shape_to_check) != len(shape_to_check):\n---&gt; 61         raise TypeError(f\"{x} shape must be [{shape}]. Got {x.shape}\")\n     62 \n     63     for i in range(len(x_shape_to_check)):\n\nTypeError: tensor([[[[.9171, .0594, .0678,  ..., .1093, .9207, .2948],\n          [.8315,  .8444,  .0914,  ...,  .9142,  .9273, .8387],\n          [.8942,  .4392,  .9862,  ..., .7064, .6526, .8322],\n          ...,\n          [.2909, .0762, .2312,  ..., .5126,  .9196, .8532],\n          [.7674,  .4111, .2537,  ..., .1126,  .5200, .0160],\n          [.6175, .0999, .4095,  ..., .0309, .3897, .4062]],\n\n         [[.1535, .7864, .7834,  ..., .5887, .6583, .1925],\n          [.2230,  .6038,  .4224,  ...,  .7792,  .5983, .5253],\n          [.9227,  .2033,  .5438,  ..., .4518, .0835, .8060],\n          ...,\n          [.6146, .5199, .0406,  ..., .4347,  .9951, .0644],\n          [.7437,  .0872,  .9819,  ...,  .7978,  .2965, .4064],\n          [.1329, .3083, .0397,  ..., .4670, .4316, .8279]],\n\n         [[.2330, .5113, .8023,  ..., .9697, .1868, .2851],\n          [.3570,  .2984,  .4650,  ...,  .2326,  .6007, .2744],\n          [.3915,  .4415,  .3022,  ..., .5174, .0232, .6803],\n          ...,\n          [.3836, .4241, .9733,  ..., .4182, .0871, .2019],\n          [.8080,  .6089,  .7320,  ...,  .6668,  .6112, .5163],\n          [.4001, .8622, .5070,  ..., .5243, .7775, .4204]],\n\n         ...,\n\n         [[.2499, .3028, .6899,  ..., .4290, .0376, .9008],\n          [.0079,  .3475,  .5923,  ..., .1740, .0958, .7053],\n          [.2946,  .9428,  .6519,  ..., .8114,  .8397, .1859],\n          ...,\n          [.3542, .6032, .4445,  ..., .5861, .7710, .6769],\n          [.4795,  .4224,  .6131,  ..., .5593,  .7552, .3038],\n          [.8089, .3811, .4577,  ..., .3446, .0032, .8429]],\n\n         [[.0370, .3352, .6362,  ..., .5943, .2324, .3501],\n          [.4735,  .5795,  .9835,  ..., .9370,  .8809, .6784],\n          [.7444,  .0535,  .1414,  ..., .1637,  .7580, .7635],\n          ...,\n          [.2730, .0327, .0497,  ..., .3811,  .9186, .7570],\n          [.5536, .2016,  .8686,  ..., .7372,  .7741, .8202],\n          [.8461, .9917, .1639,  ..., .7888, .2417, .6588]],\n\n         [[  0.3085,   4.4487,   4.6341,  ...,   4.4741,   4.4090,   4.1115],\n          [  0.4967,   6.0530,   5.1820,  ...,   7.0203,   7.5493,  13.0231],\n          [  0.2636,   4.8497,   4.2235,  ...,   4.5215,   5.9606,  12.2482],\n          ...,\n          [ .1254,   5.8193,   4.7976,  ...,   3.5993,   6.1349,  10.9780],\n          [  1.0410,   5.9768,   6.0417,  ...,   5.6386,   6.0314,  12.0031],\n          [  1.1619,   6.5870,   5.4562,  ...,   5.2236,   4.4831,   7.5196]]]]) shape must be [['B', 'N', '2']]. Got torch.Size([1, 65, 100, 75])\n</code></pre>",
  "messages": [
    {
      "id": "2289035",
      "postDate": "06/05/2023 21:37:50",
      "content": "<p>Hey Everyone 👋,</p>\n<p>I've been lately trying to use SuperPoint as a feature extractor. The output are extracted successfully upon passing the grayscale image to the pre-trained model weights.</p>\n<p>The architecture of whose is</p>\n<pre><code>class SuperPointNet(torch.nn.Module):\n  \n  def __init__(self):\n    super(SuperPointNet, self).__init__()\n    self.relu = torch.nn.ReLU(=)\n    self.pool = torch.nn.MaxPool2d(=2, =2)\n    c1, c2, c3, c4, c5, d1 = 64, 64, 128, 128, 256, 256\n    # Shared Encoder.\n    self.conv1a = torch.nn.Conv2d(1, c1, =3, =1, =1)\n    self.conv1b = torch.nn.Conv2d(c1, c1, =3, =1, =1)\n    self.conv2a = torch.nn.Conv2d(c1, c2, =3, =1, =1)\n    self.conv2b = torch.nn.Conv2d(c2, c2, =3, =1, =1)\n    self.conv3a = torch.nn.Conv2d(c2, c3, =3, =1, =1)\n    self.conv3b = torch.nn.Conv2d(c3, c3, =3, =1, =1)\n    self.conv4a = torch.nn.Conv2d(c3, c4, =3, =1, =1)\n    self.conv4b = torch.nn.Conv2d(c4, c4, =3, =1, =1)\n    # Detector Head.\n    self.convPa = torch.nn.Conv2d(c4, c5, =3, =1, =1)\n    self.convPb = torch.nn.Conv2d(c5, 65, =1, =1, =0)\n    # Descriptor Head.\n    self.convDa = torch.nn.Conv2d(c4, c5, =3, =1, =1)\n    self.convDb = torch.nn.Conv2d(c5, d1, =1, =1, =0)\n\n  def forward(self, x):\n    \n    # Shared Encoder.\n    x = self.relu(self.conv1a(x))\n    x = self.relu(self.conv1b(x))\n    x = self.pool(x)\n    x = self.relu(self.conv2a(x))\n    x = self.relu(self.conv2b(x))\n    x = self.pool(x)\n    x = self.relu(self.conv3a(x))\n    x = self.relu(self.conv3b(x))\n    x = self.pool(x)\n    x = self.relu(self.conv4a(x))\n    x = self.relu(self.conv4b(x))\n    # Detector Head.\n    cPa = self.relu(self.convPa(x))\n    semi = self.convPb(cPa)\n    # Descriptor Head.\n    cDa = self.relu(self.convDa(x))\n    desc = self.convDb(cDa)\n    dn = torch.norm(desc, =2, =1) # Compute the norm.\n    desc = desc.div(torch.unsqueeze(dn, 1)) # Divide by norm  normalize.\n    return semi, desc\n</code></pre>\n<p>Kinda modified the detect_features function, too. I am getting the error in laf calculation.</p>\n<pre><code> ():\n     LOCAL_FEATURE == :\n        \n        superpoint = SuperPointNet()\n        \n        weights_path = \n        state_dict = torch.load(weights_path)\n        superpoint.load_state_dict(state_dict)\n        superpoint.to(device)\n        superpoint.()\n     LOCAL_FEATURE == :\n        \n        disk = KF.DISK().to(device)\n        pretrained_dict = torch.load(, map_location=device)\n        disk.load_state_dict(pretrained_dict[])\n        disk.()\n     LOCAL_FEATURE == :\n        feature = KeyNetAffNetHardNet(num_feats, upright, device).to(device).()\n      os.path.isdir(feature_dir):\n        os.makedirs(feature_dir)\n     h5py.File(, mode=)  f_laf, \\\n         h5py.File(, mode=)  f_kp, \\\n         h5py.File(, mode=)  f_desc:\n        ((img_fnames))\n         img_path  progress_bar(img_fnames):\n            img_fname = img_path.split()[-]\n            key = img_fname\n             torch.inference_mode():\n                timg = load_torch_image(img_path, device=device)\n                H, W = timg.shape[:]\n                 resize_small_edge_to  :\n                    timg_resized = timg\n                :\n                    timg_resized = K.geometry.resize(timg, resize_small_edge_to, antialias=)\n                    ()\n                h, w = timg_resized.shape[:]\n                 LOCAL_FEATURE == :\n                    features = disk(timg_resized, num_feats, pad_if_not_divisible=)[]\n                    kps1, descs = features.keypoints, features.descriptors\n                    lafs = KF.laf_from_center_scale_ori(kps1.unsqueeze(), torch.ones(, (kps1), , , device=device))\n                 LOCAL_FEATURE == :\n                    \n                    timg_resized_gray = K.color.rgb_to_grayscale(timg_resized)\n                    \n                    timg_resized_gray_norm = timg_resized_gray / \n                    \n                    semi,desc= superpoint(timg_resized_gray_norm)\n                    lafs = KF.laf_from_center_scale_ori(semi, desc)\n                    (lafs.shape)\n\n                    (lafs.shape)\n                 LOCAL_FEATURE == :\n                    lafs, resps, descs = feature(K.color.rgb_to_grayscale(timg_resized))\n                lafs[:, :, , :] *= (W) / (w)\n                lafs[:, :, , :] *= (H) / (h)\n                desc_dim = descs.shape[-]\n                kpts = KF.get_laf_center(lafs).reshape(-, ).detach().cpu().numpy()\n                descs = descs.reshape(-, desc_dim).detach().cpu().numpy()\n                f_laf[key] = lafs.detach().cpu().numpy()\n                f_kp[key] = kpts\n                f_desc[key] = descs\n    \n</code></pre>\n<p>The laf i.e local affine frame calculation is the erroneous part ! Anyone has an idea of what can be a potential fix ?</p>\n<p>Error log :: </p>\n<pre><code>---------------------------------------------------------------------------\nTypeError                                 Traceback (most recent call last)\n/tmp/ipykernel_27/1931577555.py in &lt;module&gt;\n----&gt; 1 detect_features(image_fnames,2048,feature_dir=feature_dir,upright=True,device=device,resize_small_edge_to=600)\n\n/tmp/ipykernel_27/3102801615.py in detect_features(img_fnames, num_feats, upright, device, feature_dir, resize_small_edge_to)\n     51                     # Extract Superpoint keypoints and descriptors\n     52                     semi,desc= superpoint(timg_resized_gray_norm)\n---&gt; 53                     lafs = KF.laf_from_center_scale_ori(semi, desc)\n     54                     print(lafs.shape)\n     55 \n\n/opt/conda/lib/python3.7/site-packages/kornia/feature/laf.py in laf_from_center_scale_ori(xy, scale, ori)\n    116         LAF :math:`(B, N, 2, 3)`\n    117     \"\"\"\n--&gt; 118     KORNIA_CHECK_SHAPE(xy, [\"B\", \"N\", \"2\"])\n    119     device = xy.device\n    120     dtype = xy.dtype\n\n/opt/conda/lib/python3.7/site-packages/kornia/core/check.py in KORNIA_CHECK_SHAPE(x, shape)\n     59 \n     60     if len(x_shape_to_check) != len(shape_to_check):\n---&gt; 61         raise TypeError(f\"{x} shape must be [{shape}]. Got {x.shape}\")\n     62 \n     63     for i in range(len(x_shape_to_check)):\n\nTypeError: tensor([[[[.9171, .0594, .0678,  ..., .1093, .9207, .2948],\n          [.8315,  .8444,  .0914,  ...,  .9142,  .9273, .8387],\n          [.8942,  .4392,  .9862,  ..., .7064, .6526, .8322],\n          ...,\n          [.2909, .0762, .2312,  ..., .5126,  .9196, .8532],\n          [.7674,  .4111, .2537,  ..., .1126,  .5200, .0160],\n          [.6175, .0999, .4095,  ..., .0309, .3897, .4062]],\n\n         [[.1535, .7864, .7834,  ..., .5887, .6583, .1925],\n          [.2230,  .6038,  .4224,  ...,  .7792,  .5983, .5253],\n          [.9227,  .2033,  .5438,  ..., .4518, .0835, .8060],\n          ...,\n          [.6146, .5199, .0406,  ..., .4347,  .9951, .0644],\n          [.7437,  .0872,  .9819,  ...,  .7978,  .2965, .4064],\n          [.1329, .3083, .0397,  ..., .4670, .4316, .8279]],\n\n         [[.2330, .5113, .8023,  ..., .9697, .1868, .2851],\n          [.3570,  .2984,  .4650,  ...,  .2326,  .6007, .2744],\n          [.3915,  .4415,  .3022,  ..., .5174, .0232, .6803],\n          ...,\n          [.3836, .4241, .9733,  ..., .4182, .0871, .2019],\n          [.8080,  .6089,  .7320,  ...,  .6668,  .6112, .5163],\n          [.4001, .8622, .5070,  ..., .5243, .7775, .4204]],\n\n         ...,\n\n         [[.2499, .3028, .6899,  ..., .4290, .0376, .9008],\n          [.0079,  .3475,  .5923,  ..., .1740, .0958, .7053],\n          [.2946,  .9428,  .6519,  ..., .8114,  .8397, .1859],\n          ...,\n          [.3542, .6032, .4445,  ..., .5861, .7710, .6769],\n          [.4795,  .4224,  .6131,  ..., .5593,  .7552, .3038],\n          [.8089, .3811, .4577,  ..., .3446, .0032, .8429]],\n\n         [[.0370, .3352, .6362,  ..., .5943, .2324, .3501],\n          [.4735,  .5795,  .9835,  ..., .9370,  .8809, .6784],\n          [.7444,  .0535,  .1414,  ..., .1637,  .7580, .7635],\n          ...,\n          [.2730, .0327, .0497,  ..., .3811,  .9186, .7570],\n          [.5536, .2016,  .8686,  ..., .7372,  .7741, .8202],\n          [.8461, .9917, .1639,  ..., .7888, .2417, .6588]],\n\n         [[  0.3085,   4.4487,   4.6341,  ...,   4.4741,   4.4090,   4.1115],\n          [  0.4967,   6.0530,   5.1820,  ...,   7.0203,   7.5493,  13.0231],\n          [  0.2636,   4.8497,   4.2235,  ...,   4.5215,   5.9606,  12.2482],\n          ...,\n          [ .1254,   5.8193,   4.7976,  ...,   3.5993,   6.1349,  10.9780],\n          [  1.0410,   5.9768,   6.0417,  ...,   5.6386,   6.0314,  12.0031],\n          [  1.1619,   6.5870,   5.4562,  ...,   5.2236,   4.4831,   7.5196]]]]) shape must be [['B', 'N', '2']]. Got torch.Size([1, 65, 100, 75])\n</code></pre>",
      "rawMarkdown": "Hey Everyone 👋,\n\nI've been lately trying to use SuperPoint as a feature extractor. The output are extracted successfully upon passing the grayscale image to the pre-trained model weights.\n\nThe architecture of whose is\n\n```\nclass SuperPointNet(torch.nn.Module):\n  \"\"\" Pytorch definition of SuperPoint Network. \"\"\"\n  def __init__(self):\n    super(SuperPointNet, self).__init__()\n    self.relu = torch.nn.ReLU(inplace=True)\n    self.pool = torch.nn.MaxPool2d(kernel_size=2, stride=2)\n    c1, c2, c3, c4, c5, d1 = 64, 64, 128, 128, 256, 256\n    # Shared Encoder.\n    self.conv1a = torch.nn.Conv2d(1, c1, kernel_size=3, stride=1, padding=1)\n    self.conv1b = torch.nn.Conv2d(c1, c1, kernel_size=3, stride=1, padding=1)\n    self.conv2a = torch.nn.Conv2d(c1, c2, kernel_size=3, stride=1, padding=1)\n    self.conv2b = torch.nn.Conv2d(c2, c2, kernel_size=3, stride=1, padding=1)\n    self.conv3a = torch.nn.Conv2d(c2, c3, kernel_size=3, stride=1, padding=1)\n    self.conv3b = torch.nn.Conv2d(c3, c3, kernel_size=3, stride=1, padding=1)\n    self.conv4a = torch.nn.Conv2d(c3, c4, kernel_size=3, stride=1, padding=1)\n    self.conv4b = torch.nn.Conv2d(c4, c4, kernel_size=3, stride=1, padding=1)\n    # Detector Head.\n    self.convPa = torch.nn.Conv2d(c4, c5, kernel_size=3, stride=1, padding=1)\n    self.convPb = torch.nn.Conv2d(c5, 65, kernel_size=1, stride=1, padding=0)\n    # Descriptor Head.\n    self.convDa = torch.nn.Conv2d(c4, c5, kernel_size=3, stride=1, padding=1)\n    self.convDb = torch.nn.Conv2d(c5, d1, kernel_size=1, stride=1, padding=0)\n\n  def forward(self, x):\n    \"\"\" Forward pass that jointly computes unprocessed point and descriptor\n    tensors.\n    Input\n      x: Image pytorch tensor shaped N x 1 x H x W.\n    Output\n      semi: Output point pytorch tensor shaped N x 65 x H/8 x W/8.\n      desc: Output descriptor pytorch tensor shaped N x 256 x H/8 x W/8.\n    \"\"\"\n    # Shared Encoder.\n    x = self.relu(self.conv1a(x))\n    x = self.relu(self.conv1b(x))\n    x = self.pool(x)\n    x = self.relu(self.conv2a(x))\n    x = self.relu(self.conv2b(x))\n    x = self.pool(x)\n    x = self.relu(self.conv3a(x))\n    x = self.relu(self.conv3b(x))\n    x = self.pool(x)\n    x = self.relu(self.conv4a(x))\n    x = self.relu(self.conv4b(x))\n    # Detector Head.\n    cPa = self.relu(self.convPa(x))\n    semi = self.convPb(cPa)\n    # Descriptor Head.\n    cDa = self.relu(self.convDa(x))\n    desc = self.convDb(cDa)\n    dn = torch.norm(desc, p=2, dim=1) # Compute the norm.\n    desc = desc.div(torch.unsqueeze(dn, 1)) # Divide by norm to normalize.\n    return semi, desc\n```\n\nKinda modified the detect_features function, too. I am getting the error in laf calculation.\n\n```\ndef detect_features(img_fnames,\n                    num_feats=2048,\n                    upright=False,\n                    device=torch.device('cpu'),\n                    feature_dir='/kaggle/working/featureout',\n                    resize_small_edge_to=600):\n    if LOCAL_FEATURE == 'Superpoint':\n        # Load SuperPoint model architecture\n        superpoint = SuperPointNet()\n        # Load SuperPoint model weights\n        weights_path = '/kaggle/input/super-glue-pretrained-network/models/weights/superpoint_v1.pth'\n        state_dict = torch.load(weights_path)\n        superpoint.load_state_dict(state_dict)\n        superpoint.to(device)\n        superpoint.eval()\n    if LOCAL_FEATURE == 'DISK':\n        # Load DISK from Kaggle models so it can run when the notebook is offline.\n        disk = KF.DISK().to(device)\n        pretrained_dict = torch.load('/kaggle/input/disk/pytorch/depth-supervision/1/loftr_outdoor.ckpt', map_location=device)\n        disk.load_state_dict(pretrained_dict['extractor'])\n        disk.eval()\n    if LOCAL_FEATURE == 'KeyNetAffNetHardNet':\n        feature = KeyNetAffNetHardNet(num_feats, upright, device).to(device).eval()\n    if not os.path.isdir(feature_dir):\n        os.makedirs(feature_dir)\n    with h5py.File(f'{feature_dir}/lafs.h5', mode='w') as f_laf, \\\n         h5py.File(f'{feature_dir}/keypoints.h5', mode='w') as f_kp, \\\n         h5py.File(f'{feature_dir}/descriptors.h5', mode='w') as f_desc:\n        print(len(img_fnames))\n        for img_path in progress_bar(img_fnames):\n            img_fname = img_path.split('/')[-1]\n            key = img_fname\n            with torch.inference_mode():\n                timg = load_torch_image(img_path, device=device)\n                H, W = timg.shape[2:]\n                if resize_small_edge_to is None:\n                    timg_resized = timg\n                else:\n                    timg_resized = K.geometry.resize(timg, resize_small_edge_to, antialias=True)\n                    print(f'Resized {timg.shape} to {timg_resized.shape} (resize_small_edge_to={resize_small_edge_to})')\n                h, w = timg_resized.shape[2:]\n                if LOCAL_FEATURE == 'DISK':\n                    features = disk(timg_resized, num_feats, pad_if_not_divisible=True)[0]\n                    kps1, descs = features.keypoints, features.descriptors\n                    lafs = KF.laf_from_center_scale_ori(kps1.unsqueeze(0), torch.ones(1, len(kps1), 1, 1, device=device))\n                if LOCAL_FEATURE == 'Superpoint':\n                    # Convert the image to grayscale\n                    timg_resized_gray = K.color.rgb_to_grayscale(timg_resized)\n                    # Normalize the image\n                    timg_resized_gray_norm = timg_resized_gray / 255.0\n                    # Extract Superpoint keypoints and descriptors\n                    semi,desc= superpoint(timg_resized_gray_norm)\n                    lafs = KF.laf_from_center_scale_ori(semi, desc)\n                    print(lafs.shape)\n\n                    print(lafs.shape)\n                if LOCAL_FEATURE == 'KeyNetAffNetHardNet':\n                    lafs, resps, descs = feature(K.color.rgb_to_grayscale(timg_resized))\n                lafs[:, :, 0, :] *= float(W) / float(w)\n                lafs[:, :, 1, :] *= float(H) / float(h)\n                desc_dim = descs.shape[-1]\n                kpts = KF.get_laf_center(lafs).reshape(-1, 2).detach().cpu().numpy()\n                descs = descs.reshape(-1, desc_dim).detach().cpu().numpy()\n                f_laf[key] = lafs.detach().cpu().numpy()\n                f_kp[key] = kpts\n                f_desc[key] = descs\n    return\n\n```\n\nThe laf i.e local affine frame calculation is the erroneous part ! Anyone has an idea of what can be a potential fix ?\n\n\nError log :: \n\n```\n---------------------------------------------------------------------------\nTypeError                                 Traceback (most recent call last)\n/tmp/ipykernel_27/1931577555.py in <module>\n----> 1 detect_features(image_fnames,2048,feature_dir=feature_dir,upright=True,device=device,resize_small_edge_to=600)\n\n/tmp/ipykernel_27/3102801615.py in detect_features(img_fnames, num_feats, upright, device, feature_dir, resize_small_edge_to)\n     51                     # Extract Superpoint keypoints and descriptors\n     52                     semi,desc= superpoint(timg_resized_gray_norm)\n---> 53                     lafs = KF.laf_from_center_scale_ori(semi, desc)\n     54                     print(lafs.shape)\n     55 \n\n/opt/conda/lib/python3.7/site-packages/kornia/feature/laf.py in laf_from_center_scale_ori(xy, scale, ori)\n    116         LAF :math:`(B, N, 2, 3)`\n    117     \"\"\"\n--> 118     KORNIA_CHECK_SHAPE(xy, [\"B\", \"N\", \"2\"])\n    119     device = xy.device\n    120     dtype = xy.dtype\n\n/opt/conda/lib/python3.7/site-packages/kornia/core/check.py in KORNIA_CHECK_SHAPE(x, shape)\n     59 \n     60     if len(x_shape_to_check) != len(shape_to_check):\n---> 61         raise TypeError(f\"{x} shape must be [{shape}]. Got {x.shape}\")\n     62 \n     63     for i in range(len(x_shape_to_check)):\n\nTypeError: tensor([[[[-28.9171, -18.0594, -19.0678,  ..., -20.1093, -18.9207, -25.2948],\n          [-24.8315,  -7.8444,  -6.0914,  ...,  -7.9142,  -6.9273, -13.8387],\n          [-26.8942,  -9.4392,  -9.9862,  ..., -11.7064, -10.6526, -14.8322],\n          ...,\n          [-27.2909, -11.0762, -12.2312,  ..., -11.5126,  -9.9196, -14.8532],\n          [-25.7674,  -9.4111, -10.2537,  ..., -10.1126,  -9.5200, -15.0160],\n          [-26.6175, -14.0999, -17.4095,  ..., -19.0309, -18.3897, -21.4062]],\n\n         [[-30.1535, -17.7864, -20.7834,  ..., -21.5887, -20.6583, -28.1925],\n          [-24.2230,  -7.6038,  -5.4224,  ...,  -7.7792,  -6.5983, -16.5253],\n          [-26.9227,  -9.2033,  -9.5438,  ..., -11.4518, -10.0835, -17.8060],\n          ...,\n          [-27.6146, -10.5199, -12.0406,  ..., -11.4347,  -9.9951, -17.0644],\n          [-25.7437,  -9.0872,  -9.9819,  ...,  -9.7978,  -9.2965, -17.4064],\n          [-29.1329, -15.3083, -18.0397,  ..., -20.4670, -19.4316, -24.8279]],\n\n         [[-36.2330, -18.5113, -22.8023,  ..., -23.9697, -23.1868, -33.2851],\n          [-28.3570,  -7.2984,  -5.4650,  ...,  -7.2326,  -6.6007, -20.2744],\n          [-31.3915,  -9.4415,  -9.3022,  ..., -11.5174, -10.0232, -21.6803],\n          ...,\n          [-32.3836, -10.4241, -11.9733,  ..., -11.4182, -10.0871, -20.2019],\n          [-30.8080,  -8.6089,  -9.7320,  ...,  -9.6668,  -9.6112, -20.5163],\n          [-34.4001, -16.8622, -19.5070,  ..., -22.5243, -20.7775, -30.4204]],\n\n         ...,\n\n         [[-40.2499, -19.3028, -25.6899,  ..., -26.4290, -26.0376, -37.9008],\n          [-23.0079,  -9.3475,  -9.5923,  ..., -11.1740, -10.0958, -22.7053],\n          [-23.2946,  -7.9428,  -4.6519,  ..., -11.8114,  -8.8397, -23.1859],\n          ...,\n          [-27.3542, -11.6032, -12.4445,  ..., -12.5861, -10.7710, -23.6769],\n          [-25.4795,  -9.4224,  -8.6131,  ..., -10.5593,  -8.7552, -21.3038],\n          [-41.8089, -23.3811, -26.4577,  ..., -29.3446, -25.0032, -40.8429]],\n\n         [[-51.0370, -23.3352, -31.6362,  ..., -32.5943, -32.2324, -45.3501],\n          [-31.4735,  -8.5795,  -9.9835,  ..., -10.9370,  -8.8809, -21.6784],\n          [-31.7444,  -7.0535,  -5.1414,  ..., -12.1637,  -7.7580, -22.7635],\n          ...,\n          [-36.2730, -12.0327, -13.0497,  ..., -14.3811,  -9.9186, -23.7570],\n          [-34.5536, -10.2016,  -8.8686,  ..., -10.7372,  -7.7741, -20.8202],\n          [-46.8461, -21.9917, -26.1639,  ..., -29.7888, -25.2417, -44.6588]],\n\n         [[  0.3085,   4.4487,   4.6341,  ...,   4.4741,   4.4090,   4.1115],\n          [  0.4967,   6.0530,   5.1820,  ...,   7.0203,   7.5493,  13.0231],\n          [  0.2636,   4.8497,   4.2235,  ...,   4.5215,   5.9606,  12.2482],\n          ...,\n          [ -0.1254,   5.8193,   4.7976,  ...,   3.5993,   6.1349,  10.9780],\n          [  1.0410,   5.9768,   6.0417,  ...,   5.6386,   6.0314,  12.0031],\n          [  1.1619,   6.5870,   5.4562,  ...,   5.2236,   4.4831,   7.5196]]]]) shape must be [['B', 'N', '2']]. Got torch.Size([1, 65, 100, 75])\n```",
      "votes": null
    },
    {
      "id": "2289043",
      "postDate": "06/05/2023 21:46:20",
      "content": "<p>The error message is pretty clear.</p>\n<p>You have a raw detector+descriptor dense thing, whereas kornia expects [['B', 'N', '2']] shape. What you can do, is to separate heat map from descriptor, convert the heat map to the key point location and THEN use kornia things</p>",
      "rawMarkdown": "The error message is pretty clear.\n\nYou have a raw detector+descriptor dense thing, whereas kornia expects [['B', 'N', '2']] shape. What you can do, is to separate heat map from descriptor, convert the heat map to the key point location and THEN use kornia things",
      "votes": null
    },
    {
      "id": "2289057",
      "postDate": "06/05/2023 22:09:34",
      "content": "<p>Thanks a lot for the suggestion ! :D</p>",
      "rawMarkdown": "Thanks a lot for the suggestion ! :D",
      "votes": null
    },
    {
      "id": "2289232",
      "postDate": "06/06/2023 03:00:59",
      "content": "<p>You can try to refer to last year's code</p>",
      "rawMarkdown": "You can try to refer to last year's code",
      "votes": null
    },
    {
      "id": "2291821",
      "postDate": "06/07/2023 21:01:40",
      "content": "<p>Thanks to <a href=\"https://www.kaggle.com/oldufo\" target=\"_blank\">@oldufo</a> for the suggestion, I've managed to get an inference pipeline ready for it <br>\n<a href=\"https://www.kaggle.com/code/suraj520/superpoint-magicleap-as-a-feature-extractor\" target=\"_blank\">https://www.kaggle.com/code/suraj520/superpoint-magicleap-as-a-feature-extractor</a><br>\nLooking forward to plug it in the pipeline and evaluate !</p>",
      "rawMarkdown": "Thanks to @oldufo for the suggestion, I've managed to get an inference pipeline ready for it \nhttps://www.kaggle.com/code/suraj520/superpoint-magicleap-as-a-feature-extractor\nLooking forward to plug it in the pipeline and evaluate !",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 2289043,
      "author_name": "oldufo",
      "author_url": "",
      "post_date": "06/05/2023 21:46:20",
      "content": "<p>The error message is pretty clear.</p>\n<p>You have a raw detector+descriptor dense thing, whereas kornia expects [['B', 'N', '2']] shape. What you can do, is to separate heat map from descriptor, convert the heat map to the key point location and THEN use kornia things</p>",
      "votes": null,
      "replies": [
        {
          "id": 2289057,
          "author_name": "suraj520",
          "author_url": "",
          "post_date": "06/05/2023 22:09:34",
          "content": "<p>Thanks a lot for the suggestion ! :D</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 2289232,
      "author_name": "bent1e",
      "author_url": "",
      "post_date": "06/06/2023 03:00:59",
      "content": "<p>You can try to refer to last year's code</p>",
      "votes": null,
      "replies": [
        {
          "id": 2291821,
          "author_name": "suraj520",
          "author_url": "",
          "post_date": "06/07/2023 21:01:40",
          "content": "<p>Thanks to <a href=\"https://www.kaggle.com/oldufo\" target=\"_blank\">@oldufo</a> for the suggestion, I've managed to get an inference pipeline ready for it <br>\n<a href=\"https://www.kaggle.com/code/suraj520/superpoint-magicleap-as-a-feature-extractor\" target=\"_blank\">https://www.kaggle.com/code/suraj520/superpoint-magicleap-as-a-feature-extractor</a><br>\nLooking forward to plug it in the pipeline and evaluate !</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "2289035": "Hey Everyone 👋,\n\nI've been lately trying to use SuperPoint as a feature extractor. The output are extracted successfully upon passing the grayscale image to the pre-trained model weights.\n\nThe architecture of whose is\n\n```\nclass SuperPointNet(torch.nn.Module):\n  \"\"\" Pytorch definition of SuperPoint Network. \"\"\"\n  def __init__(self):\n    super(SuperPointNet, self).__init__()\n    self.relu = torch.nn.ReLU(inplace=True)\n    self.pool = torch.nn.MaxPool2d(kernel_size=2, stride=2)\n    c1, c2, c3, c4, c5, d1 = 64, 64, 128, 128, 256, 256\n    # Shared Encoder.\n    self.conv1a = torch.nn.Conv2d(1, c1, kernel_size=3, stride=1, padding=1)\n    self.conv1b = torch.nn.Conv2d(c1, c1, kernel_size=3, stride=1, padding=1)\n    self.conv2a = torch.nn.Conv2d(c1, c2, kernel_size=3, stride=1, padding=1)\n    self.conv2b = torch.nn.Conv2d(c2, c2, kernel_size=3, stride=1, padding=1)\n    self.conv3a = torch.nn.Conv2d(c2, c3, kernel_size=3, stride=1, padding=1)\n    self.conv3b = torch.nn.Conv2d(c3, c3, kernel_size=3, stride=1, padding=1)\n    self.conv4a = torch.nn.Conv2d(c3, c4, kernel_size=3, stride=1, padding=1)\n    self.conv4b = torch.nn.Conv2d(c4, c4, kernel_size=3, stride=1, padding=1)\n    # Detector Head.\n    self.convPa = torch.nn.Conv2d(c4, c5, kernel_size=3, stride=1, padding=1)\n    self.convPb = torch.nn.Conv2d(c5, 65, kernel_size=1, stride=1, padding=0)\n    # Descriptor Head.\n    self.convDa = torch.nn.Conv2d(c4, c5, kernel_size=3, stride=1, padding=1)\n    self.convDb = torch.nn.Conv2d(c5, d1, kernel_size=1, stride=1, padding=0)\n\n  def forward(self, x):\n    \"\"\" Forward pass that jointly computes unprocessed point and descriptor\n    tensors.\n    Input\n      x: Image pytorch tensor shaped N x 1 x H x W.\n    Output\n      semi: Output point pytorch tensor shaped N x 65 x H/8 x W/8.\n      desc: Output descriptor pytorch tensor shaped N x 256 x H/8 x W/8.\n    \"\"\"\n    # Shared Encoder.\n    x = self.relu(self.conv1a(x))\n    x = self.relu(self.conv1b(x))\n    x = self.pool(x)\n    x = self.relu(self.conv2a(x))\n    x = self.relu(self.conv2b(x))\n    x = self.pool(x)\n    x = self.relu(self.conv3a(x))\n    x = self.relu(self.conv3b(x))\n    x = self.pool(x)\n    x = self.relu(self.conv4a(x))\n    x = self.relu(self.conv4b(x))\n    # Detector Head.\n    cPa = self.relu(self.convPa(x))\n    semi = self.convPb(cPa)\n    # Descriptor Head.\n    cDa = self.relu(self.convDa(x))\n    desc = self.convDb(cDa)\n    dn = torch.norm(desc, p=2, dim=1) # Compute the norm.\n    desc = desc.div(torch.unsqueeze(dn, 1)) # Divide by norm to normalize.\n    return semi, desc\n```\n\nKinda modified the detect_features function, too. I am getting the error in laf calculation.\n\n```\ndef detect_features(img_fnames,\n                    num_feats=2048,\n                    upright=False,\n                    device=torch.device('cpu'),\n                    feature_dir='/kaggle/working/featureout',\n                    resize_small_edge_to=600):\n    if LOCAL_FEATURE == 'Superpoint':\n        # Load SuperPoint model architecture\n        superpoint = SuperPointNet()\n        # Load SuperPoint model weights\n        weights_path = '/kaggle/input/super-glue-pretrained-network/models/weights/superpoint_v1.pth'\n        state_dict = torch.load(weights_path)\n        superpoint.load_state_dict(state_dict)\n        superpoint.to(device)\n        superpoint.eval()\n    if LOCAL_FEATURE == 'DISK':\n        # Load DISK from Kaggle models so it can run when the notebook is offline.\n        disk = KF.DISK().to(device)\n        pretrained_dict = torch.load('/kaggle/input/disk/pytorch/depth-supervision/1/loftr_outdoor.ckpt', map_location=device)\n        disk.load_state_dict(pretrained_dict['extractor'])\n        disk.eval()\n    if LOCAL_FEATURE == 'KeyNetAffNetHardNet':\n        feature = KeyNetAffNetHardNet(num_feats, upright, device).to(device).eval()\n    if not os.path.isdir(feature_dir):\n        os.makedirs(feature_dir)\n    with h5py.File(f'{feature_dir}/lafs.h5', mode='w') as f_laf, \\\n         h5py.File(f'{feature_dir}/keypoints.h5', mode='w') as f_kp, \\\n         h5py.File(f'{feature_dir}/descriptors.h5', mode='w') as f_desc:\n        print(len(img_fnames))\n        for img_path in progress_bar(img_fnames):\n            img_fname = img_path.split('/')[-1]\n            key = img_fname\n            with torch.inference_mode():\n                timg = load_torch_image(img_path, device=device)\n                H, W = timg.shape[2:]\n                if resize_small_edge_to is None:\n                    timg_resized = timg\n                else:\n                    timg_resized = K.geometry.resize(timg, resize_small_edge_to, antialias=True)\n                    print(f'Resized {timg.shape} to {timg_resized.shape} (resize_small_edge_to={resize_small_edge_to})')\n                h, w = timg_resized.shape[2:]\n                if LOCAL_FEATURE == 'DISK':\n                    features = disk(timg_resized, num_feats, pad_if_not_divisible=True)[0]\n                    kps1, descs = features.keypoints, features.descriptors\n                    lafs = KF.laf_from_center_scale_ori(kps1.unsqueeze(0), torch.ones(1, len(kps1), 1, 1, device=device))\n                if LOCAL_FEATURE == 'Superpoint':\n                    # Convert the image to grayscale\n                    timg_resized_gray = K.color.rgb_to_grayscale(timg_resized)\n                    # Normalize the image\n                    timg_resized_gray_norm = timg_resized_gray / 255.0\n                    # Extract Superpoint keypoints and descriptors\n                    semi,desc= superpoint(timg_resized_gray_norm)\n                    lafs = KF.laf_from_center_scale_ori(semi, desc)\n                    print(lafs.shape)\n\n                    print(lafs.shape)\n                if LOCAL_FEATURE == 'KeyNetAffNetHardNet':\n                    lafs, resps, descs = feature(K.color.rgb_to_grayscale(timg_resized))\n                lafs[:, :, 0, :] *= float(W) / float(w)\n                lafs[:, :, 1, :] *= float(H) / float(h)\n                desc_dim = descs.shape[-1]\n                kpts = KF.get_laf_center(lafs).reshape(-1, 2).detach().cpu().numpy()\n                descs = descs.reshape(-1, desc_dim).detach().cpu().numpy()\n                f_laf[key] = lafs.detach().cpu().numpy()\n                f_kp[key] = kpts\n                f_desc[key] = descs\n    return\n\n```\n\nThe laf i.e local affine frame calculation is the erroneous part ! Anyone has an idea of what can be a potential fix ?\n\n\nError log :: \n\n```\n---------------------------------------------------------------------------\nTypeError                                 Traceback (most recent call last)\n/tmp/ipykernel_27/1931577555.py in <module>\n----> 1 detect_features(image_fnames,2048,feature_dir=feature_dir,upright=True,device=device,resize_small_edge_to=600)\n\n/tmp/ipykernel_27/3102801615.py in detect_features(img_fnames, num_feats, upright, device, feature_dir, resize_small_edge_to)\n     51                     # Extract Superpoint keypoints and descriptors\n     52                     semi,desc= superpoint(timg_resized_gray_norm)\n---> 53                     lafs = KF.laf_from_center_scale_ori(semi, desc)\n     54                     print(lafs.shape)\n     55 \n\n/opt/conda/lib/python3.7/site-packages/kornia/feature/laf.py in laf_from_center_scale_ori(xy, scale, ori)\n    116         LAF :math:`(B, N, 2, 3)`\n    117     \"\"\"\n--> 118     KORNIA_CHECK_SHAPE(xy, [\"B\", \"N\", \"2\"])\n    119     device = xy.device\n    120     dtype = xy.dtype\n\n/opt/conda/lib/python3.7/site-packages/kornia/core/check.py in KORNIA_CHECK_SHAPE(x, shape)\n     59 \n     60     if len(x_shape_to_check) != len(shape_to_check):\n---> 61         raise TypeError(f\"{x} shape must be [{shape}]. Got {x.shape}\")\n     62 \n     63     for i in range(len(x_shape_to_check)):\n\nTypeError: tensor([[[[-28.9171, -18.0594, -19.0678,  ..., -20.1093, -18.9207, -25.2948],\n          [-24.8315,  -7.8444,  -6.0914,  ...,  -7.9142,  -6.9273, -13.8387],\n          [-26.8942,  -9.4392,  -9.9862,  ..., -11.7064, -10.6526, -14.8322],\n          ...,\n          [-27.2909, -11.0762, -12.2312,  ..., -11.5126,  -9.9196, -14.8532],\n          [-25.7674,  -9.4111, -10.2537,  ..., -10.1126,  -9.5200, -15.0160],\n          [-26.6175, -14.0999, -17.4095,  ..., -19.0309, -18.3897, -21.4062]],\n\n         [[-30.1535, -17.7864, -20.7834,  ..., -21.5887, -20.6583, -28.1925],\n          [-24.2230,  -7.6038,  -5.4224,  ...,  -7.7792,  -6.5983, -16.5253],\n          [-26.9227,  -9.2033,  -9.5438,  ..., -11.4518, -10.0835, -17.8060],\n          ...,\n          [-27.6146, -10.5199, -12.0406,  ..., -11.4347,  -9.9951, -17.0644],\n          [-25.7437,  -9.0872,  -9.9819,  ...,  -9.7978,  -9.2965, -17.4064],\n          [-29.1329, -15.3083, -18.0397,  ..., -20.4670, -19.4316, -24.8279]],\n\n         [[-36.2330, -18.5113, -22.8023,  ..., -23.9697, -23.1868, -33.2851],\n          [-28.3570,  -7.2984,  -5.4650,  ...,  -7.2326,  -6.6007, -20.2744],\n          [-31.3915,  -9.4415,  -9.3022,  ..., -11.5174, -10.0232, -21.6803],\n          ...,\n          [-32.3836, -10.4241, -11.9733,  ..., -11.4182, -10.0871, -20.2019],\n          [-30.8080,  -8.6089,  -9.7320,  ...,  -9.6668,  -9.6112, -20.5163],\n          [-34.4001, -16.8622, -19.5070,  ..., -22.5243, -20.7775, -30.4204]],\n\n         ...,\n\n         [[-40.2499, -19.3028, -25.6899,  ..., -26.4290, -26.0376, -37.9008],\n          [-23.0079,  -9.3475,  -9.5923,  ..., -11.1740, -10.0958, -22.7053],\n          [-23.2946,  -7.9428,  -4.6519,  ..., -11.8114,  -8.8397, -23.1859],\n          ...,\n          [-27.3542, -11.6032, -12.4445,  ..., -12.5861, -10.7710, -23.6769],\n          [-25.4795,  -9.4224,  -8.6131,  ..., -10.5593,  -8.7552, -21.3038],\n          [-41.8089, -23.3811, -26.4577,  ..., -29.3446, -25.0032, -40.8429]],\n\n         [[-51.0370, -23.3352, -31.6362,  ..., -32.5943, -32.2324, -45.3501],\n          [-31.4735,  -8.5795,  -9.9835,  ..., -10.9370,  -8.8809, -21.6784],\n          [-31.7444,  -7.0535,  -5.1414,  ..., -12.1637,  -7.7580, -22.7635],\n          ...,\n          [-36.2730, -12.0327, -13.0497,  ..., -14.3811,  -9.9186, -23.7570],\n          [-34.5536, -10.2016,  -8.8686,  ..., -10.7372,  -7.7741, -20.8202],\n          [-46.8461, -21.9917, -26.1639,  ..., -29.7888, -25.2417, -44.6588]],\n\n         [[  0.3085,   4.4487,   4.6341,  ...,   4.4741,   4.4090,   4.1115],\n          [  0.4967,   6.0530,   5.1820,  ...,   7.0203,   7.5493,  13.0231],\n          [  0.2636,   4.8497,   4.2235,  ...,   4.5215,   5.9606,  12.2482],\n          ...,\n          [ -0.1254,   5.8193,   4.7976,  ...,   3.5993,   6.1349,  10.9780],\n          [  1.0410,   5.9768,   6.0417,  ...,   5.6386,   6.0314,  12.0031],\n          [  1.1619,   6.5870,   5.4562,  ...,   5.2236,   4.4831,   7.5196]]]]) shape must be [['B', 'N', '2']]. Got torch.Size([1, 65, 100, 75])\n```",
    "2289043": "The error message is pretty clear.\n\nYou have a raw detector+descriptor dense thing, whereas kornia expects [['B', 'N', '2']] shape. What you can do, is to separate heat map from descriptor, convert the heat map to the key point location and THEN use kornia things",
    "2289057": "Thanks a lot for the suggestion ! :D",
    "2289232": "You can try to refer to last year's code",
    "2291821": "Thanks to @oldufo for the suggestion, I've managed to get an inference pipeline ready for it \nhttps://www.kaggle.com/code/suraj520/superpoint-magicleap-as-a-feature-extractor\nLooking forward to plug it in the pipeline and evaluate !"
  },
  "source": "meta"
}