SuperGlue: Learning Feature Matching with Graph Neural Networks跑通及训练模型的过程

开源项目: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.

论文笔记:CVPR论文笔记| SuperGlue - 知乎

  1. 下载anaconda:Conda使用指南 - 知乎
  2. 在anaconda建立python3.8环境,按照开源项目在该环境下安装
  3. Python 3
  4. PyTorch >= 1.1
  5. OpenCV >= 3.4 (4.1.2.30 recommended for best GUI keyboard interaction, see this note)
  6. Matplotlib >= 3.1
  7. NumPy >= 1.18
  8. 环境,

下载数据集 wget http://images.cocodataset.org/zips/train2014.zip,解压

配置环境

conda create --name py38 python=3.8

source activate py38

pip3 install numpy opencv-python torch matplotlib tqdm scipy

训练模型

python train.py  --train=./train2014/

问题1:ValueError: Expected more than 1 value per channel when training

原因:从根本上说,这是特征数量少时出现的问题

解决方法

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'])

扫描二维码关注公众号,回复: 16000925 查看本文章

问题2:module'cv2'has no atttibute 'xfeatures2d'

原因:xfeatures2d.cpp有专利,需要安装对应版本的opencv-contrib

解决方法

安装对应版本的opencv-contrib

pip install opencv-python==4.7.0.72

pip install opencv-contrib-python==4.7.0.72

猜你喜欢

转载自blog.csdn.net/zenglongjian/article/details/129831803