• Stars
    star
    114
  • Rank 298,257 (Top 7 %)
  • Language
    Shell
  • License
    Apache License 2.0
  • Created over 4 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Pre-built TensorFlow for C/C++ and CMake.

TensorFlow C++ CMake

Documentation Build Status

TensorFlow CMake

This repository provides pre-built TensorFlow for C/C++ (headers + libraries) and CMake.

Maintainer: Vassilios Tsounis
Affiliation: Robotic Systems Lab, ETH Zurich
Contact: [email protected]

Overview

This repository provides TensorFlow libraries with the following specifications:

  • Provided versions: 1.15.2 (Default) and 1.13.2
  • Supported for Ubuntu 18.04 LTS.
  • Built with GCC>=7.5.
  • Built with support for C++14.
  • Provides variants for CPU-only and Nvidia GPU respectively.
  • All variants are built with full CPU optimizations available for amd64 architectures.
  • GPU variants are built to support compute capabilities: 5.0, 6.1, 7.0, 7.2, 7.5

NOTE: This repository does not include the TensorFlow source files.

NOTE: As each pre-built distribution of TensorFlow is quite large (~1GB), the tensorflow/CMakeLists.txt CMake script will automatically download and unpack the archive the first time the package is built.

A complete CMake example example is provided for demonstrating how to write dependent packages.

Moreover, we provide additional scripts and tooling for:

  • Downloading, patching and installing Eigen.
  • Building tensorflow from source and extracting all library binaries and headers.

Install

First clone this repository:

git clone https://github.com/leggedrobotics/tensorflow-cpp.git

or if using SSH:

git clone [email protected]:leggedrobotics/tensorflow-cpp.git

Eigen

Each distribution of tensorflow>=r1.13 requires a special patched version of the Eigen header-only library. As of v0.2.0 of this repository, the aforementioned patched header files of Eigen are already included in the the headers downloaded by tensorflow/CMakeLists.txt. However, in certain cases, code in some package A using tensorflow-cpp might interface with some other code in an external package B that also uses Eigen. Thus, in order to ensure that A and B work together properly, we must build both packages using the same version of Eigen.

For such cases, we provide an bash script in tensorflow-cpp/eigen/install.sh.

To download, unpack and patch Eigen:

cd tensorflow-cpp/eigen
./install.sh

To additionally build and install Eigen, the --run-cmake argument can be used:

cd tensorflow-cpp/eigen
./install.sh --run-cmake

NOTE: We recommend installing to ~/.local in order to prevent conflicts with other version of Eigen which may be installed via apt. Eigen exports its package during the build step, so CMake will default to finding the one we just installed unless a HINT is used or CMAKE_PREFIX_PATH is set to another location.

TensorFlow

These are the options for using the TensorFlow CMake package:

Option 1 (Recommended): Installing into the (local) file system

cd tensorflow-cpp/tensorflow
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=~/.local -DCMAKE_BUILD_TYPE=Release ..
make install -j

NOTE: The CMake will download the pre-built headers and binaries at build time and should only happen on the first run.

Option 2 (Advanced): Create symbolic link to your target workspace directory:

ln -s /<SOURCE-PATH>/tensorflow/tensorflow <TARGET-PATH>/

For example, when including as part of larger CMake build or in a Catkin workspace

ln -s ~/git/tensorflow/tensorflow ~/catkin_ws/src/

Use

TensorFlow CMake can be included in other projects either using the find_package command:

...
find_package(TensorFlow CONFIG REQUIRED)
...

or alternatively included directly into other projects using the add_subdirectory command

...
add_subdirectory(/<SOURCE-PATH>/tensorflow/tensorflow)
...

NOTE: By default the CMake package will select the CPU-only variant of a given library version and defining/setting the TF_USE_GPU option variable reverts to the GPU-enabled variant.

User targets such as executables and libraries can now include the TensorFlow::TensorFlow CMake target using the target_link_libraries command.

add_executable(tf_hello src/main.cpp)
target_link_libraries(tf_hello PUBLIC TensorFlow::TensorFlow)
target_compile_features(tf_hello PRIVATE cxx_std_14)

NOTE: For more information on using CMake targets please refer to this excellent article.

Please refer to our complete example for details.

Customize

If a specialized build of TensorFlow (e.g. different verion of CUDA, NVIDIA Compute Capability, AVX etc) is required, then the following steps can be taken:

  1. Follow the standard instructions for installing system dependencies.
    NOTE: For GPU-enabled systems, additional steps need to be taken.
  2. View and/or modify our utility script for step-by-step instructions for building, extracting and packaging all headers and libraries generated by Bazel from building TensorFlow.
  3. Set the TENSORFLOW_ROOT variable with the name of the resulting directory:
cmake -DTENSORFLOW_ROOT=~/.tensorflow/lib -DCMAKE_INSTALL_PREFIX=~/.local -DCMAKE_BUILD_TYPE=Release ..

Issues

If experiencing any issues please first take a look at our ISSUES.md file. If you are experiencing something we have not accounted for please create a new repository issue.

License

Apache License 2.0

More Repositories

1

darknet_ros

YOLO ROS: Real-Time Object Detection for ROS
C++
2,017
star
2

ros_best_practices

Best practices, conventions, and tricks for ROS. Do you want to become a robotics master? Then consider graduating or working at the Robotics Systems Lab at ETH in Zรผrich!
C++
1,403
star
3

legged_gym

Isaac Gym Environments for Legged Robots
Python
971
star
4

ocs2

Optimal Control for Switched Systems
C++
731
star
5

elevation_mapping_cupy

Elevation Mapping on GPU.
Python
455
star
6

open3d_slam

Pointcloud-based graph SLAM written in C++ using open3D library.
C++
454
star
7

se2_navigation

Pure Pursuit Control and SE(2) Planning
C++
402
star
8

free_gait

An Architecture for the Versatile Control of Legged Robots
C++
388
star
9

rsl_rl

Fast and simple implementation of RL algorithms, designed to run fully on GPU.
Python
330
star
10

raisimLib

RAISIM, A PHYSICS ENGINE FOR ROBOTICS AND AI RESEARCH
325
star
11

traversability_estimation

Traversability mapping for mobile rough terrain navigation
C++
310
star
12

xpp

Visualization of Motions for Legged Robots in ros-rviz
C++
293
star
13

graph_msf

A graph-based multi-sensor fusion framework. It can be used to fuse various relative or absolute measurments with IMU readings in real-time.
C++
239
star
14

icp_localization

This package provides localization in a pre-built map using ICP and odometry (or the IMU measurements).
C++
232
star
15

delora

Self-supervised Deep LiDAR Odometry for Robotic Applications
Python
221
star
16

SimBenchmark

Physics engine benchmark for robotics applications: RaiSim vs Bullet vs ODE vs MuJoCo vs DartSim
C++
193
star
17

iPlanner

iPlanner: Imperative Path Planning. An end-to-end learning planning framework using a novel unsupervised imperative learning approach
Python
178
star
18

learning_quadrupedal_locomotion_over_challenging_terrain_supplementary

Supplementary materials for "Learning Locomotion over Challenging Terrain"
C++
162
star
19

raisimGym

Python
141
star
20

art_planner

Local Navigation Planner for Legged Robots
C++
116
star
21

perceptive_mpc

C++
105
star
22

vitruvio

Vitruvio is a framework for rapid leg design analysis and optimization for legged robots. The purpose of the simulation framework is to guide the early stages of legged robot design. The end effectors track an input trajectory and the necessary joint speed, torque, power and energy for the tracking is computed.
MATLAB
86
star
23

terrain-generator

Python
85
star
24

L3E

Learning-based localizability estimation for robust LiDAR localization.
82
star
25

MPC-Net

Accompanying code for the publication "MPC-Net: A First Principles Guided Policy Search"
Python
77
star
26

wild_visual_navigation

Wild Visual Navigation: A system for fast traversability learning via pre-trained models and online self-supervision
Python
77
star
27

elmo_ethercat_sdk

C++
74
star
28

rayen

Imposition of Hard Convex Constraints on Neural Networks
Python
67
star
29

