cppflow
Run TensorFlow models in C++ without installation and without Bazel
Science Score: 67.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 1 DOI reference(s) in README -
○Academic publication links
-
✓Committers with academic emails
1 of 22 committers (4.5%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (15.5%) to scientific vocabulary
Keywords
Repository
Run TensorFlow models in C++ without installation and without Bazel
Basic Info
- Host: GitHub
- Owner: serizba
- License: mit
- Language: C++
- Default Branch: master
- Homepage: https://serizba.github.io/cppflow/
- Size: 8.36 MB
Statistics
- Stars: 802
- Watchers: 25
- Forks: 179
- Open Issues: 49
- Releases: 2
Topics
Metadata Files
README.md
Run TensorFlow models in c++ without Bazel, without TensorFlow installation and without compiling Tensorflow. Perform tensor manipulation, use eager execution and run saved models directly from C++.
```c++ // Read the graph cppflow::model model("savedmodelfolder");
// Load an image auto input = cppflow::decodejpeg(cppflow::readfile(std::string("image.jpg")));
// Cast it to float, normalize to range [0, 1], and add batchdimension input = cppflow::cast(input, TFUINT8, TFFLOAT); input = input / 255.f; input = cppflow::expanddims(input, 0);
// Run auto output = model(input);
// Show the predicted class std::cout << cppflow::arg_max(output, 1) << std::endl; ```
You can take a look to the examples to see a full example on how to load a deep network and feed it with a sample image.
CppFlow uses Tensorflow C API to run the models, meaning you can use it without installing Tensorflow and without compiling the whole Tensorflow repository with bazel, you just need to download the C API. With this project you can manage and run your models in C++ without worrying about void, malloc or free. With CppFlow you easily can:
- Open saved models created with Python
- Execute Tensorflow neural networks in C++
- Perform tensor manipulation directly from C++
How To Run It
Since it uses TensorFlow 2 C API you just have to download it, check the docs to see a guide on how to do it.
Afterwards, you can install the library:
sh
git clone git@github.com:serizba/cppflow.git
cd cppflow/examples/load_model
mkdir build
cd build
cmake ..
make -j
make install
Now you can check the quickstart guide to run a program using cppflow.
Documentation
Check the docs at https://serizba.github.io/cppflow/.
There you can find quickstart guides and more information about how to install the library and run the examples.
Development
CppFlow is basically a wrapper over Tensorflow C API. The basic class, tensor is a wrapper of a TF eager tensor, and it just constains a pointer to its TF representation.
The TF C API provides the tools to call all the TF raw ops, but using them is confusing. CppFlow includes a facade over these functions, so they can be called easily as normal C++ functions. To achieve this, the file ops contains (mostly) all the TF raw ops functions, but with a simple C++ interface. This file has been generated automatically using a small script.
CppFlow also includes a wrapper on TF saved models, the model class, so they can be easily opened and executed.
Contributors
If you are willing to contribute to this project, please go ahead an visit the development roadmap of cppflow. Specially contributor_wanted labelled PR or issues are very welcome to new contributors.
Citation
If you use this code or find this work useful in your research, please cite us:
@software{
izquierdo2019cppflow,
author = {Izquierdo, Sergio},
doi = {10.5281/zenodo.7107618},
title = {{cppflow: Run TensorFlow models in C++ without installation and without Bazel}},
url = {https://github.com/serizba/cppflow},
version = {2.0.0},
month = {5},
year = {2019}
}
Style guide
We use the Google's C++ style guide using static code linker cpplint. We use the Google's Python style guide using static code linker pylint using attached pylintrc configuration.
Remark
CppFlow is not related with TensorFlow. The CppFlow icon is a modified version of the TensorFlow logo. TensorFlow, the TensorFlow logo and any related marks are trademarks of Google Inc.
Owner
- Name: Sergio Izquierdo
- Login: serizba
- Kind: user
- Location: Zaragoza
- Website: https://serizba.github.io/
- Repositories: 3
- Profile: https://github.com/serizba
PhD student at University of Zaragoza
Citation (CITATION.cff)
cff-version: 1.2.0 message: "If you use this software, please cite it as below." authors: - family-names: "Izquierdo" given-names: "Sergio" orcid: "https://orcid.org/0000-0002-5639-5035" title: "cppflow: Run TensorFlow models in C++ without installation and without Bazel" version: 2.0.0 doi: 10.5281/zenodo.7107618 date-released: 2019-05-16 url: "https://github.com/serizba/cppflow"
GitHub Events
Total
- Issues event: 3
- Watch event: 20
- Issue comment event: 2
- Fork event: 2
Last Year
- Issues event: 3
- Watch event: 20
- Issue comment event: 2
- Fork event: 2
Committers
Last synced: 9 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Sergio Izquierdo | s****a@g****m | 40 |
| Jiannan Liu | l****7@g****m | 14 |
| Paul Nykiel | p****l@u****e | 11 |
| D Bersan | d****n@g****m | 4 |
| suresh-guttikonda | 4****n | 4 |
| pbethge | b****h@g****m | 3 |
| Carl Poirier | c****r@v****m | 2 |
| Afaq Sabir | a****r@i****k | 2 |
| Tim Upthegrove | t****e@g****m | 2 |
| Alfredo Rodriguez | a****o@m****m | 1 |
| Alfredo Rodriguez | m****z@g****m | 1 |
| Carl Poirier | c****2@g****m | 1 |
| Florian Fervers | f****s@g****m | 1 |
| Paolo Galeone | n****o@n****u | 1 |
| Rustom Ichhaporia | 4****a | 1 |
| agent-q1 | s****1@g****m | 1 |
| dskkato | k****9@g****m | 1 |
| seungtaek94 | s****4@g****m | 1 |
| liufeng27 | l****7@b****m | 1 |
| Kevin Sasso | k****o@v****n | 1 |
| Baris Demiray | b****y@d****m | 1 |
| suresh-guttikonda | 4****a | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 78
- Total pull requests: 26
- Average time to close issues: 5 months
- Average time to close pull requests: 5 months
- Total issue authors: 65
- Total pull request authors: 12
- Average comments per issue: 4.23
- Average comments per pull request: 3.12
- Merged pull requests: 17
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 1
- Pull requests: 0
- Average time to close issues: about 2 hours
- Average time to close pull requests: N/A
- Issue authors: 1
- Pull request authors: 0
- Average comments per issue: 1.0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- ljn917 (5)
- karloballa (2)
- bytosaur (2)
- rani-pinchuk (2)
- barrelo89 (2)
- demonstan (2)
- tranvanh (2)
- Amuqeet09 (2)
- CarlPoirier (2)
- Arnold1 (2)
- ricolx (1)
- bronstein87 (1)
- junhyeokahn (1)
- andthenwhat (1)
- aditya-vora (1)
Pull Request Authors
- ljn917 (11)
- khaled-besrour (2)
- CarlPoirier (2)
- barrelo89 (2)
- ivanallen (2)
- barisdemiray (1)
- aul12 (1)
- AfaqSabirIBEX (1)
- snandi76 (1)
- dbersan (1)
- ghost (1)
- georgios-v (1)
- rustom (1)
- 8-byte (1)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- JamesIves/github-pages-deploy-action 3.7.1 composite
- actions/checkout v2 composite
- actions/setup-python v1 composite