1
0
mirror of https://github.com/tiyn/wiki.git synced 2025-12-31 20:19:46 +01:00

python: added combining tf models

This commit is contained in:
2025-12-23 02:57:02 +01:00
parent 1aa98200dc
commit 3bcff627c5

View File

@@ -218,3 +218,18 @@ Additionally it is noted that the dataset may have to be shuffled manually as de
Finally Finally
[a Medium blog post](https://medium.com/@danielonugha0/how-to-change-the-learning-rate-of-tensorflow-b5d854819050) [a Medium blog post](https://medium.com/@danielonugha0/how-to-change-the-learning-rate-of-tensorflow-b5d854819050)
describes how to easily change the learning rate. describes how to easily change the learning rate.
#### Combining Models
Models that are normally run in sequence but trained and saved separately can be easily be combined
into a single model.
This can have some advantages, for example when using inteference for deep learning on Edge TPUs
like the [Hailo chips](/wiki/hailo.md) or the [EPS32S3](/wiki/microcontroller.md#esp32).
A simple example for the combination of two models (`model1` and `model2`) into a new model
(`combined_model`) is the following code.
```sh
output = model2(model1.output)
combined_model = tf.keras.models.Model(inputs=model1.input, outputs=output)
```