raisimOgre

https://rsl.ethz.ch/partnership/spinoff/raisim.html
67
star
30

tree_detection

This package implements a simple tree detector from point cloud data. It makes no assumptions about the ground plane and can handle arbitrary terrains.
C++
66
star
31

noesis

A Reinforcement Learning Software Toolbox for Robotics
C++
52
star
32

hardware_time_sync

Guidelines on how to hardware synchronize the time of multiple sensors, e.g., IMU, cameras, etc.
46
star
33

RSLGym

Reinforcement learning framework from RSL for policy training with RaiSim.
Python
45
star
34

anomaly_navigation

Anomaly Navigation - ANNA
Python
39
star
35

cerberus_darpa_subt_datasets

Datasets collected by Team CERBERUS during the DARPA Subterranean Challenge
37
star
36

RaiSimUnity

A visualizer for RaiSim based on Unity
31
star
37

swerve_steering

C++
26
star
38

smug_planner

C++
26
star
39

workflows

Collection of workflows, best-practices and guidelines for software development.
Python
26
star
40

tcan

A library to communicate to devices connected through CAN, EtherCat, USB or TCP/IP.
C++
26
star
41

soem_interface

This software package serves as a C++ interface for one or more EtherCAT devices running on the same bus. The lower level EtherCAT communication is handled by the SOEM library.
C
25
star
42

urdf2robcogen

A tool that translates a robot URDF description into the kindsl format that can be processed by RobCoGen.
C++
21
star
43

raw_image_pipeline

Image processing pipeline for cameras that provide RAW data
C++
20
star
44

maxon_epos_ethercat_sdk

Implementation of an ethercat device driver for the maxon epos 4
C++
16
star
45

cuda_ue4_linux

C++
15
star
46

ethercat_sdk_master

A wrapper around SOEM to allow multiple masters and devices on EtherCAT
C++
13
star
47

ocs2_robotic_assets

Various robotic assets for OCS2 Toolbox
CMake
13
star
48

cerberus_anymal_locomotion

C++
13
star
49

ethercat_device_configurator

Manages setup yaml files for the RSL ethercat infrastructure
C++
12
star
50

pytictac

Simple Timing Utils
Python
12
star
51

catkin_create_rqt

An RQT plugin generator script, supporting several arguments to generate a rqt plugin for ROS, similar to catkin_create_pkg
Python
12
star
52

terra

A grid world environment for high-level earthworks planning in JAX for RL.
Python
12
star
53

learning_docker

Shell
8
star
54

plr-exercise

Python
7
star
55

terra-baselines

Train, visualize, and evaluate RL policies for the Terra environment.
Python
7
star
56

viplanner

ViPlanner: Visual Semantic Imperative Learning for Local Navigation
Python
7
star
57

rl-blindloco

Project page for Science Robotics paper "Learning Quadrupedal Locomotion over Challenging Terrain"
HTML
7
star
58

anymal_brax

Python
7
star
59

rsl_heap

CMake
7
star
60

any_ping_indicator

An Ubuntu indicator applet to show the ping status.
Python
7
star
61

self_supervised_segmentation

Python
6
star
62

ros_comm

ROS communications-related packages, including core client libraries (roscpp, rospy, roslisp) and graph introspection tools (rostopic, rosnode, rosservice, rosparam).
Python
4
star
63

gtsam_catkin

Catkinized version of gtsam.
CMake
3
star
64

mobile_manipulation

Under construction
3
star
65

digbench

Benchmarks and map generation for the Terra environment.
Python
3
star
66

realsense_eth_robotics_summer_school_2019

Launch files and utility nodes for running the Realsense on SMB
CMake
2
star
67

rsl_panoptic_mapping

C++
1
star
68

rsl_panoptic

Python
1
star
69

pretrained_depth_embedders

Python
1
star
70

darknet_ros-release

1
star
71

webapp-container

Scripts and tools to containerize a PHP-FPM, Nginx, Redis web-application โš™๏ธ
Dockerfile
1
star
72

xpp-release

Release repository of the xpp repo, necessary for ros hosting.
1
star