Skip to content

Conversation

@aevri
Copy link
Owner

@aevri aevri commented Nov 4, 2025

Implements issue #496 by adding a new 'rotomap automark3' command that uses
DINOv3 for feature-based mole matching across images.

Features:

  • New mel/lib/dinov3.py module for DINOv3 model loading and feature extraction
  • New mel/cmd/rotomapautomark3.py command with --reference and --target arguments
  • Supports multiple model sizes (small, base, large, giant)
  • Configurable cosine similarity threshold for match acceptance
  • Best-match aggregation when moles appear in multiple reference images
  • Updates non-canonical moles, skips canonical ones
  • Optional debug image output
  • Smoke test integration

The command leverages DINOv3's improved semantic features for more accurate
mole matching compared to previous versions.

Implements issue #496 by adding a new 'rotomap automark3' command that uses
DINOv3 for feature-based mole matching across images.

Features:
- New mel/lib/dinov3.py module for DINOv3 model loading and feature extraction
- New mel/cmd/rotomapautomark3.py command with --reference and --target arguments
- Supports multiple model sizes (small, base, large, giant)
- Configurable cosine similarity threshold for match acceptance
- Best-match aggregation when moles appear in multiple reference images
- Updates non-canonical moles, skips canonical ones
- Optional debug image output
- Smoke test integration

The command leverages DINOv3's improved semantic features for more accurate
mole matching compared to previous versions.
Enhancements to automark3:
- Add geometric position guessing when no existing mole is found
- Uses mel.rotomap.relate.guess_mole_pos for initial position estimation
- Combines geometric guessing (like guess-missing) with DINOv3 refinement
- Improves ability to find completely missing moles

New benchmark test:
- test_benchmark_automark3: Tests automark3 on mel-datasets benchmark
- Uses same dataset and metrics as guess-missing/guess-refine test
- Expects to find all 3 removed moles and match at least 2 within 50 pixels
- Validates automark3 performs at least as well as existing commands

This makes automark3 a complete solution that can both find missing moles
and refine their positions using DINOv3 features, without requiring a
separate guess-missing step.
Fixes for new code (automark3 and dinov3):
- Remove unused numpy import
- Prefix unused variables with underscore (_feature_dim, _ref_x, etc.)
- Remove unused torch import in search_for_mole function
- Remove unnecessary old_x, old_y variables
- Use ternary operator for feature extraction
- Return directly instead of assigning to similarity variable

Fixes for pre-existing code:
- rotomapmergeextrastem.py: Prefix unused added_uuids with underscore
- identifynn.py: Prefix unused i variables in training/validation steps
- relate.py: Prefix unused to_points and error variables

All code now passes ruff static analysis checks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants