All Projects → soumith → Torch Android

soumith / Torch Android

Licence: bsd-3-clause
Torch-7 for Android

Labels

Projects that are alternatives of or similar to Torch Android

FindICU.cmake
[CMake] [BSD-2] CMake module to find ICU
Stars: ✭ 28 (-89.63%)
Mutual labels:  cmake
Vanilla Rtb
Real Time Bidding (RTB) - Demand Side Platform framework
Stars: ✭ 257 (-4.81%)
Mutual labels:  cmake
Bitmagic
BitMagic Library
Stars: ✭ 263 (-2.59%)
Mutual labels:  cmake
CmakeSettings
Example CmakeSettings.json for different configurations for using CMake inside of Visual Studio
Stars: ✭ 27 (-90%)
Mutual labels:  cmake
BunnyLOD
Cross platform GLFW based port of Stan Melax's BunnyLOD Easy Mesh Simplification
Stars: ✭ 60 (-77.78%)
Mutual labels:  cmake
Cppprojecttemplate
Basic, but working, C++ project using CMake, boost and Doxygen
Stars: ✭ 259 (-4.07%)
Mutual labels:  cmake
computer-vision-dojo
This is a repository to learn and get more computer vision skills, make robotics projects integrating the computer vision as a perception tool and create a lot of awesome advanced controllers for the robots of the future.
Stars: ✭ 15 (-94.44%)
Mutual labels:  cmake
Bgfx.cmake
Independently maintained CMake build scripts for bgfx. Released under public domain.
Stars: ✭ 267 (-1.11%)
Mutual labels:  cmake
catch cmake coverage
Integration of Catch, CMake and CMake CodeCoverage module and basic examples in C++.
Stars: ✭ 30 (-88.89%)
Mutual labels:  cmake
Libspng
Simple, modern libpng alternative
Stars: ✭ 265 (-1.85%)
Mutual labels:  cmake
CLUSEK-RT
Vulkan based C++ ray-tracing game engine.
Stars: ✭ 24 (-91.11%)
Mutual labels:  cmake
cmake-modules
CMake module collection
Stars: ✭ 30 (-88.89%)
Mutual labels:  cmake
Learningdirectx12
This repository is intended to be used as a code repository for learning DirectX 12.
Stars: ✭ 256 (-5.19%)
Mutual labels:  cmake
c-template
Boilerplate to set up a c project, include CuTest unit testing, cmake build setup
Stars: ✭ 69 (-74.44%)
Mutual labels:  cmake
Shogun
Shōgun
Stars: ✭ 2,859 (+958.89%)
Mutual labels:  cmake
cmake-maven-project
Project to enable using CMake from a Maven build.
Stars: ✭ 57 (-78.89%)
Mutual labels:  cmake
Google Test Examples
Short example how to use Google Test with CMake project
Stars: ✭ 258 (-4.44%)
Mutual labels:  cmake
Libsamplerate
An audio Sample Rate Conversion library
Stars: ✭ 267 (-1.11%)
Mutual labels:  cmake
Boomerang
Boomerang Decompiler - Fighting the code-rot :)
Stars: ✭ 265 (-1.85%)
Mutual labels:  cmake
Sdl2 Cmake Scripts
CMake scripts for finding SDL2 headers and libraries on multiple platforms
Stars: ✭ 260 (-3.7%)
Mutual labels:  cmake

##########################################

Torch-7 for Android

########################################## Torch7 provides a Matlab-like environment for state-of-the-art machine learning algorithms. It is easy to use and provides a very efficient implementation, thanks to an easy and fast scripting language (Lua) and a underlying C implementation.

Modified to be compiled and used with Android

Features

  • Loading of lua packages from the apk directly.
  • This is done by writing a custom package.loader Reference: http://www.lua.org/manual/5.1/manual.html#pdf-package.loaders The loader is in torchandroid.cpp as loader_android
  • torchandroid.h and torchandroid.cpp give lots of helper functions to make life easier
    • Print function overriden to redirect to logcat (only handles strings for now)
    • Function to get apk assets as bytes (very useful)
  • Full support for ffi and shared libraries

torch.load now takes three additional modes: apkbinary32, apkbinary64, apkascii. One can store model files in the assets folder and use these modes to load them. If the model was saved on a 64-bit machine, use apkbinary64, if it was saved on a 32-bit machine, use apkbinary32.

Requirements

For CUDA-enabled version: NVIDIA CodeWorks for Android: https://developer.nvidia.com/codeworks-android.

  • NOTE: CodeWorks 1R5 does not have CUDA! You need to install 1R5 and then CUDA from 1R4.

For CPU-only version : Android NDK (13b) and Android SDK

  • NOTE (Nov 2016): Android NDK v13b is required for NEON, even if building with CodeWorks and CUDA.
  • This is due to some NDK bugs fixed in v13b - CodeWorks has 12b. NDK will only be used to build Lua JIT.
    1. Get it here: https://dl.google.com/android/repository/android-ndk-r13b-linux-x86_64.zip.
    2. Extract it under ~/NVPACK, next to 12b that comes with CodeWorks.
    3. Change NVPACK environvent to point to that NDK (see sample in ./.bashrc-android)

Samples

  • Three sample projects has been provided in demos/
  • demos/android-demo/jni/torchdemo.cpp is a simple use-case
  • demos/android-demo/assets/main.lua is the file that is run
  • demos/android-demo-cifar showcases classifying Camera inputs (or images from gallery) into one of 10 CIFAR-10 categories.
  • Vinayak Ghokale from e-lab Purdue (https://github.com/e-lab) contributed a face detector demo, which showcases a fuller use-case (demos/facedetector_e-lab ).

Building Torch Libraries and Java class.

If on ubuntu, install the following packages: sudo apt-get install libx32gcc-4.8-dev libc6-dev-i386 Default is to build with CUDA - so make sure you installed NVIDIA CodeWorks for Android and its nvcc is in your PATH. Otherwise, set WITH_CUDA=OFF in build.sh

  1. git submodule update --init --recursive
  2. Optionally, open build.sh and modify ARCH (to match your device architecture) and WITH_CUDA variables.
  3. run build script: 3 ./build.sh

You can use torch in your android apps. The relevant directories are

  • install/include - include directories
  • install/libs/$APP_ABI - static libs cross-compiled for your APP_ABI
  • install/share/lua - lua files

Building Android Demo App

  1. Build Torch-Android atleast once using the steps above.
  2. [Optional] Connect your android phone in debugging mode, to automatically install the apk.
  3. Change directory into demos/android-demo folder.
  4. Run build script. $ ./build.sh
  5. Run the app TorchDemo on your phone.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].