Commit ddd87da2 authored by pbethge's avatar pbethge
Browse files

Merge branch 'develop' into feature/frozen_graph_charrnn

parents 4ea3ce35 057e3d9c
1.2.2: 2022 Feb 21
* update cppflow
* add support for frozen graphs
* add basic frozen graph example
* fix ofxTF2::Model::runMultiModel() more less inputs than initially named
1.2.1: 2022 Feb 16
* fixed incorrect changelog version
......
......@@ -243,7 +243,7 @@ The example projects are located in the `example_XXXX` directories.
### Downloading Pre-Trained Models
Each example contains code to create a neural network and export it in the [SavedModel format](https://www.tensorflow.org/guide/saved_model). Neural networks require training which may take hours or days in order to produce a satisfying output, therefore we provide pre-trained models which you can download as ZIP files, either from the release page on GitHub or from a public shared link here:
Each example contains code to create a neural network and export it in the [SavedModel format](https://www.tensorflow.org/guide/saved_model) or previous frozen GraphDef format. Neural networks require training which may take hours or days in order to produce a satisfying output, therefore we provide pre-trained models which you can download as ZIP files, either from the release page on GitHub or from a public shared link here:
<https://cloud.zkm.de/index.php/s/gfWEjyEr9X4gyY6>
......@@ -297,7 +297,7 @@ Simply select ofxTensorFlow2 from the available addons in the OF ProjectGenerato
#### Model Format
ofxTensorFlow2 works with the TensorFlow 2 [SavedModel format](https://www.tensorflow.org/guide/saved_model).
ofxTensorFlow2 works with the TensorFlow [SavedModel format](https://www.tensorflow.org/guide/saved_model) (preferred) and the older TensorFlow 1 frozen GraphDef format (legacy).
When referring to the "SavedModel" we mean the parent folder of the exported neural network containing two subfolder `assets` and `variables` and a `saved_model.pb` file. Do not change anything inside this folder, however renaming the folder is permitted. Keep in mind to use the correct file path within the application.
......
# Basic example
This is a very basic example wich demonstrates how to load and infer a _Frozen Graph_ created using TensorFlow.
_Frozen Graph_ is the standard of storing a graph for versions of TensorFlow < 1.15.
Frozen GraphDef is the standard of storing a graph for versions of TensorFlow < 1.15.
We wanted to support this feature for legacy reasons.
### TensorFlow2
......@@ -11,7 +11,7 @@ python main.py
```
### openFrameworks
By default `ofxTF2::Model` will use the `SavedModel` format. To use the `FrozenGraph` format you may either add the type to the constructor or call `setModelType()` afterwards.
By default `ofxTF2::Model` will use the `SavedModel` format. To use the frozen GraphDef format you may either add the type to the constructor or call `setModelType()` afterwards.
As the default names differ from the names in the `SavedModel` format make sure to overwrite names of the ins and outs by calling `setup()`.
```c++
// set model type and i/o names
......
......@@ -94,8 +94,14 @@ Model::runMultiModel(const std::vector<cppflow::tensor> & inputs) const {
using inputTuple_t = std::tuple<std::string, cppflow::tensor>;
std::vector<inputTuple_t> inputArguments;
if (inputs.size() > inputNames_.size()) {
ofLogError("ofxTensorFlow2") << "Model: number of inputs greater than "
<< "number of input names";
return std::vector<cppflow::tensor>(-1);
}
// add the names from settings and tensors to the vector of arguments
for(unsigned int i = 0; i < inputNames_.size(); i++) {
for(unsigned int i = 0; i < inputs.size(); i++) {
inputArguments.push_back(inputTuple_t(inputNames_[i], inputs[i]));
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment