Coder Social home page Coder Social logo

torch_cpp's Introduction

Build

๐Ÿ“ torch_cpp


๐ŸŽ› Dependencies


sudo apt-get install -y --no-install-recommends \
    libopencv-dev

๐Ÿ”จ How to Build


# build library
make default

# build examples
make apps -j`nproc`

# build gpu examples
make gpu_apps -j`nproc`

๐Ÿƒ How to Run


Usage
  • Script pre-trained superpoint and superglue weights
git submodule update --init --recursive
export ROOT_DIR="$(pwd)"
cd $ROOT_DIR/scripts/superglue/SuperGluePretrainedNetwork/
git apply ../jit_patch.patch
python3 -m pip install -r $ROOT_DIR/scripts/superglue/SuperGluePretrainedNetwork/requirements.txt
cd $ROOT_DIR
python3 $ROOT_DIR/scripts/superglue/jit_superglue_model.py
python3 $ROOT_DIR/scripts/superglue/jit_superpoint_model.py
  • Test inference apps
./build/examples/match_images_superglue/match_images_superglue_app path/to/superpoint_model.pt path/to/superglue_model.pt ./data/images/VisionCS_0a.png ./data/images/VisionCS_0b.png

(back to top)

๐Ÿ’Ž References


(back to top)

torch_cpp's People

Contributors

xmba15 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

torch_cpp's Issues

Difference with implementation of SuperPoint SLAM

Hello,
Thank you so much for this implementation. I am new to Deep Learning and PyTorch in general, so my question may be a bit naive.
I notice there are differences in SuperPoint implementation between yours and SuperPoint SLAM, such as yours doesn't have structure SuperPoint and define its conv layers like here. Is it have any pros and cons between this two implementation?
I Hope can hear from you!

how to build the source code?

Hi, I am not so familiar with the building of c++, if possible, would you please show some building details?
Thank you very much.

Cannot create model

Hi! Thank you for this code. I am trying to convert the model, and i see this error:

Loaded SuperGlue model ("outdoor" weights)
Traceback (most recent call last):
File "D:\tracking_2022\deepfeatures\torch_cpp-master\scripts\superglue\jit_superglue_model.py", line 17, in
main()
File "D:\tracking_2022\deepfeatures\torch_cpp-master\scripts\superglue\jit_superglue_model.py", line 11, in main
scripted_module = torch.jit.script(superglue)
File "C:\Users\B\AppData\Roaming\Python\Python39\site-packages\torch\jit_script.py", line 1257, in script
return torch.jit._recursive.create_script_module(
File "C:\Users\B\AppData\Roaming\Python\Python39\site-packages\torch\jit_recursive.py", line 451, in create_script_module
return create_script_module_impl(nn_module, concrete_type, stubs_fn)
File "C:\Users\B\AppData\Roaming\Python\Python39\site-packages\torch\jit_recursive.py", line 513, in create_script_module_impl
script_module = torch.jit.RecursiveScriptModule._construct(cpp_module, init_fn)
File "C:\Users\B\AppData\Roaming\Python\Python39\site-packages\torch\jit_script.py", line 587, in _construct
init_fn(script_module)
File "C:\Users\B\AppData\Roaming\Python\Python39\site-packages\torch\jit_recursive.py", line 491, in init_fn
scripted = create_script_module_impl(orig_value, sub_concrete_type, stubs_fn)
File "C:\Users\B\AppData\Roaming\Python\Python39\site-packages\torch\jit_recursive.py", line 517, in create_script_module_impl
create_methods_and_properties_from_stubs(concrete_type, method_stubs, property_stubs)
File "C:\Users\B\AppData\Roaming\Python\Python39\site-packages\torch\jit_recursive.py", line 368, in create_methods_and_properties_from_stubs
concrete_type._create_methods_and_properties(property_defs, property_rcbs, method_defs, method_rcbs, method_defaults)
RuntimeError:
Can not iterate over a module list or tuple with a value that does not have a statically determinable length
:
File "D:\tracking_2022\deepfeatures\torch_cpp-master\scripts\superglue\SuperGluePretrainedNetwork\models\superglue.py", line 133
def forward(self, desc0: torch.Tensor, desc1: torch.Tensor) -> Tuple[torch.Tensor,torch.Tensor]:
for layer, name in zip(self.layers, self.names):
~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
if name == 'cross':
src0, src1 = desc1, desc0

Please ask how much memory is used๏ผŸ

RuntimeError: CUDA out of memory. Tried to allocate 20.00 MiB (GPU 0; 3.81 GiB total capacity; 1.45 GiB already allocated; 51.69 MiB free; 1.50 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.