开源项目:GitHub - HeatherJiaZG/SuperGlue-pytorch: [SuperGlue: Learning Feature Matching with Graph Neural Networks] This repo includes PyTorch code for training the SuperGlue matching network on top of SIFT keypoints and descriptors.
Paper Notes: CVPR Paper Notes|SuperGlue bzdww
- Download anaconda: Conda User Guide - Programmer Sought
- Create a python3.8 environment in anaconda, and install it in this environment according to the open source project
- Python 3
- PyTorch >= 1.1
- OpenCV >= 3.4 (4.1.2.30 recommended for best GUI keyboard interaction, see this note)
- Matplotlib >= 3.1
- NumPy >= 1.18
- environment,
Download the dataset wget http://images.cocodataset.org/zips/train2014.zip, unzip
Configuration Environment
conda create --name py38 python=3.8
source activate py38
pip3 install numpy opencv-python torch matplotlib tqdm scipy
training model
python train.py --train=./train2014/
问题1:ValueError: Expected more than 1 value per channel when training
Reason: Fundamentally, this is a problem when the number of features is small
Solution
try:
desc0 = desc0 + self.kenc(kpts0, torch.transpose(data['scores0'], 0, 1))
except:
desc0 = desc0 + self.kenc(kpts0, data['scores0'])
try:
desc1 = desc1 + self.kenc(kpts1, torch.transpose(data['scores1'], 0, 1))
except:
desc1 = desc1 + self.kenc(kpts1, data['scores1'])
Question 2: module 'cv2' has no atttibute 'xfeatures2d'
Reason: xfeatures2d.cpp has a patent and needs to install the corresponding version of opencv-contrib
Solution
Install the corresponding version of opencv-contrib
pip install opencv-python==4.7.0.72
pip install opencv-contrib-python==4.7.0.72