Tryed Replace a TensorFlow-Keras Layer in a pretrained Network (Error netUpdated = initialize(net))

7 ビュー (過去 30 日間)
Mathias Sprenger
Mathias Sprenger 2023 年 4 月 11 日
回答済み: Sourabh 2023 年 8 月 18 日
I try to import a pretrained Network from the Savedmodel format. When I use the initialize Function I get the following Error:
Example inputs: Incorrect number of example network inputs. 0 example network inputs provided but network has 1 inputs including 1
unconnected layer inputs.
Layer 'input_1': Unconnected input. Each input must be connected to input data or to the output of another layer.
So I tryed to replace the TensorFlow-Keras Layers (Placeholders) to get a fully connection.
1 'input_1' Input Verification This layer verifies the input to 'input_1' has size [1 875 1] and data format 'UUU'.
2 'tf.__operators__.getitem' PLACEHOLDER LAYER Placeholder for 'SlicingOpLambda' Keras layer
3 'tf.__operators__.getitem_1' PLACEHOLDER LAYER Placeholder for 'SlicingOpLambda' Keras layer
4 'tf.math.subtract' PLACEHOLDER LAYER Placeholder for 'TFOpLambda' Keras layer
5 'tf.math.multiply' PLACEHOLDER LAYER Placeholder for 'TFOpLambda' Keras layer
6 'tf.__operators__.getitem_2' PLACEHOLDER LAYER Placeholder for 'SlicingOpLambda' Keras layer
7 'tf.__operators__.getitem_3' PLACEHOLDER LAYER Placeholder for 'SlicingOpLambda' Keras layer
8 'tf.math.subtract_1' PLACEHOLDER LAYER Placeholder for 'TFOpLambda' Keras layer
9 'tf.math.multiply_1' PLACEHOLDER LAYER Placeholder for 'TFOpLambda' Keras layer
10 'tf.compat.v1.pad' PLACEHOLDER LAYER Placeholder for 'TFOpLambda' Keras layer
11 'tf.compat.v1.pad_1' PLACEHOLDER LAYER Placeholder for 'TFOpLambda' Keras layer
12 'tf.concat' PLACEHOLDER LAYER Placeholder for 'TFOpLambda' Keras layer
13 'conv1' 1-D Convolution 96 7×3 convolutions with stride 3 and padding 'same'
But the Problem is that there are no Corresponding Deep Learning Toolbox Layers. Are there more possibilities to convert TensorFlow-Keras Layers or to replace them? I tryed already to import the model as ONNX and Keras Format.

回答 (1 件)

Sourabh
Sourabh 2023 年 8 月 18 日
Greetings Mathias,
The list of supported ‘Keras’ layers that the Deep Learning Toolbox Converter supports can be found in the ‘Supported Keras Layers’ section of this documentation page:
If the network contains a layer that isare not supported, then ‘importKerasNetwork’ returns an error message. In this case, you can still use ‘importKerasLayers’ to import the network architecture and weights.
If you import a custom ‘TensorFlow-Keras' layer or if the software cannot convert a ‘TensorFlow-Keras' layer into an equivalent built-in MATLAB layer, you can use ‘importTensorFlowNetwork’ or ‘importTensorFlowLayers’, which try to generate a custom layer. For example, ‘importTensorFlowNetwork’ and ‘importTensorFlowLayers’ generate a custom layer when you import a ‘TensorFlow-Keras' Lambda layer.
The following documentation pages might help you further:
You can try and use the ‘replaceLayer’ function to replace placeholder layers in your imported model:
Hope this helps.

カテゴリ

Help Center および File ExchangeImage Data Workflows についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by