GithubHelp home page GithubHelp logo

rystylee / ofxlibtorch Goto Github PK

View Code? Open in Web Editor NEW
14.0 1.0 6.0 92 KB

an openFrameworks wrapper for LibTorch

License: MIT License

Makefile 36.43% C++ 63.57%
openframeworks-addon libtorch deeplearning

ofxlibtorch's Introduction

ofxLibTorch

Description

an openFrameworks wrapper for LibTorch

Requirements

  • Windows10
  • Visual Studio 2019
  • CUDA v10.1
  • openFramewrks v0.11.0
  • LibTorch v1.4.0
  • ofxOpenCV

Install

  1. Download LibTorch from https://pytorch.org/get-started/locally/
  2. Unzip the downloaded file and copy the contents of the "include" and "lib" directories to the following location

Windows

  • libtorch-win-shared-with-deps-1.4.0/include >> libs/win/include/vs/x64/Release
  • libtorch-win-shared-with-deps-1.4.0/lib >> libs/win/lib/vs/x64/Release

macOS

  • libtorch-macos-1.4.0/include >> libs/osx/include
  • libtorch-macos-1.4.0/lib >> libs/osx/lib
  1. In Xcode Build Settings:
  • Under linking -> runpath search paths, add @loader_path/../Frameworks
  • Under search paths -> use header maps, set NO
  1. In Xcode Build Phases -> Run Script, add:
rsync -aved "$OF_PATH/addons/ofxLibTorch/libs/osx/lib/libc10.dylib" "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Frameworks/";
rsync -aved "$OF_PATH/addons/ofxLibTorch/libs/osx/lib/libtorch.dylib" "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Frameworks/";
rsync -aved "$OF_PATH/addons/ofxLibTorch/libs/osx/lib/libtorch_cpu.dylib" "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Frameworks/";
rsync -aved "$OF_PATH/addons/ofxLibTorch/libs/osx/lib/libiomp5.dylib" "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Frameworks/";

and

install_name_tool -change @rpath/libtorch.dylib @loader_path/../Frameworks/libtorch.dylib "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/MacOS/$PRODUCT_NAME";
install_name_tool -change @rpath/libtorch_cpu.dylib @loader_path/../Frameworks/libtorch_cpu.dylib "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/MacOS/$PRODUCT_NAME";
install_name_tool -change @rpath/libc10.dylib @loader_path/../Frameworks/libc10.dylib "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/MacOS/$PRODUCT_NAME";
install_name_tool -change /DLC/torch/libiomp5.dylib @loader_path/../Frameworks/libiomp5.dylib "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/MacOS/$PRODUCT_NAME";

before

echo "$GCC_PREPROCESSOR_DEFINITIONS";

Licence

MIT

ofxlibtorch's People

Contributors

felixdollack avatar rystylee avatar

Stargazers

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

Watchers

 avatar

ofxlibtorch's Issues

Error: No viable overloaded '='

When I try to compile I am stuck with the error No viable overloaded '='.
It appears in BaseModel.cpp in line 18:

mModule = torch::jit::load(modelPath, *mDevice.get());

I am compiling on macOS 10.14.6 with Xcode 10.3.

I see that mModule is a std::unique_ptrm, but from the documentation of torch::jit::load I don't really see if the returned object is also a pointer or something else.
Can you help fix this error?

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.