# SuperPoint SuperGlue TensorRT
SuperPoint and SuperGlue with TensorRT.
## Demo
<img src="image/superpoint_superglue_tensorrt.gif" width = "640" height = "240" alt="match_image" border="10" />
* This demo was tested on the Quadro P620 GPU.
## Baseline
| Image Size: 320 x 240 | RTX3080 | Quadro P620 |
|:----------------------:|:-------:|:-----------:|
| SuperPoint (250 points)| 1.04 MS | 13.61 MS |
| SuperPoint (257 points)| 1.03 MS | 13.32 MS |
| SuperGlue (256 dims) | 7.47 MS | 58.83 MS |
| FPS (superpoint one time + superglue one time) | $\approx$ 117 FPS | $\approx$ 13 FPS |
## Environment required
cuda==11.6
torch==1.9.1
onnx==1.11.0
onnx-simplifier==0.3.10
onnxoptimizer==0.2.7
onnxruntime==1.11.1
tensorrt==8.4.1.5
## Convert model(Optional)
The converted model is already provided in the [weights](./weights) folder, if you are using the pretrained model officially provided by [SuperPoint and SuperGlue](https://github.com/magicleap/SuperGluePretrainedNetwork), you do not need to go through this step.
(1) torch -> onnx;
(2) onnx -> onnxsim;
(3) int64 -> int32;
```bash
python convert2onnx/convert_superpoint_to_onnx.py --weight_file superpoint_pth_file_path --output_dir superpoint_onnx_file_dir
python convert2onnx/convert_superglue_to_onnx.py --weight_file superglue_pth_file_path --output_dir superglue_onnx_file_dir
```
## Build and run
```bash
cd 项目
mkdir build
cd build
cmake ..
make
# test on image pairs 100 times, the output image will be saved in the build dir
./superpointglue_image ../config/config.yaml ../weights/ ${PWD}/../image/image0.png ${PWD}/../image/image1.png
# test on the folder with image sequence, output images will be saved in the param assigned dir
./superpointglue_sequence ../config/config.yaml ../weights/ ${PWD}/../image/freiburg_sequence/ ${PWD}/../image/freiburg_sequence/match_images/
```
The default image size param is 320x240, if you need to modify the image size in the config file, you should delete the old .engine file in the weights dir.
## Samples
```c++
#include "super_point.h"
#include "super_glue.h"
// read image
cv::Mat image0 = cv::imread("../image/image0.png", cv::IMREAD_GRAYSCALE);
cv::Mat image1 = cv::imread("../image/image1.png", cv::IMREAD_GRAYSCALE);
// read config from file
Configs configs("../config/config.yaml", "../weights/");
// create superpoint detector and superglue matcher
auto superpoint = std::make_shared<SuperPoint>(configs.superpoint_config);
auto superglue = std::make_shared<SuperGlue>(configs.superglue_config);
// build engine
superpoint->build();
superglue->build();
// infer superpoint
Eigen::Matrix<double, 259, Eigen::Dynamic> feature_points0, feature_points1;
superpoint->infer(image0, feature_points0);
superpoint->infer(image1, feature_points1)
// infer superglue
std::vector<cv::DMatch> superglue_matches;
superglue->matching_points(feature_points0, feature_points1, superglue_matches);
```
没有合适的资源?快使用搜索试试~ 我知道了~
算法部署-使用TensorRT部署SuperPoint-SuperGlue算法-优质算法部署项目实战.zip
共51个文件
png:20个
h:10个
cpp:5个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 111 浏览量
2024-03-06
10:00:34
上传
评论 1
收藏 100.54MB ZIP 举报
温馨提示
算法部署_使用TensorRT部署SuperPoint-SuperGlue算法_优质算法部署项目实战
资源推荐
资源详情
资源评论
收起资源包目录
算法部署_使用TensorRT部署SuperPoint-SuperGlue算法_优质算法部署项目实战.zip (51个子文件)
算法部署_使用TensorRT部署SuperPoint-SuperGlue算法_优质算法部署项目实战
inference_image.cpp 5KB
include
super_point.h 2KB
super_glue.h 3KB
read_config.h 4KB
utils.h 4KB
CMakeLists.txt 994B
.vscode
settings.json 62B
weights
superglue_outdoor_sim_int32.onnx 45.92MB
superpoint_v1_sim_int32.onnx 4.97MB
superglue_indoor_sim_int32.onnx 45.92MB
image
freiburg_sequence
1341847987.758741.png 490KB
1341847985.746954.png 476KB
1341847980.722988.png 464KB
1341847996.874766.png 472KB
1341847994.866828.png 467KB
1341847984.743352.png 455KB
1341847995.870641.png 476KB
1341847989.802890.png 507KB
1341847982.730674.png 460KB
1341847983.738736.png 460KB
1341847981.726650.png 463KB
1341847986.762616.png 493KB
1341847992.818723.png 487KB
1341847988.769740.png 503KB
1341847993.826735.png 467KB
1341847991.814748.png 476KB
1341847990.810771.png 486KB
superpoint_superglue_tensorrt.gif 1.7MB
image1.png 463KB
image0.png 464KB
match_image.png 218KB
src
super_point.cpp 14KB
super_glue.cpp 21KB
inference_sequence.cpp 4KB
3rdparty
tensorrtbuffer
include
buffers.h 16KB
logger.h 1KB
logging.h 18KB
common.h 30KB
error_recorder.h 4KB
half.h 197KB
CMakeLists.txt 325B
src
logger.cpp 1KB
convert2onnx
convert_int32.py 3KB
simplify_superpoint.sh 146B
superglue.py 12KB
convert_superpoint_to_onnx.py 3KB
convert_superglue_to_onnx.py 4KB
simplify_superglue.sh 252B
superpoint.py 8KB
README.md 3KB
config
config.yaml 626B
共 51 条
- 1
资源评论
极智视界
- 粉丝: 2w+
- 资源: 1425
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功