{"id":13474498,"url":"https://github.com/serizba/cppflow","last_synced_at":"2025-05-16T07:06:41.563Z","repository":{"id":38203648,"uuid":"187098283","full_name":"serizba/cppflow","owner":"serizba","description":"Run TensorFlow models in C++ without installation and without Bazel","archived":false,"fork":false,"pushed_at":"2024-08-16T20:39:22.000Z","size":8768,"stargazers_count":798,"open_issues_count":49,"forks_count":179,"subscribers_count":25,"default_branch":"master","last_synced_at":"2025-04-12T04:13:57.947Z","etag":null,"topics":["c","cpp","inference","model","neural-networks","tensorflow","tensorflow-cpp","tensorflow-examples","tensorflow-models"],"latest_commit_sha":null,"homepage":"https://serizba.github.io/cppflow/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/serizba.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-05-16T20:40:05.000Z","updated_at":"2025-04-09T08:44:14.000Z","dependencies_parsed_at":"2024-09-02T16:30:49.756Z","dependency_job_id":"56821212-7147-4fec-8517-132ca28e261e","html_url":"https://github.com/serizba/cppflow","commit_stats":{"total_commits":95,"total_committers":26,"mean_commits":"3.6538461538461537","dds":0.6210526315789473,"last_synced_commit":"99e04d7045af79ef8fe9f906cf0d9bd5559dd935"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serizba%2Fcppflow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serizba%2Fcppflow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serizba%2Fcppflow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serizba%2Fcppflow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/serizba","download_url":"https://codeload.github.com/serizba/cppflow/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254485066,"owners_count":22078767,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","cpp","inference","model","neural-networks","tensorflow","tensorflow-cpp","tensorflow-examples","tensorflow-models"],"created_at":"2024-07-31T16:01:12.765Z","updated_at":"2025-05-16T07:06:36.546Z","avatar_url":"https://github.com/serizba.png","language":"C++","readme":"# ![cppflow](docs/source/cppflow.svg)\n\nRun 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++.\n\n```c++\n// Read the graph\ncppflow::model model(\"saved_model_folder\");\n\n// Load an image\nauto input = cppflow::decode_jpeg(cppflow::read_file(std::string(\"image.jpg\")));\n\n// Cast it to float, normalize to range [0, 1], and add batch_dimension\ninput = cppflow::cast(input, TF_UINT8, TF_FLOAT);\ninput = input / 255.f;\ninput = cppflow::expand_dims(input, 0);\n\n// Run\nauto output = model(input);\n\n// Show the predicted class\nstd::cout \u003c\u003c cppflow::arg_max(output, 1) \u003c\u003c std::endl;\n```\n\nYou can take a look to the [examples](https://github.com/serizba/cppflow/tree/master/examples/) to see a full example on how to load a deep network and feed it with a sample image.\n\nCppFlow uses [Tensorflow C API](https://www.tensorflow.org/install/lang_c) 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:\n\n* Open saved models created with Python\n* Execute Tensorflow neural networks in C++\n* Perform tensor manipulation directly from C++\n\n## How To Run It\n\nSince it uses TensorFlow 2 C API you just have to [download it](https://www.tensorflow.org/install/lang_c), check the [docs](https://serizba.github.io/cppflow/installation.html) to see a guide on how to do it.  \n\nAfterwards, you can install the library:\n\n```sh\ngit clone git@github.com:serizba/cppflow.git\ncd cppflow/examples/load_model\nmkdir build\ncd build\ncmake ..\nmake -j\nmake install\n```\n\nNow you can check the [quickstart guide](https://serizba.github.io/cppflow/quickstart.html) to run a program using cppflow.\n\n\n## Documentation\n\nCheck the docs at [https://serizba.github.io/cppflow/](https://serizba.github.io/cppflow/).\n\nThere you can find quickstart guides and more information about how to install the library and run the examples.\n\n## Development\n\nCppFlow is basically a wrapper over Tensorflow C API. The basic class, [tensor](https://github.com/serizba/cppflow/blob/master/include/cppflow/tensor.h) is a wrapper of a TF eager tensor, and it just constains a pointer to its TF representation.\n\nThe TF C API provides the tools to call all the TF [raw ops](https://www.tensorflow.org/api_docs/python/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](https://github.com/serizba/cppflow/blob/master/include/cppflow/raw_ops.h) contains (mostly) all the TF raw ops functions, but with a simple C++ interface. This file has been generated automatically using a [small script](https://github.com/serizba/cppflow/blob/master/include/cppflow/ops_generator/generator.py).\n\nCppFlow also includes a wrapper on TF saved models, the [model](https://github.com/serizba/cppflow/blob/master/include/cppflow/model.h) class, so they can be easily opened and executed.\n\n## Contributors\n\nIf you are willing to contribute to this project, please go ahead an visit the [development roadmap of cppflow](https://github.com/users/serizba/projects/3). Specially `contributor_wanted` labelled PR or issues are very welcome to new contributors.\n\n# Citation\n\nIf you use this code or find this work useful in your research, please cite us:\n\n```\n@software{\n    izquierdo2019cppflow,\n    author = {Izquierdo, Sergio},\n    doi = {10.5281/zenodo.7107618},\n    title = {{cppflow: Run TensorFlow models in C++ without installation and without Bazel}},\n    url = {https://github.com/serizba/cppflow},\n    version = {2.0.0},\n    month = {5},\n    year = {2019}\n}\n```\n\n## Style guide\n\nWe use the [Google's C++ style guide](https://google.github.io/styleguide/cppguide.html) using static code linker [cpplint](https://github.com/cpplint/cpplint).\nWe use the [Google's Python style guide](https://google.github.io/styleguide/pyguide.html) using static code linker [pylint](https://pylint.pycqa.org/en/latest/user_guide/installation/index.html) using attached pylintrc configuration.\n\n\n## Remark\n\nCppFlow 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.\n","funding_links":[],"categories":["C++"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserizba%2Fcppflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fserizba%2Fcppflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserizba%2Fcppflow/lists"}