Views
No views yet
1pip install torch torchvision
2git clone https://github.com/SSSSphinx/SCoDe.git
3cd SCoDe
4pip install -r requirements.txt1import torch
2from src.config.default import get_cfg_defaults
3from src.model import CCOE
4
5# Load configuration
6cfg = get_cfg_defaults()
7cfg.merge_from_file('configs/scode_config.py')
8
9# Initialize model
10device = 'cuda' if torch.cuda.is_available() else 'cpu'
11model = CCOE(cfg.CCOE).eval().to(device)
12
13# Load pre-trained weights
14model.load_state_dict(torch.load('weights/scode.pth', map_location=device))
15
16# Model is ready for inference
17with torch.no_grad():
18 # Process image pair (example)
19 image1 = torch.randn(1, 3, 1024, 1024).to(device)
20 image2 = torch.randn(1, 3, 1024, 1024).to(device)
21 output = model({'image1': image1, 'image2': image2})1# Single GPU training
2python train_scode.py --num_workers 4 --epoch 15 --batch_size 4 --validation --learning_rate 1e-5
3
4# Multi-GPU distributed training (4 GPUs)
5python -m torch.distributed.launch --nproc_per_node 4 --master_port=29501 train_scode.py \
6 --num_workers 4 --epoch 15 --batch_size 4 --validation --learning_rate 1e-51python rot_inv_eval.py \
2 --extractors superpoint d2net r2d2 disk \
3 --image_pairs path/to/image/pairs \
4 --output_dir outputs/scode_rot_eval1python eval_pose_estimation.py \
2 --results_dir outputs/megadepth_results \
3 --dataset megadepth1python eval_radar.py \
2 --results_dir outputs/radar_resultsconfigs/scode_config.py - SCoDe model configurationsrc/config/default.py - Default configuration template1# Training
2cfg.DATASET.TRAIN.IMAGE_SIZE = [1024, 1024]
3cfg.DATASET.TRAIN.BATCH_SIZE = 4
4cfg.DATASET.TRAIN.PAIRS_LENGTH = 128000
5
6# Validation
7cfg.DATASET.VAL.IMAGE_SIZE = [1024, 1024]
8
9# Model
10cfg.CCOE.BACKBONE.NUM_LAYERS = 50
11cfg.CCOE.BACKBONE.STRIDE = 32
12cfg.CCOE.CCA.DEPTH = [2, 2, 2, 2]
13cfg.CCOE.CCA.NUM_HEADS = [8, 8, 8, 8]1python dataset_preparation.py \
2 --base_path dataset/megadepth/MegaDepth \
3 --num_per_scene 50001@article{pan2025scale,
2 title={Scale-aware co-visible region detection for image matching},
3 author={Pan, Xu and Xia, Zimin and Zheng, Xianwei},
4 journal={ISPRS Journal of Photogrammetry and Remote Sensing},
5 volume={229},
6 pages={122--137},
7 year={2025},
8 publisher={Elsevier}
9}