MCPcopy Index your code
hub / github.com/Parskatt/DeDoDe

github.com/Parskatt/DeDoDe @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
243 symbols 834 edges 45 files 12 documented · 5%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

DeDoDe 🎶 Detect, Don't Describe --- Describe, Don't Detect for Local Feature Matching 3DV 2024 Oral

<a href="https://scholar.google.com/citations?user=Ul-vMR0AAAAJ">Johan Edstedt</a>
·
<a href="https://scholar.google.com/citations?user=FUE3Wd0AAAAJ">Georg Bökman</a>
·
<a href="https://scholar.google.com/citations?user=6WRQpCQAAAAJ">Mårten Wadenbäck</a>
·
<a href="https://scholar.google.com/citations?user=lkWfR08AAAAJ">Michael Felsberg</a>

Paper | Project Page (TODO)

<img src="https://github.com/Parskatt/DeDoDe/raw/main/assets/matches.jpg" alt="example" width=80%>



<em>The DeDoDe detector learns to detect 3D consistent repeatable keypoints, which the DeDoDe descriptor learns to match. The result is a powerful decoupled local feature matcher.</em>

🆕 DeDoDe v2: Analyzing and Improving the DeDoDe Keypoint Detector

We have updated the training recipe for the detector. Weights are available here: https://github.com/Parskatt/DeDoDe/releases/download/v2/dedode_detector_L_v2.pth

🆕 Kornia Integration

DeDoDe is in kornia, pip install kornia, and can be imported by e.g.

from kornia.feature import DeDoDe
dedode = DeDoDe.from_pretrained(detector_weights="L-upright", descriptor_weights="B-upright")

How to Use DeDoDe?

Below we show how DeDoDe can be run, you can also check out the demos

from DeDoDe import dedode_detector_L, dedode_descriptor_B, dedode_descriptor_G
from DeDoDe.matchers.dual_softmax_matcher import DualSoftMaxMatcher

# You can either provide weights manually, or not provide any. If none
# are provided we automatically download them. None: We now use v2 detector weights by default.
detector = dedode_detector_L(weights = None)
# Choose either a smaller descriptor,
descriptor = dedode_descriptor_B(weights = None)
# Or a larger one
descriptor = dedode_descriptor_G(weights = None, 
                                 dinov2_weights = None) # You can manually load dinov2 weights, or we'll pull from facebook

matcher = DualSoftMaxMatcher()

im_A_path = "assets/im_A.jpg"
im_B_path = "assets/im_B.jpg"
im_A = Image.open(im_A_path)
im_B = Image.open(im_B_path)
W_A, H_A = im_A.size
W_B, H_B = im_B.size


detections_A = detector.detect_from_path(im_A_path, num_keypoints = 10_000)
keypoints_A, P_A = detections_A["keypoints"], detections_A["confidence"]

detections_B = detector.detect_from_path(im_B_path, num_keypoints = 10_000)
keypoints_B, P_B = detections_B["keypoints"], detections_B["confidence"]

description_A = descriptor.describe_keypoints_from_path(im_A_path, keypoints_A)["descriptions"]
description_B = descriptor.describe_keypoints_from_path(im_B_path, keypoints_B)["descriptions"]

matches_A, matches_B, batch_ids = matcher.match(keypoints_A, description_A,
    keypoints_B, description_B,
    P_A = P_A, P_B = P_B,
    normalize = True, inv_temp=20, threshold = 0.1)#Increasing threshold -> fewer matches, fewer outliers

matches_A, matches_B = matcher.to_pixel_coords(matches_A, matches_B, H_A, W_A, H_B, W_B)

Training DeDoDe

See experiments for the scripts to train DeDoDe. We trained on a single A100-40GB with a batchsize of 8. Note that you need to do the data prep first, see data_prep.

As usual, we require that you have the MegaDepth dataset already downloaded, and that you have the prepared scene info from DKM.

Pretrained Models

Right now you can find them here: https://github.com/Parskatt/DeDoDe/releases/tag/dedode_pretrained_models Probably we'll add some autoloading in the near future.

DeDoDe in Other Frameworks

License

All code/models except DINOv2 (descriptor-G), are MIT license. DINOv2 is Apache-2 license

BibTeX

@inproceedings{edstedt2024dedode,
  title={{DeDoDe: Detect, Don't Describe --- Describe, Don't Detect for Local Feature Matching}},
  author = {Johan Edstedt and Georg Bökman and Mårten Wadenbäck and Michael Felsberg},
  booktitle={2024 International Conference on 3D Vision (3DV)},
  year={2024},
  organization={IEEE}
}

@inproceedings{edstedt2024dedodev2,
  title={{DeDoDe v2: Analyzing and Improving the DeDoDe Keypoint Detector
}},
  author = {Johan Edstedt and Georg Bökman and Zhenjun Zhao},
  booktitle={IEEE/CVF Computer Society Conference on Computer Vision and Pattern Recognition Workshops (CVPRW)},
  year={2024},
}

Core symbols most depended-on inside this repo

get_best_device
called by 23
DeDoDe/utils.py
load
called by 20
DeDoDe/checkpoint.py
save
called by 11
DeDoDe/checkpoint.py
detect_from_path
called by 10
DeDoDe/detectors/dedode_detector.py
build_scenes
called by 9
DeDoDe/datasets/megadepth.py
dedode_detector_L
called by 8
DeDoDe/model_zoo/dedode_models.py
describe_keypoints_from_path
called by 6
DeDoDe/descriptors/dedode_descriptor.py
warp_kpts
called by 5
DeDoDe/utils.py

Shape

Method 135
Function 67
Class 41

Languages

Python100%

Modules by API surface

DeDoDe/utils.py73 symbols
DeDoDe/transformer/dinov2.py21 symbols
DeDoDe/transformer/layers/block.py15 symbols
DeDoDe/datasets/megadepth.py15 symbols
DeDoDe/detectors/keypoint_loss.py13 symbols
DeDoDe/encoder.py12 symbols
DeDoDe/detectors/dedode_detector.py9 symbols
DeDoDe/decoder.py7 symbols
DeDoDe/descriptors/descriptor_loss.py6 symbols
DeDoDe/descriptors/dedode_descriptor.py6 symbols
DeDoDe/transformer/layers/swiglu_ffn.py5 symbols
DeDoDe/transformer/layers/patch_embed.py5 symbols

For agents

$ claude mcp add DeDoDe \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact