Skip to content

Commit

Permalink
update README for superpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
xmba15 committed Aug 7, 2022
1 parent 98aca9f commit 5a90686
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 4 deletions.
34 changes: 33 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Hope that they both are helpful for your work.
## TODO

- [x] Support inference of multi-inputs, multi-outputs
- [x] Examples for famous models, like yolov3, mask-rcnn, [ultra-light-weight face detector](https://github.com/Linzaer/Ultra-Light-Fast-Generic-Face-Detector-1MB), [yolox](https://github.com/Megvii-BaseDetection/YOLOX), [PaddleSeg](https://github.com/PaddlePaddle/PaddleSeg/tree/release/2.3). Might consider supporting more if requested
- [x] Examples for famous models, like yolov3, mask-rcnn, [ultra-light-weight face detector](https://github.com/Linzaer/Ultra-Light-Fast-Generic-Face-Detector-1MB), [yolox](https://github.com/Megvii-BaseDetection/YOLOX), [PaddleSeg](https://github.com/PaddlePaddle/PaddleSeg/tree/release/2.3), [SuperPoint](https://github.com/magicleap/SuperPointPretrainedNetwork). Might consider supporting more if requested
- [ ] Batch-inference

## Installation
Expand Down Expand Up @@ -228,3 +228,35 @@ wget https://github.com/Megvii-BaseDetection/YOLOX/releases/download/0.1.1rc0/yo
+ test result on a new scene at Odaiba, Tokyo, Japan

![paddleseg odaiba](./data/images/odaiba_result.jpg)

### [SuperPoint](https://arxiv.org/pdf/1712.07629.pdf)

---

![super_point_good_matches](./data/images/super_point_good_matches.jpg)

<details>

- Convert SuperPoint's pretrained weights to onnx format

```bash
git submodule update --init --recursive
python3 -m pip install -r scripts/superpoint/requirements.txt
python3 scripts/superpoint/convert_to_onnx.py
```

- Download test images from [this dataset](https://github.com/StaRainJ/Multi-modality-image-matching-database-metrics-methods)

```bash
wget https://raw.githubusercontent.com/StaRainJ/Multi-modality-image-matching-database-metrics-methods/master/Multimodal_Image_Matching_Datasets/ComputerVision/CrossSeason/VisionCS_0a.png -P data

wget https://raw.githubusercontent.com/StaRainJ/Multi-modality-image-matching-database-metrics-methods/master/Multimodal_Image_Matching_Datasets/ComputerVision/CrossSeason/VisionCS_0b.png -P data
```

- Test inference apps

```bash
./build/examples/super_point ./scripts/superpoint/super_point.onnx data/VisionCS_0a.png data/VisionCS_0b.png
```

</details>
Binary file added data/images/super_point_good_matches.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion examples/SuperPointApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ int main(int argc, char* argv[])
cv::Scalar::all(-1), cv::Scalar::all(-1), std::vector<char>(),
cv::DrawMatchesFlags::NOT_DRAW_SINGLE_POINTS);
cv::imwrite("super_point_good_matches.jpg", matchesImage);
cv::imshow("super_point_good_matches", matchesImage);
cv::waitKey();

return EXIT_SUCCESS;
}
Expand Down Expand Up @@ -199,7 +201,6 @@ KeyPointAndDesc processOneFrame(const Ort::SuperPoint& osh, const cv::Mat& input
float confidenceThresh, bool alignCorners, int distThresh)
{
int origW = inputImg.cols, origH = inputImg.rows;
std::vector<float> originImageSize{static_cast<float>(origH), static_cast<float>(origW)};
cv::Mat scaledImg;
cv::resize(inputImg, scaledImg, cv::Size(Ort::SuperPoint::IMG_W, Ort::SuperPoint::IMG_H), 0, 0, cv::INTER_CUBIC);
osh.preprocess(dst, scaledImg.data, Ort::SuperPoint::IMG_W, Ort::SuperPoint::IMG_H, Ort::SuperPoint::IMG_CHANNEL);
Expand Down
3 changes: 1 addition & 2 deletions examples/Utility.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
#pragma once

#include <algorithm>
#include <opencv2/core/fast_math.hpp>
#include <stdexcept>
#include <string>
#include <utility>
#include <vector>

#include <opencv2/opencv.hpp>
Expand Down
1 change: 1 addition & 0 deletions scripts/superpoint/convert_to_onnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def main():
"output": {0: "batch_size"},
},
)
print(f"\nonnx model is saved to: {os.getcwd()}/super_point.onnx")


if __name__ == "__main__":
Expand Down

0 comments on commit 5a90686

Please sign in to comment.